Serial Studio 1.1.6
A dashboard software for your embedded projects
|
The DashboardWidget class. More...
#include <DashboardWidget.h>
Public Slots | |
void | setVisible (const bool visible) |
void | setWidgetIndex (const int index) |
void | setIsExternalWindow (const bool isWindow) |
Public Slots inherited from UI::DeclarativeWidget | |
void | resizeWidget () |
void | setWidget (QWidget *widget) |
Signals | |
void | widgetIndexChanged () |
void | widgetVisibleChanged () |
void | isExternalWindowChanged () |
Signals inherited from UI::DeclarativeWidget | |
void | widgetChanged () |
Public Member Functions | |
DashboardWidget (QQuickItem *parent=0) | |
~DashboardWidget () | |
int | widgetIndex () const |
int | relativeIndex () const |
bool | widgetVisible () const |
QString | widgetIcon () const |
QString | widgetTitle () const |
bool | isExternalWindow () const |
UI::Dashboard::WidgetType | widgetType () const |
Public Member Functions inherited from UI::DeclarativeWidget | |
DeclarativeWidget (QQuickItem *parent=0) | |
QWidget * | widget () |
void | update (const QRect &rect=QRect()) |
virtual void | paint (QPainter *painter) override |
virtual void | keyPressEvent (QKeyEvent *event) override |
virtual void | keyReleaseEvent (QKeyEvent *event) override |
virtual void | inputMethodEvent (QInputMethodEvent *event) override |
virtual void | focusInEvent (QFocusEvent *event) override |
virtual void | focusOutEvent (QFocusEvent *event) override |
virtual void | mousePressEvent (QMouseEvent *event) override |
virtual void | mouseMoveEvent (QMouseEvent *event) override |
virtual void | mouseReleaseEvent (QMouseEvent *event) override |
virtual void | mouseDoubleClickEvent (QMouseEvent *event) override |
virtual void | wheelEvent (QWheelEvent *event) override |
virtual void | dragEnterEvent (QDragEnterEvent *event) override |
virtual void | dragMoveEvent (QDragMoveEvent *event) override |
virtual void | dragLeaveEvent (QDragLeaveEvent *event) override |
virtual void | dropEvent (QDropEvent *event) override |
Properties | |
int | widgetIndex |
int | relativeIndex |
QString | widgetIcon |
QString | widgetTitle |
bool | isExternalWindow |
bool | widgetVisible |
Properties inherited from UI::DeclarativeWidget | |
QWidget * | widget |
Private Slots | |
void | updateWidgetVisible () |
Private Attributes | |
int | m_index |
bool | m_widgetVisible |
bool | m_isExternalWindow |
QPointer< Widgets::DashboardWidgetBase > | m_dbWidget |
The DashboardWidget class.
The DashboardWidget
class acts as a man-in-the-middle between the QML UI and the C++ widgets. C++ widgets are loaded and initialized by this class, and all the QML/Qt events are re-routed to the widgets using this class. Finally, the C++ widget is "painted" on the QML interface in realtime, effectively allowing us to use QWidget object directly in the QML user interface.
By using this approach, the QML user interface only needs to know the total number of widgets and use the "global-index" approach to initialize every widget using a Repeater item.
On the other hand, this class figures out which widget should be loaded and displayed in the user interface by knowing the "global-index" provider by the QML Repeater.
See the following files for more information: assets/qml/Dashboard/WidgetDelegate.qml assets/qml/Dashboard/WidgetLoader.qml assets/qml/Dashboard/WidgetGrid.qml
UI::DashboardWidget::DashboardWidget | ( | QQuickItem * | parent = 0 | ) |
Constructor function
UI::DashboardWidget::~DashboardWidget | ( | ) |
Delete widget on class destruction
bool UI::DashboardWidget::isExternalWindow | ( | ) | const |
If set to true
, then the widget visibility shall be controlled directly by the QML interface.
If set to false
, then the widget visbility shall be controlled by the UI::Dashboard class via the SIGNAL/SLOT system.
|
signal |
int UI::DashboardWidget::relativeIndex | ( | ) | const |
Returns the relative index of the widget (e.g. index of a bar widget in relation to the total number of bar widgets).
|
slot |
Changes the widget visibility controller source.
If set to true
, then the widget visibility shall be controlled directly by the QML interface.
If set to false
, then the widget visbility shall be controlled by the UI::Dashboard class via the SIGNAL/SLOT system.
|
slot |
Changes the visibility & enabled status of the widget
|
slot |
Selects & configures the appropiate widget for the given index
|
privateslot |
Updates the visibility status of the current widget (this function is called automatically by the UI::Dashboard class via signals/slots).
QString UI::DashboardWidget::widgetIcon | ( | ) | const |
Returns the path of the SVG icon to use with this widget
int UI::DashboardWidget::widgetIndex | ( | ) | const |
Returns the global index of the widget (index of the current widget in relation to all registered widgets).
|
signal |
QString UI::DashboardWidget::widgetTitle | ( | ) | const |
Returns the appropiate window title for the given widget
UI::Dashboard::WidgetType UI::DashboardWidget::widgetType | ( | ) | const |
Returns the type of the current widget (e.g. group, plot, bar, gauge, etc...)
bool UI::DashboardWidget::widgetVisible | ( | ) | const |
Returns true
if the QML interface should display this widget.
|
signal |
|
private |
|
private |
|
private |
|
private |
|
readwrite |
|
read |
|
read |
|
readwrite |
|
read |
|
readwrite |