Unsolved QFileDialog Error
-
I tried the same code in the same system. It works on a new project but not on an existing one. I am unable to find a valid reason for this unusual behaviour
-
@saitej
ok. its really , really odd.Could you try with the
QFileDialog::DontUseNativeDialog
flag and see if its the ubuntu dialog that is strange? -
@mrjj
It didn't work :( -
I will try to implement the same in qml. How to open file dialog in qml through a slot/function?
-
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?
-
@mrjj
Nope. Any links would help -
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.
-
-
@mrjj
QColorDialog works fine!! -
@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 -
-
@saitej
That's really strange. Can your share a minimal runnable code example so that other users can try to reproduce the behaviour on their platforms? -
I think this guy might have faced a similar problem. The code that works for him doesnot work for me :( .
-
@saitej
But you call the function on a menu click?
not in mainwin constructor ?since it just in that project, im out of ideas. your Qt should be fine.
-
@mrjj
Ya!! -
@saitej
Hi,'Yes, the dialog shows up in full screen and also I am unable to resize it from the bottom
It sounds like the event loop is blocked. I don't see how that might be happening from your snippet, but perhaps you could post the rest of the code - the whole method and how it's called?
Kind regards.
-
did you try to use the debug mode for track errors and see variables instances ?
Is your two differents projects has same files contents (or the second project is just a test case maybe ?). If this two projects are new, then use a tool for compare files contents to show differences appears.
then... you could also try to use valgrind tool from qtcreator. -
Mainwindow.cpp
QAction *loadfile = new QAction("Load File",this); ui->menuWidgets->addAction(loadfile); connect(loadfile, SIGNAL(triggered(bool)),this,SLOT(onLoadfile()));
void MainWindow::onLoadfile(){ 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; }
-
Hi guys
I have boiled down the error to a line which when commented the filedialog works but I don't see any reason how that line is effecting the filedialog. I will need that line in my project so if someone can tell me how it is affecting the filedialog, It will be very helpful.
Thanks
ui->sideLayout->addWidget(wid1,Qt::AlignBottom);
This line adds a widget to the sidelayout which is a vertical layout added in the mainwindow.ui file through the designer.
Note: There are other layouts along with the side layout but they are not influencing
-
hi
That is like epic strange.
What type is wid1 ?