GUI design - how to properly activate "whats this" help

  • Hello,
    I have GUI app with standard menus and context menus - activated by right-click. No toolbars.
    I want to add some help in form of tooltips or statusTips or "whats this":. I think the last one is the most suitable for this app.
    I can do it with help of enterWhatsThis() .
    Question is:
    I cannot use standard Whats This button in title bar because it is designed only for dialogs and problem to add it in QMainWindow derivates or in docks.
    But in some Windows applications I see small blue button with question mark near of minimize in main window title, probably it is not multiplatform standard.

    How you design activation of "Whats This" help in QMainWindow derived class ?

  • Lifetime Qt Champion

    Well shift+F1 hovering mouse cursor over a widget Widgets will shows its WhatisThis property.
    Also works on QMenu items so should also works on context menu although i didnt test it.

    You can use
    setWindowFlags(Qt::Window | Qt::WindowContextHelpButtonHint | Qt::WindowCloseButtonHint);
    to set it on a MainWindow type window, but it wont have min/max then.
    Its not supported on/by Windows.

    alternatively , add it to status bar.

    auto button = new QPushButton("?");
      button->setMaximumSize(32, 32);
      connect( button, &QPushButton::clicked, []() {
      } );
      ui->statusBar->addPermanentWidget( button );

    Works quite well.

    alt text


    Normally people use tooltips which is supported in most places/types of windows.
    Adding a button to the titlebar is not possible with Qt. (alone)

Log in to reply