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. WindowSystemMenuHint strange bug
Forum Updated to NodeBB v4.3 + New Features

WindowSystemMenuHint strange bug

Scheduled Pinned Locked Moved Solved General and Desktop
14 Posts 3 Posters 1.8k 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.
  • aha_1980A aha_1980

    @Engelard isn't that ...HelpButtonHint?

    which type of widget is your dialog? it may be the platform defaiult to show it.

    EngelardE Offline
    EngelardE Offline
    Engelard
    wrote on last edited by
    #5

    @aha_1980 said in WindowSystemMenuHint strange bug:

    which type of widget is your dialog?

    QDialog

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #6

      Hi
      The reason for the odd look is due to you remove all its flags
      setWindowFlags(Qt::WindowSystemMenuHint);
      Now ONLY WindowSystemMenuHint is set. not Dialog and all the others it needs.
      You need to do
      setWindowFlags(windowFlags() & ~Qt::WindowSystemMenuHint);
      which takes the current flags and bitwise disable only hint.

      EngelardE 1 Reply Last reply
      2
      • mrjjM mrjj

        Hi
        The reason for the odd look is due to you remove all its flags
        setWindowFlags(Qt::WindowSystemMenuHint);
        Now ONLY WindowSystemMenuHint is set. not Dialog and all the others it needs.
        You need to do
        setWindowFlags(windowFlags() & ~Qt::WindowSystemMenuHint);
        which takes the current flags and bitwise disable only hint.

        EngelardE Offline
        EngelardE Offline
        Engelard
        wrote on last edited by Engelard
        #7

        @mrjj

        Very good stuff. But.

        1. as i understand, it set it from windowFlags() which comes from parent, it do totally no effect if i would try set it up from it's own flags:
        myNewDialog->windowFlags()
        
        1. As it appliable only from parent(QMainWindow), it adds maximize and minimize hints, maximize is unnecessary, so i tried to remove it, but it only disable it, not hide:
        myNewDialog->setWindowFlags(windowFlags() & (~Qt::WindowSystemMenuHint & ~Qt::WindowMaximizeButtonHint));
        
        mrjjM 1 Reply Last reply
        0
        • EngelardE Engelard

          @mrjj

          Very good stuff. But.

          1. as i understand, it set it from windowFlags() which comes from parent, it do totally no effect if i would try set it up from it's own flags:
          myNewDialog->windowFlags()
          
          1. As it appliable only from parent(QMainWindow), it adds maximize and minimize hints, maximize is unnecessary, so i tried to remove it, but it only disable it, not hide:
          myNewDialog->setWindowFlags(windowFlags() & (~Qt::WindowSystemMenuHint & ~Qt::WindowMaximizeButtonHint));
          
          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #8

          @Engelard
          Oh, must be from dialog :)

          myNewDialog->setWindowFlags(myNewDialog->windowFlags() & (~Qt::WindowSystemMenuHint & ~Qt::WindowMaximizeButtonHint));

          EngelardE 1 Reply Last reply
          0
          • mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #9

            Not all combinations works all types of windows.

            1 Reply Last reply
            0
            • mrjjM mrjj

              @Engelard
              Oh, must be from dialog :)

              myNewDialog->setWindowFlags(myNewDialog->windowFlags() & (~Qt::WindowSystemMenuHint & ~Qt::WindowMaximizeButtonHint));

              EngelardE Offline
              EngelardE Offline
              Engelard
              wrote on last edited by
              #10

              @mrjj i tried at first from my object(child dialog), not working, tried, can't understand why.

              1 Reply Last reply
              0
              • mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #11

                Hi
                I tried

                CustomDialog::CustomDialog(QWidget *parent) :
                    QDialog(parent),
                    ui(new Ui::CustomDialog)
                {
                    ui->setupUi(this);
                    setWindowFlags(Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint);
                }
                
                
                

                alt text

                EngelardE 1 Reply Last reply
                0
                • EngelardE Offline
                  EngelardE Offline
                  Engelard
                  wrote on last edited by
                  #12

                  Lol i figure it out, with little help of Qt documentation and imagination:

                  resultsWindow = new FinalResult(this);
                  Qt::WindowFlags flags = 0;
                  flags = Qt::Dialog;
                  
                  resultsWindow->setWindowFlags(flags |= Qt::WindowSystemMenuHint); // question mark removed, but close button now disabled
                  resultsWindow->setWindowFlag(Qt::WindowCloseButtonHint, true);
                  
                  1 Reply Last reply
                  1
                  • mrjjM mrjj

                    Hi
                    I tried

                    CustomDialog::CustomDialog(QWidget *parent) :
                        QDialog(parent),
                        ui(new Ui::CustomDialog)
                    {
                        ui->setupUi(this);
                        setWindowFlags(Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint);
                    }
                    
                    
                    

                    alt text

                    EngelardE Offline
                    EngelardE Offline
                    Engelard
                    wrote on last edited by
                    #13

                    @mrjj said in WindowSystemMenuHint strange bug:

                    Hi
                    I tried

                    I try that stuff long ago, no efforts of doing that attempts from the constructor of child QDialog were paid...

                    mrjjM 1 Reply Last reply
                    0
                    • EngelardE Engelard

                      @mrjj said in WindowSystemMenuHint strange bug:

                      Hi
                      I tried

                      I try that stuff long ago, no efforts of doing that attempts from the constructor of child QDialog were paid...

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #14

                      @Engelard
                      ok, odd. worked for my 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