cumbia-qtcontrols 1.x
Qt widgets on top of the cumbia C++ library
QuComboBox Class Reference

QuComboBox derives from Qt QComboBox to display values. When the option is activated explicitly, it can write either the current text or the current index. More...

#include <qucombobox.h>

Inheritance diagram for QuComboBox:

Public Slots

void setTarget (const QString &target, CuContext *ctx=nullptr)
 Connect the reader to the specified source.
 
void clearTarget ()
 
virtual bool ctxSwap (CumbiaPool *cu_p, const CuControlsFactoryPool &fpool)
 
void write (int i)
 write an integer to the target
 
void write (const QString &s)
 write a string to the target
 
void setIndexMode (bool im)
 enable or disable index mode
 
void setExecuteOnIndexChanged (bool exe)
 change the executeOnIndexChanged property
 
void onAnimationValueChanged (const QVariant &v)
 

Signals

void newData (const CuData &)
 
void linkStatsRequest (QWidget *myself, CuContextI *myself_as_cwi)
 

Public Member Functions

 QuComboBox (QWidget *w, Cumbia *cumbia, const CuControlsWriterFactoryI &r_fac)
 Constructor with the parent widget, an engine specific Cumbia implementation and a CuControlsReaderFactoryI interface.
 
 QuComboBox (QWidget *w, CumbiaPool *cumbia_pool, const CuControlsFactoryPool &fpool)
 Constructor with the parent widget, CumbiaPool and CuControlsFactoryPool
 
virtual ~QuComboBox ()
 
QString target () const
 returns the target of the writer
 
CuContextgetContext () const
 returns the pointer to the CuContext
 
bool indexMode () const
 returns index mode enabled or not
 
bool executeOnIndexChanged () const
 returns the value of the property executeOnIndexChanged
 
QString getData () const
 
void onUpdate (const CuData &d)
 
- Public Member Functions inherited from CuContextI
virtual ~CuContextI ()
 

Protected Member Functions

void contextMenuEvent (QContextMenuEvent *e)
 
void paintEvent (QPaintEvent *pe)
 

Properties

QString target
 
QString source
 
bool indexMode
 
bool executeOnIndexChanged
 
QString data
 

Detailed Description

QuComboBox derives from Qt QComboBox to display values. When the option is activated explicitly, it can write either the current text or the current index.

Connection is initiated with setTarget. The values property, if available from the underlying engine, is used to initialize the items at configuration time.

getContext returns a pointer to the CuContext used as a delegate for the connection.

See also
indexMode
executeOnIndexChanged

If the object is used to provide input arguments to other writers (e.g. QuPushButton), the data property provides a string representation of either the current text or index, according to indexMode.

See also
CuControlsUtils

Constructor & Destructor Documentation

◆ QuComboBox() [1/2]

QuComboBox::QuComboBox ( QWidget * w,
Cumbia * cumbia,
const CuControlsWriterFactoryI & r_factory )

Constructor with the parent widget, an engine specific Cumbia implementation and a CuControlsReaderFactoryI interface.

Please refer to md_src_cumbia_qtcontrols_widget_constructors documentation.

◆ QuComboBox() [2/2]

QuComboBox::QuComboBox ( QWidget * w,
CumbiaPool * cumbia_pool,
const CuControlsFactoryPool & fpool )

Constructor with the parent widget, CumbiaPool and CuControlsFactoryPool

Please refer to md_src_cumbia_qtcontrols_widget_constructors documentation.

◆ ~QuComboBox()

QuComboBox::~QuComboBox ( )
virtual

Member Function Documentation

◆ clearTarget

void QuComboBox::clearTarget ( )
slot

◆ contextMenuEvent()

void QuComboBox::contextMenuEvent ( QContextMenuEvent * e)
protected

◆ ctxSwap

bool QuComboBox::ctxSwap ( CumbiaPool * cu_p,
const CuControlsFactoryPool & fpool )
virtualslot

◆ executeOnIndexChanged()

bool QuComboBox::executeOnIndexChanged ( ) const

returns the value of the property executeOnIndexChanged

Returns
true when the index of the combo box changes, a write operation is sent through the link
false no writings are executed upon index change
See also
setExecuteOnIndexChanged

◆ getContext()

CuContext * QuComboBox::getContext ( ) const
virtual

returns the pointer to the CuContext

CuContext sets up the connection and is used as a mediator to send and get data to and from the reader.

See also
CuContext

Implements CuContextI.

◆ getData()

QString QuComboBox::getData ( ) const

◆ indexMode()

bool QuComboBox::indexMode ( ) const

returns index mode enabled or not

Returns
true: the combo box is working in index mode
false: the combo box is working with its text items

When index mode is enabled, the current item is chosen by its index at configuration time and the value used for writing is the QComboBox currentIndex. When it is disabled, currentText is used for writings and the current item at configuration time is searched by the source value (string comparison).

◆ linkStatsRequest

void QuComboBox::linkStatsRequest ( QWidget * myself,
CuContextI * myself_as_cwi )
signal

◆ newData

void QuComboBox::newData ( const CuData & )
signal

Referenced by onUpdate().

◆ onAnimationValueChanged

void QuComboBox::onAnimationValueChanged ( const QVariant & v)
slot

◆ onUpdate()

void QuComboBox::onUpdate ( const CuData & d)

◆ paintEvent()

void QuComboBox::paintEvent ( QPaintEvent * pe)
protected

◆ setExecuteOnIndexChanged

void QuComboBox::setExecuteOnIndexChanged ( bool exe)
slot

change the executeOnIndexChanged property

Parameters
exetrue: write on index change according to indexMode
exefalse (default) noop on index change
See also
executeOnIndexChanged

◆ setIndexMode

void QuComboBox::setIndexMode ( bool im)
slot

enable or disable index mode

Parameters
imtrue index mode enabled
imfalse index mode disabled
See also
indexMode

◆ setTarget

void QuComboBox::setTarget ( const QString & target,
CuContext * ctx = nullptr )
slot

Connect the reader to the specified source.

If a reader with a different source is configured, it is deleted. If options have been set with QuContext::setOptions, they are used to set up the reader as desired.

See also
QuContext::setOptions
source

References CuControlsWriterA::setTarget(), and target.

◆ target()

QString QuComboBox::target ( ) const

returns the target of the writer

Returns
a QString with the name of the target

References CuControlsWriterA::target().

◆ write [1/2]

void QuComboBox::write ( const QString & s)
slot

write a string to the target

Parameters
sthe string to be written on the target

◆ write [2/2]

void QuComboBox::write ( int ival)
slot

write an integer to the target

Parameters
ithe value to be written on the target

Property Documentation

◆ data

QString QuComboBox::data
read

◆ executeOnIndexChanged

bool QuComboBox::executeOnIndexChanged
readwrite

◆ indexMode

bool QuComboBox::indexMode
readwrite

◆ source

QString QuComboBox::source
readwrite

◆ target

QString QuComboBox::target
readwrite

Referenced by setTarget().


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