Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved]Make a widget "untouchable"

[Solved]Make a widget "untouchable"

Scheduled Pinned Locked Moved General and Desktop
9 Posts 4 Posters 3.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    TheDestroyer
    wrote on last edited by
    #1

    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 :)

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Sam
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • G Offline
        G Offline
        gmaro
        wrote on last edited by
        #3

        Hi,

        There is a modal and windowModality property.
        check also the enum Qt:WindowModality for detailed description of modal-modes :)

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on last edited by
          #4

          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.

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          0
          • T Offline
            T Offline
            TheDestroyer
            wrote on last edited by
            #5

            Thanks a lot!!!! the QDialog::setModal() did the trick. :)

            1 Reply Last reply
            0
            • T Offline
              T Offline
              TheDestroyer
              wrote on last edited by
              #6

              How can I mark this article as solved?

              1 Reply Last reply
              0
              • S Offline
                S Offline
                Sam
                wrote on last edited by
                #7

                Just Edit your First post on the topic and add [Solved]

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  TheDestroyer
                  wrote on last edited by
                  #8

                  Oh, OK! I thought there's some button for that... weird. But OK. Done! :)
                  Thanks.

                  1 Reply Last reply
                  0
                  • G Offline
                    G Offline
                    goetz
                    wrote on last edited by
                    #9

                    [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/.

                    http://www.catb.org/~esr/faqs/smart-questions.html

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved