src/inputcombo.cpp
changeset 0 04114bce8fd0
equal deleted inserted replaced
-1:000000000000 0:04114bce8fd0
       
     1 #include <qlabel.h>
       
     2 #include <qcombobox.h>
       
     3 #include <qstring.h>
       
     4 #include "inputcombo.h"
       
     5 #include <qstringlist.h>
       
     6 
       
     7 
       
     8 InputCombo::InputCombo( QWidget *parent, const char *name )
       
     9 		: QHBox( parent, name )
       
    10 {
       
    11 	labelbox = new QLabel( this );
       
    12 	combobox = new QComboBox( this );
       
    13 	initWidget();
       
    14 }
       
    15 
       
    16 InputCombo::InputCombo( const QString &mylabel,
       
    17 	QWidget *parent, const char *name ) : QHBox( parent, name )
       
    18 {
       
    19 	labelbox = new QLabel( mylabel, this );
       
    20 	combobox = new QComboBox( this );
       
    21 	initWidget();
       
    22 }
       
    23 
       
    24 InputCombo::InputCombo( const QString &mylabel, const QStringList &mystrings,
       
    25 		QWidget *parent, const char *name ) : QHBox( parent, name )
       
    26 {
       
    27 	labelbox = new QLabel( mylabel, this );
       
    28 	combobox = new QComboBox( this );
       
    29 	combobox->insertStringList(mystrings);
       
    30 	initWidget();
       
    31 }
       
    32 
       
    33 void InputCombo::initWidget()
       
    34 {
       
    35 	// Init widget config
       
    36 	setStretchFactor( labelbox, 0 );
       
    37 	setStretchFactor( combobox, 1 );
       
    38 	setSpacing( 10 );
       
    39 }
       
    40 
       
    41 void InputCombo::setLabel(QString &str)
       
    42 {
       
    43 	labelbox->setText(str);
       
    44 }
       
    45 
       
    46 QString InputCombo::text() const
       
    47 {
       
    48 	return combobox->currentText();
       
    49 }
       
    50 
       
    51 QString InputCombo::label() const
       
    52 {
       
    53 	return labelbox->text();
       
    54 }
       
    55 
       
    56 QLabel* InputCombo::qLabel()
       
    57 {
       
    58 	return labelbox;
       
    59 }
       
    60 
       
    61 QComboBox* InputCombo::qComboBox()
       
    62 {
       
    63 	return combobox;
       
    64 }