[Solved]Make a widget "untouchable"
-
When a QMessageBox::warning() is called, the underlying widget becomes "untouchable", per se. I can't call it disabled, and I don't know what it officially is called. In the old days of Visual Basic 6.0, I used to call the command enabled = 0, to have that effect done on a widget. This didn't work in Qt.
I have an options dialog, which if shown, I'd like to have the mainwindow untouchable till the dialog is hidden again, just like when a QMessageBox::warning() is displayed. How can I do that???
Thanks for any efforts :)
-
Well I think that you are talking about Modal Dialogs. You can set the property of the dialog before displaying For eg:
@void MainWindow::on_btnOpen_clicked()
{
Dialog *d = new Dialog(this);
d->setModal(true);
d->show();
}@You can read: "Modal Dialog ":http://qt-project.org/doc/qt-4.8/QDialog.html#modal-dialogs
-
Hi,
There is a modal and windowModality property.
check also the enum Qt:WindowModality for detailed description of modal-modes :) -
To achieve this, on usually calls "exec() ":/doc/qt-4.8/qdialog.html#exec on a [[doc:QDialog]] subclass. exec() blocks, so the calling method isn't ended until the dialog is closed.
-
Thanks a lot!!!! the QDialog::setModal() did the trick. :)
-
How can I mark this article as solved?
-
Just Edit your First post on the topic and add [Solved]
-
Oh, OK! I thought there's some button for that... weird. But OK. Done! :)
Thanks. -
[quote author="TheDestroyer" date="1335095483"]Oh, OK! I thought there's some button for that... weird. But OK. Done! :)
Thanks.[/quote]It's in the works. You can have a look into the new feature in the "QnA Testing Area":/forums/viewforum/46/.