PDA

View Full Version : Canceling the getOpenFileName native dialog



mclark
30th July 2009, 19:54
I have an app that was using 4.4.2 that I just moved to 4.5.2. I now have a problem using the QFileDialog::getOpenFileName() static method when canceling the dialog.

On my QMainWindow, my app has a QTabWidget. A tab contains 2 QGroupBox objects. Each QGroupBox contains a QTableWidget object.

Using the Windows native dialog version:

sFilePath = QFileDialog::getOpenFileName( m_parent,
“Open File”,
m_parent->m_sCurrDir,
“Filter (*.*)” );
When the dialog is closed using the close button the contents of each QTableWidget goes away. Clicking on an area which previously contained a table row entry or header will cause a portion of the table contents to be redrawn. Minimizing and then bring the app back up will redraw everything as it should be.

Using the Qt dialog version:

sFilePath = QFileDialog::getOpenFileName( m_parent,
“Open File”,
m_parent->m_sCurrDir,
“Filter (*.*)”,
0, QFileDialog::DontUseNativeDialog );
This causes a similar result except the tables are redraw automatically. By that, I mean that I can see the contents go away as the dialog is going away but the table contents are immediately redrawn (unlike the Windows native dialog which never automatically redraws). I would just use the Qt native version except it takes longer than a second to fill the dialog with files from a 75 entry directory. This seems way too long.

Has anyone else seen this (I haven’t been able to find mention of this on the Troll's Task Tracker)?

If so, has anyone found a way to fix this (I've tried update() and repaint() and neither change the result)?

mclark
14th August 2009, 22:59
From the Trolls TaskTracker (entered on 26.Jun.09):

257004 - [REG] Painting issues when a modal dialog, which has a dialog as its parent which is parented to another window, is shown

Description: When a modal dialog is shown which has a dialog as its parent which is parented to another window then it has painting issues. This happens when a QTabWidget in the main window (which the first dialog is parented to) has a QTableWidget in it. If the tabs have been changed and then the dialog shown, the table widget is not painted until the dialogs are closed.

This is a regression from Qt 4.4.3.