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. How to open dialog box on top of the application if two screen are connected?
Forum Updated to NodeBB v4.3 + New Features

How to open dialog box on top of the application if two screen are connected?

Scheduled Pinned Locked Moved Unsolved General and Desktop
qdialogsplashscreensplash
28 Posts 4 Posters 13.2k Views 2 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.
  • M Offline
    M Offline
    mrjj
    Lifetime Qt Champion
    wrote on 6 Jun 2018, 19:58 last edited by
    #13

    Ok should be the same as, or else im very wondering

    void MainWindowUI::ShowDataRecoveryInformDialog() {
    QDialog dialog = new QDialog( m_mainWindow);
    dialog->setWindowFlags(Qt::SplashScreen);
    auto dialogLay = new QVBoxLayout(dialog);
    dialogLay->addWidget(PBT("button 1"));
    dialogLay->addWidget(PBT("button 2"));
    dialog->exec();
    }
    
    Y 1 Reply Last reply 6 Jun 2018, 20:02
    0
    • M mrjj
      6 Jun 2018, 19:58

      Ok should be the same as, or else im very wondering

      void MainWindowUI::ShowDataRecoveryInformDialog() {
      QDialog dialog = new QDialog( m_mainWindow);
      dialog->setWindowFlags(Qt::SplashScreen);
      auto dialogLay = new QVBoxLayout(dialog);
      dialogLay->addWidget(PBT("button 1"));
      dialogLay->addWidget(PBT("button 2"));
      dialog->exec();
      }
      
      Y Offline
      Y Offline
      Yash001
      wrote on 6 Jun 2018, 20:02 last edited by
      #14

      @mrjj

      I don't know. what is different but now it is work. i did not make any change except setting the property

      before:
      QDialog *dialog = new QDialog(parent, Qt::SplashScreen);

      now :

      QDialog* dialog = new QDialog();
      dialog->setWindowFlags(Qt::SplashScreen);
      dialog->setParent(m_mainWindow);

      M 1 Reply Last reply 6 Jun 2018, 20:04
      0
      • Y Yash001
        6 Jun 2018, 20:02

        @mrjj

        I don't know. what is different but now it is work. i did not make any change except setting the property

        before:
        QDialog *dialog = new QDialog(parent, Qt::SplashScreen);

        now :

        QDialog* dialog = new QDialog();
        dialog->setWindowFlags(Qt::SplashScreen);
        dialog->setParent(m_mainWindow);

        M Offline
        M Offline
        mrjj
        Lifetime Qt Champion
        wrote on 6 Jun 2018, 20:04 last edited by
        #15

        @Yash001
        ok, im not sure either. seems the same :)

        1 Reply Last reply
        0
        • Y Offline
          Y Offline
          Yash001
          wrote on 6 Jun 2018, 20:06 last edited by
          #16

          I found the different.

          it is work fine.

          dialog->setWindowFlags(Qt::SplashScreen);
          dialog->setParent(m_mainWindow);

          it is not work.

          dialog->setParent(m_mainWindow);
          dialog->setWindowFlags(Qt::SplashScreen);

          M 1 Reply Last reply 6 Jun 2018, 20:08
          1
          • Y Yash001
            6 Jun 2018, 20:06

            I found the different.

            it is work fine.

            dialog->setWindowFlags(Qt::SplashScreen);
            dialog->setParent(m_mainWindow);

            it is not work.

            dialog->setParent(m_mainWindow);
            dialog->setWindowFlags(Qt::SplashScreen);

            M Offline
            M Offline
            mrjj
            Lifetime Qt Champion
            wrote on 6 Jun 2018, 20:08 last edited by
            #17

            @Yash001
            Ok so Qt::SplashScreen does something with parent.

            Y 1 Reply Last reply 6 Jun 2018, 20:09
            0
            • M mrjj
              6 Jun 2018, 20:08

              @Yash001
              Ok so Qt::SplashScreen does something with parent.

              Y Offline
              Y Offline
              Yash001
              wrote on 6 Jun 2018, 20:09 last edited by
              #18

              @mrjj May be. It is qt default function.

              M 1 Reply Last reply 6 Jun 2018, 20:19
              0
              • Y Yash001
                6 Jun 2018, 20:09

                @mrjj May be. It is qt default function.

                M Offline
                M Offline
                mrjj
                Lifetime Qt Champion
                wrote on 6 Jun 2018, 20:19 last edited by
                #19

                @Yash001
                yeah its a windows flag.

                Y 1 Reply Last reply 6 Jun 2018, 21:27
                0
                • M mrjj
                  6 Jun 2018, 20:19

                  @Yash001
                  yeah its a windows flag.

                  Y Offline
                  Y Offline
                  Yash001
                  wrote on 6 Jun 2018, 21:27 last edited by
                  #20

                  @mrjj

                  dialog->setWindowFlags(Qt::SplashScreen);
                  dialog->setParent(m_mainWindow);
                  In this case I got dialog box on top of the screen but it is make another issue

                  dialog->exec(); is not work as per expectation. without responding the to Dialog user access the other page also.

                  In other word, user can access both screen Main application as well as Dialog box. how to block access on other widget until get response from the user in dialog box?

                  M 1 Reply Last reply 6 Jun 2018, 21:38
                  0
                  • Y Yash001
                    6 Jun 2018, 21:27

                    @mrjj

                    dialog->setWindowFlags(Qt::SplashScreen);
                    dialog->setParent(m_mainWindow);
                    In this case I got dialog box on top of the screen but it is make another issue

                    dialog->exec(); is not work as per expectation. without responding the to Dialog user access the other page also.

                    In other word, user can access both screen Main application as well as Dialog box. how to block access on other widget until get response from the user in dialog box?

                    M Offline
                    M Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on 6 Jun 2018, 21:38 last edited by
                    #21

                    Hi
                    Im not 100% sure Qt::SplashScreen is compatiple with Qt::Dialog flag

                    Qt::SplashScreen 0x0000000e | Window Indicates that the window is a splash screen. This is the default type for QSplashScreen.

                    Normally used with QSplashScreen widget.

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on 6 Jun 2018, 21:42 last edited by
                      #22

                      maybe try with
                      dialog->setWindowFlags(Qt::Dialog | Qt::SplashScreen);

                      1 Reply Last reply
                      0
                      • Y Offline
                        Y Offline
                        Yash001
                        wrote on 6 Jun 2018, 21:53 last edited by
                        #23

                        @mrjj it is create previous issue.

                        M J 2 Replies Last reply 6 Jun 2018, 21:55
                        0
                        • Y Yash001
                          6 Jun 2018, 21:53

                          @mrjj it is create previous issue.

                          M Offline
                          M Offline
                          mrjj
                          Lifetime Qt Champion
                          wrote on 6 Jun 2018, 21:55 last edited by
                          #24

                          @Yash001
                          but why you need Qt::SplashScreen ?
                          and modal dialog ?
                          cant you just use the dialog ?

                          1 Reply Last reply
                          1
                          • Y Yash001
                            6 Jun 2018, 21:53

                            @mrjj it is create previous issue.

                            J Offline
                            J Offline
                            JonB
                            wrote on 6 Jun 2018, 21:59 last edited by
                            #25

                            @Yash001
                            Similarly to @mrjj , have you considered using QSplashScreen (http://doc.qt.io/qt-5/qsplashscreen.html), maybe it doesn't have these problems?

                            1 Reply Last reply
                            1
                            • Y Offline
                              Y Offline
                              Yash001
                              wrote on 6 Jun 2018, 22:07 last edited by
                              #26

                              I am using Qt::SplashScreen because of I wanted show dialog on the top of all screen. This dialog is show whenever specific signal is generated from Hardware Connection. if hardware is connected with PC before opening our Software then dialog will open after Software Open. and control need to transfer on dialog box. (at this time user should not access any other page).

                              I have not idea what is model Dialog.

                              M 1 Reply Last reply 6 Jun 2018, 22:09
                              0
                              • Y Yash001
                                6 Jun 2018, 22:07

                                I am using Qt::SplashScreen because of I wanted show dialog on the top of all screen. This dialog is show whenever specific signal is generated from Hardware Connection. if hardware is connected with PC before opening our Software then dialog will open after Software Open. and control need to transfer on dialog box. (at this time user should not access any other page).

                                I have not idea what is model Dialog.

                                M Offline
                                M Offline
                                mrjj
                                Lifetime Qt Champion
                                wrote on 6 Jun 2018, 22:09 last edited by
                                #27

                                @Yash001
                                Modal dialog means user cannot click on mainwindow behind dialog.
                                Sometimes also called blocking.
                                comes when using exec() versus show().

                                Y 1 Reply Last reply 6 Jun 2018, 22:19
                                1
                                • M mrjj
                                  6 Jun 2018, 22:09

                                  @Yash001
                                  Modal dialog means user cannot click on mainwindow behind dialog.
                                  Sometimes also called blocking.
                                  comes when using exec() versus show().

                                  Y Offline
                                  Y Offline
                                  Yash001
                                  wrote on 6 Jun 2018, 22:19 last edited by
                                  #28

                                  @mrjj understood. thank you.

                                  1 Reply Last reply
                                  0

                                  22/28

                                  6 Jun 2018, 21:42

                                  • Login

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