PDA

View Full Version : can't show my QDialog



sincnarf
22nd October 2007, 01:02
Hello!

I created a custom dialog and here's how I use it.

IADFUQParameterDialog dialog = new IADFUQParameterDialog(this);
but on compile has the error
mainwindow.cpp:2222: error: initializing temporary from result of 'IADFUQParameterDialog::IADFUQParameterDialog(QWid get*)'

so I try to use this instead
IADFUQParameterDialog dialog(this); dialog.show();
and there's no error. But the dialog shows only when I call a message box

sincnarf
22nd October 2007, 01:21
sorry, tried to use dialog.exec() and it showed... Now How do get the values from my Dialog to be used by the widget that called dialog.exec()?

wysota
22nd October 2007, 07:16
You need to provide getter methods in the dialog class to do that. Or you can make the ui for the dialog public, but this is really not advised.

high_flyer
22nd October 2007, 10:33
but on compile has the error
mainwindow.cpp:2222: error: initializing temporary from result of 'IADFUQParameterDialog::IADFUQParameterDialog(QWid get*)'
When allocating on the heap (using new) you have to use pointer:

IADFUQParameterDialog *dialog = new IADFUQParameterDialog(this);
And if you need to access this pointer in other places as well, you will want to make it a member variable.

sorry, tried to use dialog.exec() and it showed...
Well, the difference between show() and exec() is the modality mode.
But both should work.
Have a look at the faqs (http://www.qtcentre.org/forum/faq.php?faq=qt_general_category#faq_qt_stack_creat ed_widgets)for "I have created a widget/dialog and it is not visible when I call show(). Why?"