Results 1 to 2 of 2

Thread: Empty QtableWidget opening database tables in two widgets (QStackedWidget)

  1. #1
    Join Date
    Mar 2016
    Posts
    22
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Empty QtableWidget opening database tables in two widgets (QStackedWidget)

    Hello to everybody,
    After preparing some widgets, I tried to collect them in a one-page program (mainwindow), using QStackedWidget. No problem with it, loading of my different widgets work well, but I have a difficulty with two pages: these widgets call a SELECT function to the same database (as “SELECT employer FROM Company” and “SELECT department FROM Company”), showing data in their UI using QTableWidget. The result of the calling of two instances of database seems to be that both the tables are loaded, but in the first the QTableWidget appears empty, while in the second is all OK. It’s enough that I operate on the first table (for example, with a sorting) to reload the data, and having a right behavior.
    Of course, this is not caused by QStackedWidget, as I obtain the same result forcing, in main.cpp, the open of both these widgets.
    How is possible to update the data after the widgets are staked in mainwindow?
    Thanks for any suggestion!

  2. #2
    Join Date
    Mar 2016
    Posts
    22
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Empty QtableWidget opening database tables in two widgets (QStackedWidget)

    Solved! for a mistake, I re-connect to the database in a widget...

Similar Threads

  1. Replies: 7
    Last Post: 14th August 2015, 21:49
  2. Display multiple tables from MYSQL database on same QtableView at same time.
    By nasit.bhavin@gmail.com in forum Qt-based Software
    Replies: 1
    Last Post: 27th June 2013, 11:05
  3. list tables column name (database)
    By baray98 in forum Qt Programming
    Replies: 1
    Last Post: 26th September 2012, 12:18
  4. Replies: 4
    Last Post: 13th July 2010, 06:17
  5. QTableWidget along with QStackedWidget
    By smiling in forum Qt Programming
    Replies: 5
    Last Post: 13th March 2010, 13:46

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.