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. Removing Close button from QMessageBox
Forum Updated to NodeBB v4.3 + New Features

Removing Close button from QMessageBox

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 5 Posters 3.8k Views 3 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.
  • NIXINN Offline
    NIXINN Offline
    NIXIN
    wrote on last edited by
    #1

    on the top right corner) from QMessageBox.

    1 Reply Last reply
    0
    • Ni.SumiN Offline
      Ni.SumiN Offline
      Ni.Sumi
      wrote on last edited by
      #2

      Hi @NIXIN

      try this,

      messageBox.setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint);
      
      1 Reply Last reply
      2
      • NIXINN Offline
        NIXINN Offline
        NIXIN
        wrote on last edited by
        #3

        tried, it doesn't work

        1 Reply Last reply
        0
        • Ni.SumiN Offline
          Ni.SumiN Offline
          Ni.Sumi
          wrote on last edited by Ni.Sumi
          #4

          Try this...Found on google and worked in my case( Windows 10).

          QMessageBox* msgBox = new QMessageBox(QMessageBox::Question,
                                                 "This is the title",
                                                 "This is the text",
                                                 QMessageBox::Yes | QMessageBox::No, this,
                                                 Qt::FramelessWindowHint);
           msgBox->exec();
          
          1 Reply Last reply
          3
          • ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #5

            What @Ni-Sumi said works for me on Windows 7.

                QMessageBox mb;
                mb.setText("Some text");
                mb.setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint);
                mb.exec();
            
            1 Reply Last reply
            3
            • Pradeep KumarP Offline
              Pradeep KumarP Offline
              Pradeep Kumar
              wrote on last edited by
              #6

              Hi,

              Which OS are u using and Qt version.?.

              As mentioned by @Ni-Sumi and @Wieland

              The code provided is working in Windows 8.1 and ubuntu 14.04 version Which i am using.

              QMessageBox mb;
              mb.setText("Some text");
              mb.setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint);
              mb.exec();

              QMessageBox* msgBox = new QMessageBox(QMessageBox::Question,
              "This is the title",
              "This is the text",
              QMessageBox::Yes | QMessageBox::No, this,
              Qt::FramelessWindowHint);
              msgBox->exec();

              Thanks,

              Pradeep Kumar
              Qt,QML Developer

              1 Reply Last reply
              0
              • Pradeep KumarP Offline
                Pradeep KumarP Offline
                Pradeep Kumar
                wrote on last edited by Pradeep Kumar
                #7

                Hi,

                Can u provide the code snippet, so the users in the forum will come to know the issue.
                and provide the solution.

                Thanks,

                Pradeep Kumar
                Qt,QML Developer

                1 Reply Last reply
                0
                • V Offline
                  V Offline
                  Vicky Sharma
                  wrote on last edited by
                  #8

                  @NIXIN
                  Pradeep code is right, you should try once again and remember it must only ''setWindowFlags' otherwise overwrite it.
                  QMessageBox messageBox;
                  messageBox.setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint);
                  messageBox.exec();

                  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