2

Probably this issue is due to not defining parent widget properly. In QT manual or examples available online, first argument passed to QFileDialog::getOpenFileName (or similar functions) is generally "this". In my case, if I call following function with "this", it will open the dialog box and another window that doesn't contain anything and has a title which is the same as the name of executable file. I tried to get rid of the second unwanted window with no success. I replaced "this" with "gui::parentWidget()" or "0", still same issue. Also if I remember correctly I didn't have this issue before updating QT to version 5.0.2. Any help would be appreciated.

void gui::on_coordinatesBrowse_clicked()
{
     QString fileName = QFileDialog::getOpenFileName(this,"Open File");
//.....
}

and I have:

gui::gui(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::gui)
{
    ui->setupUi(this);
//.....
}

and

int main(int argc, char *argv[]) 
{
    QApplication a(argc, argv);
    gui mainW;
    mainW.show();
    return a.exec();
}
mem
  • 167
  • 9
  • I have never seen this behavior. Although because of a complex library dependency I am stuck at qt-4.8.X. – drescherjm Dec 13 '13 at 01:43
  • BTW, Is this on windows? If so is the window background black with a normal windows border? – drescherjm Dec 13 '13 at 01:44
  • The code is fine. This must be a Qt bug. Besides, `gui::parentWidget()` is obviously 0 in your case, so there is no point in calling it. – Pavel Strakhov Dec 14 '13 at 22:16
  • This is on linux. The bug is not consistent across different machines. I also think it was a Qt bug. Thanks for the responses and sorry for the delay on getting back to you. – mem May 03 '14 at 20:29

1 Answers1

0

I thought i am also experiencing this on Qt5.4.0 x64 on Linux.

I created a similar situation with QtCreator and used the "go to slot..." context menu in widget edit mode (F3) which created a slot automatically for me.

Then i renamed the buttons and renamed the functions and used the slot edit mode (F3) in the .ui file. Since only the connection via the slot edit mode shows up, i thought i was all set. But the old connection was still existing, resulting in two signals...

x29a
  • 1,761
  • 1
  • 24
  • 43