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 Remove "?" button from QWidget Window titlebar?
Forum Updated to NodeBB v4.3 + New Features

How to Remove "?" button from QWidget Window titlebar?

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 4 Posters 1.5k 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.
  • E Offline
    E Offline
    esther
    wrote on 26 Nov 2018, 19:35 last edited by
    #1

    Using QT 5.9 ... code below works if using QDialog but not QWidget
    I have experimented with various window type and flags combinations and can't seem to remove the infamous "What's this button"

    constructor is
    QWidget(parent, (Qt::Window | Qt::WindowTitleHint | Qt::WindowStaysOnTopHint))

    ...
    // Remove the context help button (?).
    Qt::WindowFlags flags = windowFlags();
    flags = (flags & ~Qt::WindowContextHelpButtonHint);
    b = flags.testFlag(Qt::WindowContextHelpButtonHint);
    setWindowFlags(flags);

    Any help (no pun intended) appreciated

    J 1 Reply Last reply 27 Nov 2018, 06:14
    0
    • D Offline
      D Offline
      dheerendra
      Qt Champions 2022
      wrote on 27 Nov 2018, 06:08 last edited by dheerendra
      #2

      When does this "?" button comes ? I tried on the Windows and MAC with default Qt Widget application. I did not see the "?" button. I'm curious.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      0
      • E esther
        26 Nov 2018, 19:35

        Using QT 5.9 ... code below works if using QDialog but not QWidget
        I have experimented with various window type and flags combinations and can't seem to remove the infamous "What's this button"

        constructor is
        QWidget(parent, (Qt::Window | Qt::WindowTitleHint | Qt::WindowStaysOnTopHint))

        ...
        // Remove the context help button (?).
        Qt::WindowFlags flags = windowFlags();
        flags = (flags & ~Qt::WindowContextHelpButtonHint);
        b = flags.testFlag(Qt::WindowContextHelpButtonHint);
        setWindowFlags(flags);

        Any help (no pun intended) appreciated

        J Offline
        J Offline
        J.Hilk
        Moderators
        wrote on 27 Nov 2018, 06:14 last edited by
        #3

        hi @esther
        have you also set the Qt::CustomizeWindowHint flag in your attemps ? I don't know if it will accept any flag changing without that one set first.


        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


        Q: What's that?
        A: It's blue light.
        Q: What does it do?
        A: It turns blue.

        E 1 Reply Last reply 27 Nov 2018, 14:19
        0
        • D Offline
          D Offline
          dheerendra
          Qt Champions 2022
          wrote on 27 Nov 2018, 06:31 last edited by
          #4

          @J-Hilk just curious. Where is this button ? It may be my oversight.

          Dheerendra
          @Community Service
          Certified Qt Specialist
          http://www.pthinks.com

          J 1 Reply Last reply 27 Nov 2018, 06:37
          0
          • D dheerendra
            27 Nov 2018, 06:31

            @J-Hilk just curious. Where is this button ? It may be my oversight.

            J Offline
            J Offline
            J.Hilk
            Moderators
            wrote on 27 Nov 2018, 06:37 last edited by
            #5

            @dheerendra
            afaik it's not part of the default window, but it exists.
            Example:

            0_1543300644346_a93e2e3e-5a39-4faa-824f-22469ed82be7-image.png


            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

            1 Reply Last reply
            2
            • J J.Hilk
              27 Nov 2018, 06:14

              hi @esther
              have you also set the Qt::CustomizeWindowHint flag in your attemps ? I don't know if it will accept any flag changing without that one set first.

              E Offline
              E Offline
              esther
              wrote on 27 Nov 2018, 14:19 last edited by
              #6

              @J.Hilk All set ... thanks

              1 Reply Last reply
              0

              2/6

              27 Nov 2018, 06:08

              topic:navigator.unread, 4
              • Login

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