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. Remove minimize button from QDialog
Forum Updated to NodeBB v4.3 + New Features

Remove minimize button from QDialog

Scheduled Pinned Locked Moved General and Desktop
8 Posts 2 Posters 23.9k 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.
  • L Offline
    L Offline
    luca
    wrote on 18 Nov 2010, 14:42 last edited by
    #1

    Hi all,
    I'm working in a Linux application.

    I need to remove minimize button from a QDialog. I tried some solution without success.

    The only one solution that works is:
    @
    QDialog *parametri_dialog = new QDialog(widget_tab);
    parametri_dialog->setWindowFlags(parametri_dialog->windowFlags() | Qt::FramelessWindowHint);
    parametri_dialog->show();
    @

    but this way all button disappear and I also can't resize dialog.

    If I put the line:
    @
    parametri_dialog->setWindowFlags(parametri_dialog->windowFlags() & ~(Qt::WindowMinimizeButtonHint));
    @

    nothing happend.

    Can you help me?

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on 18 Nov 2010, 15:13 last edited by
      #2

      bq. From "Qt::WindowFlags docs":http://doc.qt.nokia.com/4.7/qt.html#WindowType-enum
      The CustomizeWindowHint flag is used to enable customization of the window controls. This flag must be set to allow the WindowTitleHint, WindowSystemMenuHint, WindowMinimizeButtonHint, WindowMaximizeButtonHint and WindowCloseButtonHint flags to be changed.

      So you should also set the Qt::CustomizeWindowHint flag.

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

      1 Reply Last reply
      0
      • L Offline
        L Offline
        luca
        wrote on 18 Nov 2010, 16:20 last edited by
        #3

        I tried this:
        @
        parametri_dialog->setWindowFlags(parametri_dialog->windowFlags() & ~(Qt::WindowMinimizeButtonHint) & Qt::CustomizeWindowHint);
        @

        but now dialog doesn't show nothing...

        1 Reply Last reply
        0
        • L Offline
          L Offline
          luca
          wrote on 18 Nov 2010, 18:12 last edited by
          #4

          Now I tried windowflags Qt example (from qt source) and there is no possibility to remove only minimize button an keep the possibility to move the dialog and resize it.

          Can someone confirm me this?

          1 Reply Last reply
          0
          • G Offline
            G Offline
            goetz
            wrote on 18 Nov 2010, 22:20 last edited by
            #5

            This works for me:

            @
            #include <QApplication>
            #include <QDialog>

            int main(int argc, char *argv[])
            {
            QApplication a(argc, argv);
            a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));

            QDialog d;
            d.setWindowFlags( Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint );
            d.setWindowTitle("abcd");
            d.show();
            
            return a.exec&#40;&#41;;
            

            }
            @

            You might set some other window flags too.

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

            1 Reply Last reply
            0
            • L Offline
              L Offline
              luca
              wrote on 19 Nov 2010, 07:21 last edited by
              #6

              ... unfortunately doesn't works form me.

              Are you using Linux or Windows?

              1 Reply Last reply
              0
              • G Offline
                G Offline
                goetz
                wrote on 19 Nov 2010, 11:52 last edited by
                #7

                I'm on a Mac.

                On Linux, you might want to add Qt::WindowTitleHint to the flags.

                Window decoration is platform dependend, so it could be that your approach is not achievable at all.

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

                1 Reply Last reply
                0
                • L Offline
                  L Offline
                  luca
                  wrote on 19 Nov 2010, 14:54 last edited by
                  #8

                  Thanks, now I think it's not possible in linux.

                  1 Reply Last reply
                  0

                  4/8

                  18 Nov 2010, 18:12

                  • Login

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