How to properly handle user input with multiple fields
-
I tried putting that immediately after the definition of the buttonbox (see below), and it doesn't kick up an error (which is always pleasant). When I ran the program, though, the Ok button was still clickable. Does this need to be communicated to the form in another way?
What do I need to put around the code to make it...errr...readable? :)
Thanks!
@
void setupUi(QDialog *Dialog)
{
if (Dialog->objectName().isEmpty())
Dialog->setObjectName(QString::fromUtf8("Dialog"));
Dialog->setEnabled(true);
Dialog->resize(400, 300);
buttonBox = new QDialogButtonBox(Dialog);
buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
buttonBox->setGeometry(QRect(50, 250, 341, 32));
buttonBox->setOrientation(Qt::Horizontal);
buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok );//Test code buttonBox->button( QDialogButtonBox::Ok )->setEnabled( false );
@
-
I don't quite get what you're saying. I'm currently using this to invoke the dialog (slot triggered by a signal from a clicked main menu item):
@
void VCMainWindow::InvokeMPDDialogWindow(){ /BEGIN FUNCTION INVOKEMPDDIALOGWINDOW/
VCMPDataInputForm NewForm;
NewForm.setWindowTitle( "New Dataset");
NewForm.exec();
} /CLOSE FUNCTION INVOKEMPDDIALOGWINDOW/
@If I try to do it in the form constructor, it tells me invalid use of incomplete type struct pushbutton as well as forward declaration of struct pushbutton.
@
ui->buttonBox->button( QDialogButtonBox::Ok )->setEnabled( false );
@ -
@mchris357
Hi. I have a problem the same as you. How do you solve your problem? I also have a dialog in my application and I used input panel. when the qdialog show and I want to type in my textbox the input panel appears but the buttons not work. When I googling all pages says because the dialog is modal and should always in top widget so the input panel not work. How do you solve it and can use input panel in your dialog? -
If it is the same problem, thy have given already the solution . It got solved for them just by including #include <QPushButton>. Try it in your case, Also it might problem og show() / exec(). Please Ckeck this
If it did not solve your problem, please start a new thread, saying your problem.
-
@Ni-Sumi
really thanks. It solved:- Modal dialogs are started with exec(), they block the program flow while a nested event loop runs.
- Modeless dialogs are started with show(), they do not block the program flow.
From http://www.qtforum.org/article/14285/modeless-dialog.html
I use this code :MyDialog *d=new MyDialog(this); d->show(); d->raise();
instead of this code:
MyDialog *d=new MyDialog(this); d.exec();