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. Hiding context button in Qt 5.15
Qt 6.11 is out! See what's new in the release blog

Hiding context button in Qt 5.15

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 526 Views
  • 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.
  • Dummie1138D Offline
    Dummie1138D Offline
    Dummie1138
    wrote on last edited by
    #1

    Hi. I'm building a QInputDialog in Qt 5.15, and have the following code.

        QInputDialog passwordBox(this, Qt::Dialog);
        bool ok;
        passwordBox.exec();
    

    I would like to remove the context help button, aka the "?" button and am unsure how to do so. The Qt 5.15 documentation for QInputDialog doesn't have any suggestions, and I attempted the following based on the application attribute documentation.

        QInputDialog passwordBox(this, Qt::Dialog);
        bool ok;
        passwordBox.setAttribute(Qt::AA_DisableWindowContextHelpButton);
        passwordBox.exec();
    

    I got the following error.
    error: cannot initialize a parameter of type 'Qt::WidgetAttribute' with an rvalue of type 'Qt::ApplicationAttribute'

    I am unsure how to proceed on hiding the context button. Please let me know if more info is required.

    JonBJ 1 Reply Last reply
    0
    • Dummie1138D Dummie1138

      Hi. I'm building a QInputDialog in Qt 5.15, and have the following code.

          QInputDialog passwordBox(this, Qt::Dialog);
          bool ok;
          passwordBox.exec();
      

      I would like to remove the context help button, aka the "?" button and am unsure how to do so. The Qt 5.15 documentation for QInputDialog doesn't have any suggestions, and I attempted the following based on the application attribute documentation.

          QInputDialog passwordBox(this, Qt::Dialog);
          bool ok;
          passwordBox.setAttribute(Qt::AA_DisableWindowContextHelpButton);
          passwordBox.exec();
      

      I got the following error.
      error: cannot initialize a parameter of type 'Qt::WidgetAttribute' with an rvalue of type 'Qt::ApplicationAttribute'

      I am unsure how to proceed on hiding the context button. Please let me know if more info is required.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @Dummie1138 said in Hiding context button in Qt 5.15:
      Qt::AA_DisableWindowContextHelpButton is to disable it application-wide, to be used on the QApplication object. If you want it only on this dialog try removing Qt::WindowContextHelpButtonHint instead? Something like:

      passwordBox.setAttribute(Qt::WindowContextHelpButtonHint, false);
      
      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