![]() |
NDEVR
API Documentation
|
This class is responsible for notifying and providing default layout logic when the orientation of the widget changes, such as for a screen rotaton. More...
Public Member Functions | |
| bool | isHorizontalMode () |
| Returns whether the current mode is horizontal. | |
| void | remove (QObject *widget) |
| Removes a widget from orientation tracking. | |
| void | run (Button *w, Button::ButtonState horz=Button::ButtonState::e_push_button, Button::ButtonState vert=Button::ButtonState::e_large) |
| Registers a Button to change its state on orientation change. | |
| void | run (PointWidget *widget, uint04 lines_horz=2, uint04 lines_vert=3) |
| Registers a PointWidget to change its line count on orientation change. | |
| void | run (QBoxLayout *l, QBoxLayout::Direction horz=QBoxLayout::LeftToRight, QBoxLayout::Direction vert=QBoxLayout::TopToBottom) |
| Registers a QBoxLayout to switch direction on orientation change. | |
| void | run (QCustomTabWidget *w, bool inverted_stack=false) |
| Registers a QCustomTabWidget to update on orientation change. | |
| void | run (QSplitter *splitter, bool inverted_splitter=false) |
| Registers a QSplitter to change orientation on layout change. | |
| void | run (QWidget *object, const std::function< void(bool is_horizontal)> &function) |
| Registers a widget with a custom callback for orientation changes. | |
| void | run (Ribbon *widget, RibbonLayoutMode horz_mode=RibbonLayoutMode::e_horizontal, RibbonLayoutMode vert_mode=RibbonLayoutMode::e_vertical) |
| Registers a Ribbon to change its layout mode on orientation change. | |
| void | run (RibbonSubGroup *widget, RibbonLayoutMode horz_mode=RibbonLayoutMode::e_horizontal, RibbonLayoutMode vert_mode=RibbonLayoutMode::e_vertical) |
| Registers a RibbonSubGroup to change its layout mode on orientation change. | |
| void | setHorizontal (bool is_horizontal) |
| Sets the orientation mode and updates all registered widgets. | |
Static Public Member Functions | |
| static InterfaceOrientationController & | Default () |
| Returns the default global InterfaceOrientationController instance. | |
| static bool | isScreenHorizontal () |
| Returns whether the screen is currently in horizontal (landscape) orientation. | |
This class is responsible for notifying and providing default layout logic when the orientation of the widget changes, such as for a screen rotaton.
Especially useful for phones that may change orientation. For example, QBoxLayouts will be set to vertical when the screen is vertical and horizontal when the screen is horizontal. Widgets can be added inverted, meaning the opposite of the default layout behavior will occur. Widget will be laid out as soon as run is called on it, and subsequently when the interface layout changes. Provided widget is destroyed on the main thread, there is no need to automatically remove it from the controller.
Definition at line 27 of file InterfaceOrientationController.h.
|
static |
Returns the default global InterfaceOrientationController instance.
References setHorizontal().
Referenced by TransitIncidentPedestrianEditor::TransitIncidentPedestrianEditor(), and TransitIncidentVehiclesEditor::TransitIncidentVehiclesEditor().
| bool InterfaceOrientationController::isHorizontalMode | ( | ) |
Returns whether the current mode is horizontal.
|
static |
Returns whether the screen is currently in horizontal (landscape) orientation.
| void InterfaceOrientationController::remove | ( | QObject * | widget | ) |
Removes a widget from orientation tracking.
| [in] | widget | The widget to remove. |
| void InterfaceOrientationController::run | ( | Button * | w, |
| Button::ButtonState | horz = Button::ButtonState::e_push_button, | ||
| Button::ButtonState | vert = Button::ButtonState::e_large ) |
Registers a Button to change its state on orientation change.
| [in] | w | The button to manage. |
| [in] | horz | Button state when horizontal. |
| [in] | vert | Button state when vertical. |
References Button::e_large, and Button::e_push_button.
| void InterfaceOrientationController::run | ( | PointWidget * | widget, |
| uint04 | lines_horz = 2, | ||
| uint04 | lines_vert = 3 ) |
Registers a PointWidget to change its line count on orientation change.
| [in] | widget | The point widget to manage. |
| [in] | lines_horz | Number of lines when horizontal. |
| [in] | lines_vert | Number of lines when vertical. |
| void InterfaceOrientationController::run | ( | QBoxLayout * | l, |
| QBoxLayout::Direction | horz = QBoxLayout::LeftToRight, | ||
| QBoxLayout::Direction | vert = QBoxLayout::TopToBottom ) |
Registers a QBoxLayout to switch direction on orientation change.
| [in] | l | The box layout to manage. |
| [in] | horz | Direction when horizontal. |
| [in] | vert | Direction when vertical. |
| void InterfaceOrientationController::run | ( | QCustomTabWidget * | w, |
| bool | inverted_stack = false ) |
Registers a QCustomTabWidget to update on orientation change.
| [in] | w | The tab widget to manage. |
| [in] | inverted_stack | Whether to invert the default orientation behavior. |
| void InterfaceOrientationController::run | ( | QSplitter * | splitter, |
| bool | inverted_splitter = false ) |
Registers a QSplitter to change orientation on layout change.
| [in] | splitter | The splitter to manage. |
| [in] | inverted_splitter | Whether to invert the default orientation behavior. |
| void InterfaceOrientationController::run | ( | QWidget * | object, |
| const std::function< void(bool is_horizontal)> & | function ) |
Registers a widget with a custom callback for orientation changes.
| [in] | object | The widget to track (automatically removed on destruction). |
| [in] | function | Callback invoked with true for horizontal, false for vertical. |
Referenced by TransitIncidentPedestrianEditor::TransitIncidentPedestrianEditor(), and TransitIncidentVehiclesEditor::TransitIncidentVehiclesEditor().
| void InterfaceOrientationController::run | ( | Ribbon * | widget, |
| RibbonLayoutMode | horz_mode = RibbonLayoutMode::e_horizontal, | ||
| RibbonLayoutMode | vert_mode = RibbonLayoutMode::e_vertical ) |
Registers a Ribbon to change its layout mode on orientation change.
| [in] | widget | The ribbon to manage. |
| [in] | horz_mode | Layout mode when horizontal. |
| [in] | vert_mode | Layout mode when vertical. |
| void InterfaceOrientationController::run | ( | RibbonSubGroup * | widget, |
| RibbonLayoutMode | horz_mode = RibbonLayoutMode::e_horizontal, | ||
| RibbonLayoutMode | vert_mode = RibbonLayoutMode::e_vertical ) |
Registers a RibbonSubGroup to change its layout mode on orientation change.
| [in] | widget | The ribbon sub-group to manage. |
| [in] | horz_mode | Layout mode when horizontal. |
| [in] | vert_mode | Layout mode when vertical. |
| void InterfaceOrientationController::setHorizontal | ( | bool | is_horizontal | ) |
Sets the orientation mode and updates all registered widgets.
| [in] | is_horizontal | Whether to use horizontal layout. |
Referenced by Default().