QFileDialog Error
-
I am using OpenFileDialog to load a file and this is the code.
QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"),QDir::homePath() , tr("Kml Files (*.kml)")); qDebug() << "Loading File"<< fileName; QFile file( fileName ); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) return; QTextStream in(&file);
But I am getting the dialog as shown here and so am unable to select the files. Any comments on why the filedialog is being displayed in this manner?
Note: This is called when load file is triggered on mainwindow.Does it have anything to do with the mainwindow layout?
-
Hi
That seems completely messed up ?
everything else works normally?Try to make small default application
and use the file open code.Does it still does it then?
-
Just a guess: What's the parent instance (
this
) that you pass to theQFileDialog::getOpenFileName(...)
method?
Is it an insvible window? (This should not be a problem but it seems that something influences the dialog box)
And: Does the dialog show up in fullscreen? Does the dialog look normal when you try to resize it using the mouse? -
@saitej
Hm, I think the reason for the display problem is the fact that the dialog is in fullsize mode (I'm not sure if this is really supported - on the other hand there's no reason why it should lead to a mixed up layout). And I have no idea why the dialog runs in fullscreen.
Could you try once to passNULL
instead ofthis
just to see if the dialog layout changes? -
Same thing happens even with flag?
Hmm. I really have no idea what can do this.
Also since it works normally in default app and
the static call is the same.Have you tried some of the other dialogs ? like COlorDIalog?
-
Its like the getOpenFileName, just to get a color and not a filename.
http://doc.qt.io/qt-5/qcolordialog.html
I just wonder if that is funky too.
-
@saitej
Ok very strange..Im not into QML but this seems to be sample
http://doc.qt.io/qt-5/qml-qtquick-dialogs-filedialog.html#details