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

Hiding context button in Qt 5.15

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 225 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.
  • D Offline
    D Offline
    Dummie1138
    wrote on 22 Feb 2023, 13:28 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.

    J 1 Reply Last reply 22 Feb 2023, 13:44
    0
    • D Dummie1138
      22 Feb 2023, 13:28

      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.

      J Offline
      J Offline
      JonB
      wrote on 22 Feb 2023, 13:44 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

      1/2

      22 Feb 2023, 13:28

      • Login

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