|
wiRedPanda
Logic Circuit Simulator
|
Event filter that cycles scene element selection on Tab / Shift+Tab. More...
#include <ElementTabNavigator.h>
Public Member Functions | |
| ElementTabNavigator (ElementEditor *editor, QObject *parent=nullptr) | |
| Constructs the navigator. | |
| bool | eventFilter (QObject *obj, QEvent *event) override |
Static Public Member Functions | |
| static QVector< GraphicElement * > | readingOrder (QVector< GraphicElement * > elements) |
Event filter that cycles scene element selection on Tab / Shift+Tab.
Install this on every interactive editor widget (label field, trigger field, etc.) via QWidget::installEventFilter(). When the user presses Tab or Backtab while one of those widgets has focus and exactly one element is selected, the navigator advances the selection to the next (or previous) visible element in reading order (left-to-right, top-to-bottom) that exposes the same type of field.
Scene access and element-jump callbacks are obtained through the ElementEditor pointer; the navigator is declared a friend of ElementEditor so it can call the private setCurrentElements() helper.
Definition at line 32 of file ElementTabNavigator.h.
|
explicit |
Constructs the navigator.
| editor | The owning ElementEditor (provides scene access and selection control). |
| parent | Optional QObject parent. |
Definition at line 16 of file ElementTabNavigator.cpp.
|
override |
Definition at line 37 of file ElementTabNavigator.cpp.
References readingOrder(), and Scene::visibleElements().
|
static |
Orders elements in reading order — row-major: top-to-bottom by Y (primary key), left-to-right by X within a row (secondary key). This is the order Tab/Backtab cycle through; exposed as a pure function so the ordering can be verified directly.
Definition at line 22 of file ElementTabNavigator.cpp.
Referenced by eventFilter().