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?

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

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 4 Posters 1.7k 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 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.HilkJ 1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on 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

        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.HilkJ Offline
        J.HilkJ Offline
        J.Hilk
        Moderators
        wrote on 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
        0
        • dheerendraD Offline
          dheerendraD Offline
          dheerendra
          Qt Champions 2022
          wrote on 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.HilkJ 1 Reply Last reply
          0
          • dheerendraD dheerendra

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

            J.HilkJ Offline
            J.HilkJ Offline
            J.Hilk
            Moderators
            wrote on 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.HilkJ J.Hilk

              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 last edited by
              #6

              @J.Hilk All set ... thanks

              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