pqShortcutDecorator.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-FileCopyrightText: Copyright (c) Sandia Corporation
3 // SPDX-License-Identifier: BSD-3-Clause
4 
5 #ifndef pqShortcutDecorator_h
6 #define pqShortcutDecorator_h
7 
9 
10 class pqModalShortcut;
11 
12 class QColor;
13 
21 {
22  Q_OBJECT;
23 
24 public:
25  using Superclass = pqPropertyWidgetDecorator;
28 
32  void addShortcut(pqModalShortcut* shortcut);
33 
34  bool isEnabled() const;
35 
36 public Q_SLOTS: // NOLINT(readability-redundant-access-specifiers)
50  virtual void setEnabled(bool enable, bool refocusWhenEnabling = false);
51 
52 protected Q_SLOTS:
59  virtual void onShortcutEnabled();
67  virtual void onShortcutDisabled();
68 
69 protected: // NOLINT(readability-redundant-access-specifiers)
73  pqPropertyWidget* propertyWidget() const;
77  bool eventFilter(QObject* obj, QEvent* event) override;
81  void markFrame(bool active, const QColor& frameColor);
82 
83  // All the shortcuts that decorate the property widget.
84  // These will all be enabled/disabled en banc.
85  QList<QPointer<pqModalShortcut>> m_shortcuts;
86  // Note when the user has pressed the mouse inside the widget and not released it.
87  bool m_pressed;
88  // Prevent recursive signaling inside onShortcutEnabled/onShortcutDisabled.
89  bool m_silent;
90  // Should shortcuts set the keyboard focus to their context widget?
91  // This is set to true when users explicitly click on the widget frame
92  // and false otherwise (so that programmatic changes to the widget made
93  // in response to other events do not interrupt a user; for example,
94  // using the arrow keys in the pipeline browser to change pipelines
95  // should not move the keyboard focus away from the pipeline browser).
96  // Note that this only applies when enabling shortcuts (since disabling
97  // a shortcut would never require a refocus).
99 };
100 
101 #endif // pqShortcutDecorator_h
pqPropertyWidget represents a widget created for each property of a proxy on the pqPropertiesPanel (f...
#define PQCOMPONENTS_EXPORT
Manage an action and/or widget&#39;s responsivity to a shortcut.
QList< QPointer< pqModalShortcut > > m_shortcuts
Decorate a property widget by highlighting its frame when keyboard shortcuts are active.
This is used by vtkPVXMLParser to represent an XML document starting at the root element.
pqPropertyWidgetDecorator(vtkPVXMLElement *xml, pqPropertyWidget *parent)
Constructor.
pqPropertyWidgetDecorator provides a mechanism to decorate pqPropertyWidget instances to add logic to...