QVisu
Qt-based visualization for smart homes
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
QVElement Class Reference

#include <qvelement.h>

Inheritance diagram for QVElement:
QVDimmer QVFritz QVGoogleCalendar QVHeating QVPlot QVSelector QVShutter QVSwitch QVWeather

Public Slots

virtual void onValueChanged (QString, QString)
 
virtual void onSeriesReceived (QString, QMap< double, double >)
 
void onContainerChanged (QString)
 
virtual void onInitCompleted ()
 

Signals

void valueModified (QString, QString)
 
void requestSeries (QString item, QString series_type, QString start)
 

Public Member Functions

 QVElement (QDomElement xml_desc, QString container, QWidget *parent=0)
 
QList< QString > getItemList ()
 
QList< int > getGeometry ()
 

Static Public Member Functions

static QString findFilePath (QString name)
 
static QString colorString (QString)
 

Protected Member Functions

virtual void resizeEvent (QResizeEvent *event)
 
QString getItemByAction (QString action, int index=0)
 
int height ()
 
int width ()
 
int ofs_x ()
 
int ofs_y ()
 
double max_icon_width ()
 
double max_label_height ()
 

Protected Attributes

int w
 
int h
 
QString container
 
QMap< QString, QVItemitems
 
QString color
 
QString active_color
 

Detailed Description

The base class for all elements which can be displayed. Actual elements need to be subclassed from QVElement.
Takes care of position, size, container and list of items.
All other functionaliy is to be implemented in the subclass.

Constructor & Destructor Documentation

QVElement::QVElement ( QDomElement  xml_desc,
QString  container,
QWidget *  parent = 0 
)
explicit

Basic constructor for all elements.

Parameters
xml_descThe XML <element> node
containerThe parent container
parentParent widget, as in all Qt widgets

Will determine width, height, position, color and active color. Extracts all items which are direct children of the <element> node. They are then accessible via getItemList()

Get position of element and container. All other info is extracted in the derived classes

Member Function Documentation

QString QVElement::colorString ( QString  color)
static

Convert a Windows 8 color string to the #xxxxxx format.

Returns the color code for a Windows color name. If the name is not found, it will return the input string (as lowercase).

QString QVElement::findFilePath ( QString  name)
static

Try to find the file name in one of the directories specified by <path>

QList< int > QVElement::getGeometry ( )

Returns x,y,w,h in this order.

QString QVElement::getItemByAction ( QString  action,
int  index = 0 
)
protected

Returns the item name which corresponds to the action.

Parameters
actionThe action as defined in
indexIf the action is contained several times in the <element> node, retrieves the n-th entry. Counting starts at 0.
Return values
Anempty string if the action is not configured or index is out of range.
QList< QString > QVElement::getItemList ( )

Return a list of all items which have been configured inside the <element> node.

int QVElement::height ( )
protected

Height of the content in pixels

int QVElement::ofs_x ( )
protected

Content margin (x direction) in pixels

int QVElement::ofs_y ( )
protected

Content margin (y direction) in pixels

void QVElement::onContainerChanged ( QString  container)
slot

Called on ontainer change. Handled by QVElement(), to be overloaded only with reason (e.g. video element)

void QVElement::onInitCompleted ( )
virtualslot

Called when the websocket connection is established.

void QVElement::onSeriesReceived ( QString  ,
QMap< double, double >   
)
virtualslot

Handle an incoming series. To be overloaded in QVPlot

void QVElement::onValueChanged ( QString  ,
QString   
)
virtualslot

Handle incoming values. Will also be called after the element itself emits valueModified(). To be overloaded in a child class.

void QVElement::requestSeries ( QString  item,
QString  series_type,
QString  start 
)
signal

Emitted to request a series. Used only by the plot element.

void QVElement::resizeEvent ( QResizeEvent *  event)
protectedvirtual

Unless you use a layout, overload this method to place Qt widgets inside the element

Reimplemented in QVWeather, QVSelector, QVGoogleCalendar, QVHeating, QVDimmer, QVPlot, QVSwitch, QVShutter, and QVFritz.

void QVElement::valueModified ( QString  ,
QString   
)
signal

Emitted when a value has been changed actively in the element

int QVElement::width ( )
protected

Width of the content in pixels

Member Data Documentation

QString QVElement::container
protected

Container in which the element is contained

int QVElement::h
protected

Height in the grid. May be overwritten in the constructor of the derived class.

QMap<QString,QVItem> QVElement::items
protected

List of items. Key is the item name, content is a QVItem

int QVElement::w
protected

Width in the grid. May be overwritten in the constructor of the derived class.


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