Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [Solved] QDialog not display
Forum Updated to NodeBB v4.3 + New Features

[Solved] QDialog not display

Scheduled Pinned Locked Moved QML and Qt Quick
7 Posts 3 Posters 3.3k 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.
  • D Offline
    D Offline
    DBoosalis
    wrote on last edited by
    #1

    If I close QDialog from hitting the window managers close button on linux I am unable to display it again. This is not ture if I close it with QDialog button. This is on Linux with Qt 5.3.1. Does any one know the secret sause to make dialog reappear (Note this is a standard model dialog)

    Here is my code to show the dialog:

    @console.log("SHOW Server Confilg Dialog");
    mydialog.open();
    mydialog.visible = true;@

    I always get the console messge but not the dialog

    Thanks in aadvance for any help

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Do you have something like

      @
      void showMyCoolDialog()
      {
      MyDialog mydialog;
      console.log("SHOW Server Confilg Dialog");
      mydialog.open();
      mydialog.visible = true;
      }
      @

      ?

      If so, your dialog is destroyed at the end of the function.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • D Offline
        D Offline
        DBoosalis
        wrote on last edited by
        #3

        No, I have it as written the declaration is outside the call. But even if I did why would it not create a new instance.

        This is rather strange behavior if you ask me,

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          What is your exact code ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • D Offline
            D Offline
            DBoosalis
            wrote on last edited by
            #5

            @ApplicationWindow {
            id: mainwindow
            title: "FixHarness"
            visible: true
            width:600
            height:600
            property bool connectedToServer:false
            Dialog {
            id:mydialog
            visible:false
            title: "Blue sky dialog"
            standardButtons: StandardButton.Save | StandardButton.Cancel
            }

            function showServerConfigDialog()
            {
                console.log("SHOW Server Confilg Dialog");
                mydialog.open();
                mydialog.visible = true;
            }
            

            Action {
            id:configureServerA
            text: qsTr("Configure")
            iconSource: "qrc:/images/32x32/config.png"
            iconName: "configure"
            tooltip: "Server settings"
            onTriggered: {
            console.log("SHOW SERVER....");
            mainwindow.showServerConfigDialog();
            }
            }
            }
            @

            1 Reply Last reply
            0
            • G Offline
              G Offline
              goblin
              wrote on last edited by
              #6

              Try this. I don't really understand your problem.

              @import QtQuick 2.3
              import QtQuick.Controls 1.2
              import QtQuick.Dialogs 1.2

              ApplicationWindow {
              id:root
              visible: true
              width: 640
              height: 480
              title: qsTr("Hello World")

              menuBar: MenuBar {
                  Menu {
                      title: qsTr("File")
                      MenuItem {
                          text: qsTr("&Open")
                          onTriggered: {
                              console.log("Open action triggered");
                              showServerConfigDialog();
              
                          }
                      }
                      MenuItem {
                          text: qsTr("Exit")
                          onTriggered: Qt.quit();
                      }
                  }
              }
              
              Text {
                  id:textHW
                  text: qsTr("Click me to open server dialog")
                  anchors.centerIn: parent
                  MouseArea {
                      anchors.fill: parent
                      onClicked: showServerConfigDialog()
                  }
              }
              
              Dialog {
                  width: 350
                  height: 200
                  id:mydialog
                  visible:false
                  title: "Server dialog"
              
                  Text {
                      id: dialogText
                      text: qsTr("Server dialog")
                  }
              
              
              
                  standardButtons: StandardButton.Save |  StandardButton.Cancel
                  onAccepted: {
                      console.log("Save server dialog");
                      root.title = qsTr("Save server dialog");
                  }
                  onRejected: {
                      console.log("Cancel server dialog");
                      root.title = qsTr("Cancel server dialog");
                  }
              }
              
              
              function showServerConfigDialog() {
                  console.log("Show server dialog");
                  mydialog.open();
              }
              

              }

              @

              1 Reply Last reply
              0
              • G Offline
                G Offline
                goblin
                wrote on last edited by
                #7

                Hi

                I have some issue related to this. If I change the code from previous to the following. When I clicked on OK button I got immediately console.log ("Save server dialog"); but textHw. text changed after I moved the mouse. If I clicked on textHw the textHw.text changed immediately to "Change text".
                There is also some issue that menu bar disappearing during window resize.

                I modify
                @
                // onClicked: showServerConfigDialog()
                onClicked: textHW.text = qsTr("Change text");
                @

                and

                @ standardButtons: StandardButton.Save | StandardButton.Cancel
                onAccepted: {
                console.log("Save server dialog");
                textHW.text = qsTr("Save server dialog");
                root.title = qsTr("Save server dialog");
                }
                onRejected: {
                console.log("Cancel server dialog");
                textHW.text = qsTr("Cancel server dialog");
                root.title = qsTr("Cancel server dialog");
                }@

                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