title: next() in QSqlQuery returns the last record in the table
body: <p>When search button is clicked, it shows the first record in the table like this;</p>
  
  <pre><code>void EditEntry::on_search_button_clicked() {
      QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
      db.setDatabaseName("database.db");
      bool ok = db.open();
      if (ok) {
  
          QSqlQuery query1("SELECT * FROM table_name WHERE last_name LIKE '%Nana%'");
          if (query1.first()) {
              //show first record in the table where last name like Nana
          }
  }
  </code></pre>
  
  <p>I am trying to make the query move to the next record in the table by the click of a button like this;</p>
  
  <pre><code>void EditEntry::on_next_button_clicked() {
      QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
      db.setDatabaseName("database.db");
      bool ok = db.open();
      if (ok) {
          QSqlQuery query1("SELECT * FROM table_name WHERE last_name LIKE '%Nana%'");
          if (query1.isActive()) {
              while (query1.next()) {
                  //show the next record in the table with last name like Nana
              }
  } 
  </code></pre>
  
  <p>And showing the previous record with the name like 'Nana' like this;</p>
  
  <pre><code>void EditEntry::on_previous_button_clicked() {
      QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
      db.setDatabaseName("database.db");
      bool ok = db.open();
      if (ok) {
          QSqlQuery query1("SELECT * FROM table_name WHERE last_name LIKE '%Nana%'");
          if (query1.isActive()) {
              while (query1.previous()) {
                  //show previous record in the table where last name like Nana
              }
  }
  </code></pre>
  
  <p>The <code>on_search_button_clicked()</code> works well by showing the 1st record with last name like 'Nana'. The <code>on_next_button_clicked()</code> shows the last record in the table with name like 'Nana' instead of the next record after the 1st (the table has 3 records with last name like 'Nana'). The <code>on_previous_button_clicked()</code> button doesn't work at all, it shows nothing even though i expect it to show the previous record with last name like 'Nana'. How do i get these buttons to work as i expect?</p>
  
  <p>P.S.; what i wanted was, whenever the <code>on_next_button_clicked()</code> is clicked it should keep showing the next record till it gets to the last record in the table.</p>