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. Touch coordinates offset in QMessageBox when Qt::FramelessWindowHint is set
Qt 6.11 is out! See what's new in the release blog

Touch coordinates offset in QMessageBox when Qt::FramelessWindowHint is set

Scheduled Pinned Locked Moved Solved General and Desktop
12 Posts 4 Posters 934 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.
  • Ramkumar MohanR Offline
    Ramkumar MohanR Offline
    Ramkumar Mohan
    wrote on last edited by Ramkumar Mohan
    #1

    I found that my QMessageBox was not responding to touch events whenever the Qt::FramelessWindowHint window flag is set. When cleared, the dialog responds normally.

    This is my code,

    QMessageBox msg(this);
    msg.setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint);
    msg.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
    msg.setButtonText(QMessageBox::Ok , "Run");
    msg.setButtonText(QMessageBox::Cancel , "Back");
    if(msg.exec() == QMessageBox::Ok)
    {
    qDebug()<<"OK";
    }

    how to fix the bug ?
    Thank you.

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

      Hi,

      There are missing information:

      • Qt version ?
      • OS ?
      • if Linux, which distribution ?
      • touch screen ?
      • Device ?
      • self-built Qt ?
        etc.

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

      Ramkumar MohanR 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        There are missing information:

        • Qt version ?
        • OS ?
        • if Linux, which distribution ?
        • touch screen ?
        • Device ?
        • self-built Qt ?
          etc.
        Ramkumar MohanR Offline
        Ramkumar MohanR Offline
        Ramkumar Mohan
        wrote on last edited by Ramkumar Mohan
        #3

        @SGaist

        QT Version :

        Qt Creator 4.8.2
        Based on Qt 5.11.3 (GCC 8.3.0, 32 bit)

        OS :

        Raspberry pi os (Legacy) ---- Linux
        Yes, touch screen

        One more doubt

        for Alternative code,

        How to disable minimize, maximize and close options in message box without using framelesswindow hint?

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

          That's the Qt Creator version. It has nothing to do with the version of Qt you are using to build your application.

          Check the Qt::WindowCloseButtonHint and friend flags that you can set on your widget.

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

          Ramkumar MohanR 1 Reply Last reply
          0
          • SGaistS SGaist

            That's the Qt Creator version. It has nothing to do with the version of Qt you are using to build your application.

            Check the Qt::WindowCloseButtonHint and friend flags that you can set on your widget.

            Ramkumar MohanR Offline
            Ramkumar MohanR Offline
            Ramkumar Mohan
            wrote on last edited by
            #5

            @SGaist

            Hi,

            message.PNG

            How to disable the Minimize option in the message box shown in the photo.

            jsulmJ 1 Reply Last reply
            0
            • Ramkumar MohanR Ramkumar Mohan

              @SGaist

              Hi,

              message.PNG

              How to disable the Minimize option in the message box shown in the photo.

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Ramkumar-Mohan By unsetting Qt::WindowMinimizeButtonHint flag on your dialog (https://doc.qt.io/qt-6/qmessagebox.html#QMessageBox-1)

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              Ramkumar MohanR JonBJ 2 Replies Last reply
              0
              • jsulmJ jsulm

                @Ramkumar-Mohan By unsetting Qt::WindowMinimizeButtonHint flag on your dialog (https://doc.qt.io/qt-6/qmessagebox.html#QMessageBox-1)

                Ramkumar MohanR Offline
                Ramkumar MohanR Offline
                Ramkumar Mohan
                wrote on last edited by
                #7

                @jsulm

                msg.setWindowFlags(Qt::Dialog | Qt::WindowMinimizeButtonHint);

                I'm Setting this code , but not worked for me . i don't know
                how to set the code .
                Thank you.

                jsulmJ 1 Reply Last reply
                0
                • Ramkumar MohanR Ramkumar Mohan

                  @jsulm

                  msg.setWindowFlags(Qt::Dialog | Qt::WindowMinimizeButtonHint);

                  I'm Setting this code , but not worked for me . i don't know
                  how to set the code .
                  Thank you.

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @Ramkumar-Mohan Please show the whole code where you're showing the message box. Also, on which OS are you?

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  Ramkumar MohanR 1 Reply Last reply
                  0
                  • jsulmJ jsulm

                    @Ramkumar-Mohan By unsetting Qt::WindowMinimizeButtonHint flag on your dialog (https://doc.qt.io/qt-6/qmessagebox.html#QMessageBox-1)

                    JonBJ Offline
                    JonBJ Offline
                    JonB
                    wrote on last edited by JonB
                    #9

                    @jsulm said in Touch coordinates offset in QMessageBox when Qt::FramelessWindowHint is set:

                    @Ramkumar-Mohan By unsetting Qt::WindowMinimizeButtonHint flag

                    @Ramkumar-Mohan said in Touch coordinates offset in QMessageBox when Qt::FramelessWindowHint is set:

                    msg.setWindowFlags(Qt::Dialog | Qt::WindowMinimizeButtonHint);

                    As @jsulm said, if you want not to have a "minimize button" you need to unset/clear the Qt::WindowMinimizeButtonHint flag, not set it.

                    1 Reply Last reply
                    0
                    • jsulmJ jsulm

                      @Ramkumar-Mohan Please show the whole code where you're showing the message box. Also, on which OS are you?

                      Ramkumar MohanR Offline
                      Ramkumar MohanR Offline
                      Ramkumar Mohan
                      wrote on last edited by
                      #10

                      @jsulm

                      This my code ,

                      QMessageBox msg(this);
                      msg.setWindowFlags(msgBox.windowFlags()&(~ Qt::WindowMinimizeButtonHint));
                      msg.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
                      msg.setButtonText(QMessageBox::Ok , "Run");
                      msg.setButtonText(QMessageBox::Cancel , "Back");
                      if(msg.exec() == QMessageBox::Ok)
                      {
                      qDebug()<<"OK";
                      }

                      I wrote the code for remove Minimize Button , but the code is not working properly,
                      I run the code but it showing the minimize button , and i click the minimize button .( Closed the whole Running page) where the error , i don't think to how to solve it ,
                      Please give any resolving suggestion to me ,

                      Thank you.

                      JonBJ 1 Reply Last reply
                      0
                      • Ramkumar MohanR Ramkumar Mohan

                        @jsulm

                        This my code ,

                        QMessageBox msg(this);
                        msg.setWindowFlags(msgBox.windowFlags()&(~ Qt::WindowMinimizeButtonHint));
                        msg.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
                        msg.setButtonText(QMessageBox::Ok , "Run");
                        msg.setButtonText(QMessageBox::Cancel , "Back");
                        if(msg.exec() == QMessageBox::Ok)
                        {
                        qDebug()<<"OK";
                        }

                        I wrote the code for remove Minimize Button , but the code is not working properly,
                        I run the code but it showing the minimize button , and i click the minimize button .( Closed the whole Running page) where the error , i don't think to how to solve it ,
                        Please give any resolving suggestion to me ,

                        Thank you.

                        JonBJ Offline
                        JonBJ Offline
                        JonB
                        wrote on last edited by
                        #11

                        @Ramkumar-Mohan said in Touch coordinates offset in QMessageBox when Qt::FramelessWindowHint is set:

                        msg.setWindowFlags(msgBox.windowFlags()&(~ Qt::WindowMinimizeButtonHint));

                        That is better! And the best that you can do. WindowMinimizeButtonHint is a hint, I believe that not all windowing systems respect it. If you download the Window Flags Example and play with it you can find out which flags work how on your platform.

                        Ramkumar MohanR 1 Reply Last reply
                        2
                        • JonBJ JonB

                          @Ramkumar-Mohan said in Touch coordinates offset in QMessageBox when Qt::FramelessWindowHint is set:

                          msg.setWindowFlags(msgBox.windowFlags()&(~ Qt::WindowMinimizeButtonHint));

                          That is better! And the best that you can do. WindowMinimizeButtonHint is a hint, I believe that not all windowing systems respect it. If you download the Window Flags Example and play with it you can find out which flags work how on your platform.

                          Ramkumar MohanR Offline
                          Ramkumar MohanR Offline
                          Ramkumar Mohan
                          wrote on last edited by
                          #12

                          @JonB

                          That problem has been solved. Now that's working fine. Thank you.

                          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