New feature: property widgets show when keyboard shortcuts are active

In ParaView’s property panel, any custom widgets controlling proxy properties (such as filter or source variables) that register keyboard shortcuts now show when those shortcuts are active or inactive.

When a widget’s keyboard shortcuts are active, a thin blue frame is drawn around the widget. No frame is drawn when inactive. When you hover over the widget, the frame is highlighted to indicate that clicking on the widget’s background will make the shortcuts active. (This will disable any other widgets that have conflicting shortcuts.) An example (the interactive point-handle widget) is show below in the active, hovered, and inactive states, respectively:

modal-shortcut-active

modal-shortcut-hover

modal-shortcut-inactive

This feature solves an issue where multiple widgets used the same keyboard shortcuts (e.g., a line-edit widget and the interactive point-handle widget above). If both widgets were displayed at once, the conflicting keyboard shortcuts (P, Ctrl/Cmd+P) would not work for either widget. (If it worked for both widgets, then you wouldn’t be able to assign separate point coordinates for the line and point-handle.)

Developer note

Going forward, developers should call

  auto shortcut = pqKeySequences::instance().addModalShortcut(
    keySequence,
    /* optional QAction */ nullptr,
    /* context widget */ propWidget);

to create QShortcuts rather than creating them directly. The pqKeySequences instance will then enable/disable the shortcut to avoid conflicts. You can add the blue highlighting to your ParaView property widget like so:

  auto* decorator = propWidget->findChild<pqShortcutDecorator*>();
  if (!decorator)
  {
    decorator = new pqShortcutDecorator(propWidget);
  }
  decorator->addShortcut(shortcut);

The propWidget is the widget you would like the shortcut to apply to (i.e., the widget whose key-sequences are monitored when focused to generate the shortcut’s action). See the pqPointPickingHelper class for an example.

4 Likes