Default ctors for LED checkbox and LCD spinbox. Fixes for knob.

This commit is contained in:
Johannes Lorenz committed 2014-04-15 13:43:23 +02:00
1 parent f32f7689b4
commit 51ed1105df
6 files changed
+140 -55

No files matched your search

+44 -29
View File
@@ -40,48 +40,41 @@
//! @todo: in C++11, we can use delegating ctors
#define DEFAULT_LCDWIDGET_INITIALIZER_LIST \
QWidget( parent ), \
m_label()
LcdWidget::LcdWidget( QWidget* parent, const QString& name ) :
DEFAULT_LCDWIDGET_INITIALIZER_LIST,
m_numDigits( 1 )
{
initUi( name );
}
LcdWidget::LcdWidget( int numDigits, QWidget* parent, const QString& name ) :
QWidget( parent ),
m_label(),
DEFAULT_LCDWIDGET_INITIALIZER_LIST,
m_numDigits( numDigits )
{
setEnabled( true );
setWindowTitle( name );
m_lcdPixmap = new QPixmap( embed::getIconPixmap( "lcd_19green" ) );
m_cellWidth = m_lcdPixmap->size().width() / LcdWidget::charsPerPixmap;
m_cellHeight = m_lcdPixmap->size().height() / 2;
m_marginWidth = m_cellWidth / 2;
updateSize();
initUi( name );
}
LcdWidget::LcdWidget( int numDigits, const QString& style, QWidget* parent, const QString& name ) :
QWidget( parent ),
m_label(),
DEFAULT_LCDWIDGET_INITIALIZER_LIST,
m_numDigits( numDigits )
{
setEnabled( true );
setWindowTitle( name );
// We should make a factory for these or something.
m_lcdPixmap = new QPixmap( embed::getIconPixmap( QString( "lcd_" + style ).toUtf8().constData() ) );
m_cellWidth = m_lcdPixmap->size().width() / LcdWidget::charsPerPixmap;
m_cellHeight = m_lcdPixmap->size().height() / 2;
m_marginWidth = m_cellWidth / 2;
updateSize();
initUi( name, style );
}
#undef DEFAULT_LCDWIDGET_INITIALIZER_LIST
@@ -242,5 +235,27 @@ void LcdWidget::updateSize()
void LcdWidget::initUi(const QString& name , const QString& style)
{
setEnabled( true );
setWindowTitle( name );
// We should make a factory for these or something.
//m_lcdPixmap = new QPixmap( embed::getIconPixmap( QString( "lcd_" + style ).toUtf8().constData() ) );
//m_lcdPixmap = new QPixmap( embed::getIconPixmap( "lcd_19green" ) ); // TODO!!
m_lcdPixmap = new QPixmap( embed::getIconPixmap( QString( "lcd_" + style ).toUtf8().constData() ) );
m_cellWidth = m_lcdPixmap->size().width() / LcdWidget::charsPerPixmap;
m_cellHeight = m_lcdPixmap->size().height() / 2;
m_marginWidth = m_cellWidth / 2;
updateSize();
}
#include "moc_LcdWidget.cxx"