Serial Studio 1.1.6
A dashboard software for your embedded projects
UI::DashboardWidget Class Reference

The DashboardWidget class. More...

#include <DashboardWidget.h>

Inheritance diagram for UI::DashboardWidget:
Inheritance graph
Collaboration diagram for UI::DashboardWidget:
Collaboration graph

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::DashboardWidgetBasem_dbWidget
 

Detailed Description

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

Constructor & Destructor Documentation

◆ DashboardWidget()

UI::DashboardWidget::DashboardWidget ( QQuickItem *  parent = 0)

Constructor function

◆ ~DashboardWidget()

UI::DashboardWidget::~DashboardWidget ( )

Delete widget on class destruction

Member Function Documentation

◆ isExternalWindow()

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.

◆ isExternalWindowChanged

void UI::DashboardWidget::isExternalWindowChanged ( )
signal

◆ relativeIndex()

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).

◆ setIsExternalWindow

void UI::DashboardWidget::setIsExternalWindow ( const bool  isWindow)
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.

◆ setVisible

void UI::DashboardWidget::setVisible ( const bool  visible)
slot

Changes the visibility & enabled status of the widget

◆ setWidgetIndex

void UI::DashboardWidget::setWidgetIndex ( const int  index)
slot

Selects & configures the appropiate widget for the given index

◆ updateWidgetVisible

void UI::DashboardWidget::updateWidgetVisible ( )
privateslot

Updates the visibility status of the current widget (this function is called automatically by the UI::Dashboard class via signals/slots).

◆ widgetIcon()

QString UI::DashboardWidget::widgetIcon ( ) const

Returns the path of the SVG icon to use with this widget

◆ widgetIndex()

int UI::DashboardWidget::widgetIndex ( ) const

Returns the global index of the widget (index of the current widget in relation to all registered widgets).

◆ widgetIndexChanged

void UI::DashboardWidget::widgetIndexChanged ( )
signal

◆ widgetTitle()

QString UI::DashboardWidget::widgetTitle ( ) const

Returns the appropiate window title for the given widget

◆ widgetType()

UI::Dashboard::WidgetType UI::DashboardWidget::widgetType ( ) const

Returns the type of the current widget (e.g. group, plot, bar, gauge, etc...)

◆ widgetVisible()

bool UI::DashboardWidget::widgetVisible ( ) const

Returns true if the QML interface should display this widget.

◆ widgetVisibleChanged

void UI::DashboardWidget::widgetVisibleChanged ( )
signal

Member Data Documentation

◆ m_dbWidget

QPointer<Widgets::DashboardWidgetBase> UI::DashboardWidget::m_dbWidget
private

◆ m_index

int UI::DashboardWidget::m_index
private

◆ m_isExternalWindow

bool UI::DashboardWidget::m_isExternalWindow
private

◆ m_widgetVisible

bool UI::DashboardWidget::m_widgetVisible
private

Property Documentation

◆ isExternalWindow

bool UI::DashboardWidget::isExternalWindow
readwrite

◆ relativeIndex

int UI::DashboardWidget::relativeIndex
read

◆ widgetIcon

QString UI::DashboardWidget::widgetIcon
read

◆ widgetIndex

int UI::DashboardWidget::widgetIndex
readwrite

◆ widgetTitle

QString UI::DashboardWidget::widgetTitle
read

◆ widgetVisible

bool UI::DashboardWidget::widgetVisible
readwrite

The documentation for this class was generated from the following files: