Page 2 of 2 FirstFirst 12
Results 21 to 25 of 25

Thread: select all is now working

  1. #21
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: select all is now working

    Quote Originally Posted by godlesplay View Post
    how check the QSqlQuery?
    Earlier you posted code that iterates through a query result, no?

    Quote Originally Posted by godlesplay View Post
    When I check number of rows in the model using "qDebug() << model->rowCount();" it returns 0 in console.
    Then it will be interesting to see if the query works directly.
    Because it looks like there is no data for that query.

    Quote Originally Posted by godlesplay View Post
    how to compate values of the rows with the values from the query?
    Well, since your model says it has 0 rows there is no data to compare.

    Cheers,
    _

  2. #22
    Join Date
    Jan 2016
    Posts
    18
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: select all is now working

    So I have no idea why tableWidget can obtain my data from my database and tableView not.

  3. #23
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: select all is now working

    The table widget does not obtain data, you are iterating over a query object there.
    And the code you posted for the table widget case was a different then the one you tried with the query model.

    Cheers,
    _

  4. #24
    Join Date
    Jan 2016
    Posts
    18
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: select all is now working

    So I found another method to obtain data from db http://wklej.to/4MWsN but it returns values from 1st row, how can I obtain other data?

  5. #25
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: select all is now working

    You could read the documentation of QSqlQuery, it even comes with an example.

    Cheers,
    _

Similar Threads

  1. Select a row from QTreeView
    By vieraci in forum Qt Programming
    Replies: 5
    Last Post: 7th December 2015, 19:44
  2. SQL select and use
    By cecchinoSMI in forum Qt Programming
    Replies: 1
    Last Post: 6th March 2014, 15:48
  3. Replies: 7
    Last Post: 24th September 2012, 07:17
  4. select a QTreeWidgetItem
    By mattia in forum Newbie
    Replies: 2
    Last Post: 21st December 2007, 11:01
  5. Select None in QTableWidget
    By Rayven in forum Qt Programming
    Replies: 2
    Last Post: 9th June 2006, 14:10

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.