PDA

View Full Version : [Qt 4.1] Strange behaviour with QTableView



fane
19th January 2006, 01:13
I have encountered a strange behaviour when using a QTableView (not happening for QLIstView). I have attached sample code along with a .sql file with data structure and sample data (change the MySQL root password in main.cpp). To reproduce the "error":
1. Run the program and click on a city in the left listview. This should filter the customers in the right tableview by that city.
2. Select one of the customers in the right tableview
3. Click on one of the last three cities in the left listview ("Iasi", "Vaslui" or "Belcesti" - these cities do not have any customer belonging to them - if you follow my example).

At this point the interface becomes nonresponsive (at least this happens to me). Clicking on a city that has corresponding customers do not expose this behaviour. If you skip step 2 from above, clicking on any of the cities in left listview does what is expecting to do - filter the customers.

Now uncomment line #34 from mainwindow.cpp (the one with the QMessageBox), build and run again. This time the behaviour(GUI freezing) do not appear even if you don't skip step 2.

I tried to connect to different signals in order to avoid the behaviour. I also tried changing the QTableModel which fills the tableview to QSqlQueryModel or QSqlRelationalTableModel but with the same result - GUI freezing.

This behaviour do not exhibit if I use a QListView to the right side of the form (to display customers) but this is not what I need in my application.

The backtrace before the interface freezes is like this (don't know what all that mean but maybe it is usefull):
#0 0x100e87e0 QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (kernel/qobject.cpp:2710)
#1 0x009e4e6c ?? (??:??)
#2 0x009dbc6f ?? (??:??)
#3 0x009efbe9 ?? (??:??)
#4 0x0069ec2d ?? (??:??)
#5 0x008e5b10 ?? (??:??)
#6 0x009755e0 ?? (??:??)
#7 0x009da913 ?? (??:??)
#8 0x00aa0f4c ?? (??:??)
#9 0x00973dd7 ?? (??:??)
#10 0x006558e5 ?? (??:??)
#11 0x00654468 ?? (??:??)
#12 0x00a83b8d ?? (??:??)
#13 0x006ae8ab ?? (??:??)
#14 0x006aa0c7 ?? (??:??)
#15 0x77d48709 _libkernel32_a_iname (??:??)
#16 0x77d487eb _libkernel32_a_iname (??:??)
#17 0x77d489a5 _libkernel32_a_iname (??:??)
#18 0x77d489e8 _libkernel32_a_iname (??:??)
#19 0x100f994e QPainterPrivate::updateEmulationSpecifier(QPainter State*) (kernel/qeventdispatcher_win.cpp:443)
#20 0x006a8a0c ?? (??:??)
#21 0x100ceee8 QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (kernel/qeventloop.cpp:118)
#22 0x100cefc7 QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (kernel/qeventloop.cpp:158)
#23 0x100d2b90 QCoreApplication::exec() (kernel/qcoreapplication.cpp:661)
#24 0x00653a70 ?? (??:??)
#25 0x004018e3 qMain(int, char**) (main.cpp:22)
#26 0x00402f0f WinMain (qtmain_win.cpp:105)
#27 0x00402a9a main (??:??)

Thank you in advance for any advice.

fane
23rd January 2006, 07:17
Does anybody have an idea?