Gui: implementation classes don't inherit from UI classes any more
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
#endif
|
||||
|
||||
#include "DlgInputDialogImp.h"
|
||||
#include "ui_DlgInputDialog.h"
|
||||
#include "SpinBox.h"
|
||||
|
||||
|
||||
@@ -42,18 +43,19 @@ using namespace Gui::Dialog;
|
||||
* true to construct a modal dialog.
|
||||
*/
|
||||
DlgInputDialogImp::DlgInputDialogImp( const QString& labelTxt, QWidget* parent, bool modal, Type type )
|
||||
: QDialog( parent )
|
||||
: QDialog(parent)
|
||||
, ui(new Ui_DlgInputDialog)
|
||||
{
|
||||
this->setModal(modal);
|
||||
this->setupUi(this);
|
||||
label->setText(labelTxt);
|
||||
ui->setupUi(this);
|
||||
ui->label->setText(labelTxt);
|
||||
|
||||
QSize sh = sizeHint();
|
||||
setType(type);
|
||||
resize(qMax(sh.width(), 400), 1);
|
||||
|
||||
connect(lineEdit, SIGNAL(returnPressed()), this, SLOT(tryAccept()));
|
||||
connect(lineEdit, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&)));
|
||||
connect(ui->lineEdit, SIGNAL(returnPressed()), this, SLOT(tryAccept()));
|
||||
connect(ui->lineEdit, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,21 +70,21 @@ void DlgInputDialogImp::textChanged( const QString &s )
|
||||
{
|
||||
bool on = true;
|
||||
|
||||
if (lineEdit->validator()) {
|
||||
QString str = lineEdit->text();
|
||||
int index = lineEdit->cursorPosition();
|
||||
on = ( lineEdit->validator()->validate(str, index) == QValidator::Acceptable );
|
||||
if (ui->lineEdit->validator()) {
|
||||
QString str = ui->lineEdit->text();
|
||||
int index = ui->lineEdit->cursorPosition();
|
||||
on = ( ui->lineEdit->validator()->validate(str, index) == QValidator::Acceptable );
|
||||
}
|
||||
else if ( type() != LineEdit ) {
|
||||
on = !s.isEmpty();
|
||||
}
|
||||
|
||||
buttonBox->button(QDialogButtonBox::Ok)->setEnabled( on );
|
||||
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled( on );
|
||||
}
|
||||
|
||||
void DlgInputDialogImp::tryAccept()
|
||||
{
|
||||
if (!lineEdit->text().isEmpty())
|
||||
if (!ui->lineEdit->text().isEmpty())
|
||||
accept();
|
||||
}
|
||||
|
||||
@@ -94,29 +96,29 @@ void DlgInputDialogImp::setType( DlgInputDialogImp::Type t )
|
||||
switch (inputtype)
|
||||
{
|
||||
case LineEdit:
|
||||
input = lineEdit;
|
||||
input = ui->lineEdit;
|
||||
break;
|
||||
case SpinBox:
|
||||
input = spinBox;
|
||||
input = ui->spinBox;
|
||||
break;
|
||||
case UIntBox:
|
||||
input = uIntSpinBox;
|
||||
input = ui->uIntSpinBox;
|
||||
break;
|
||||
case FloatSpinBox:
|
||||
input = floatSpinBox;
|
||||
input = ui->floatSpinBox;
|
||||
break;
|
||||
case ComboBox:
|
||||
input = comboBox;
|
||||
input = ui->comboBox;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (input) {
|
||||
stack->setCurrentWidget(input->parentWidget());
|
||||
stack->setFixedHeight( input->sizeHint().height() );
|
||||
ui->stack->setCurrentWidget(input->parentWidget());
|
||||
ui->stack->setFixedHeight( input->sizeHint().height() );
|
||||
input->setFocus();
|
||||
label->setBuddy( input );
|
||||
ui->label->setBuddy( input );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,27 +129,27 @@ DlgInputDialogImp::Type DlgInputDialogImp::type() const
|
||||
|
||||
QSpinBox *DlgInputDialogImp::getSpinBox() const
|
||||
{
|
||||
return spinBox;
|
||||
return ui->spinBox;
|
||||
}
|
||||
|
||||
Gui::UIntSpinBox *DlgInputDialogImp::getUIntBox() const
|
||||
{
|
||||
return uIntSpinBox;
|
||||
return ui->uIntSpinBox;
|
||||
}
|
||||
|
||||
QDoubleSpinBox *DlgInputDialogImp::getFloatSpinBox() const
|
||||
{
|
||||
return floatSpinBox;
|
||||
return ui->floatSpinBox;
|
||||
}
|
||||
|
||||
QLineEdit *DlgInputDialogImp::getLineEdit() const
|
||||
{
|
||||
return lineEdit;
|
||||
return ui->lineEdit;
|
||||
}
|
||||
|
||||
QComboBox *DlgInputDialogImp::getComboBox() const
|
||||
{
|
||||
return comboBox;
|
||||
return ui->comboBox;
|
||||
}
|
||||
|
||||
#include "moc_DlgInputDialogImp.cpp"
|
||||
|
||||
Reference in New Issue
Block a user