Minor tweaking of EditVariablesDialog.

This commit is contained in:
Jim Evins
2019-08-03 15:31:57 -04:00
parent 48bfb68837
commit dd41aa3dd7
4 changed files with 95 additions and 88 deletions
+3 -14
View File
@@ -67,6 +67,8 @@ namespace glabels
{ {
incrementCombo->addItem( model::Variable::incrementToI18nString( type ) ); incrementCombo->addItem( model::Variable::incrementToI18nString( type ) );
} }
stepSizeEdit->setText( "1" );
} }
@@ -157,28 +159,16 @@ namespace glabels
case model::Variable::Type::INTEGER: case model::Variable::Type::INTEGER:
valueEdit->setValidator( new QIntValidator() ); valueEdit->setValidator( new QIntValidator() );
stepSizeEdit->setValidator( new QIntValidator() ); stepSizeEdit->setValidator( new QIntValidator() );
if ( increment == model::Variable::Increment::NEVER )
{
stepSizeEdit->setText( "0" );
}
break; break;
case model::Variable::Type::FLOATING_POINT: case model::Variable::Type::FLOATING_POINT:
valueEdit->setValidator( new QDoubleValidator() ); valueEdit->setValidator( new QDoubleValidator() );
stepSizeEdit->setValidator( new QDoubleValidator() ); stepSizeEdit->setValidator( new QDoubleValidator() );
if ( increment == model::Variable::Increment::NEVER )
{
stepSizeEdit->setText( "0" );
}
break; break;
default: default:
valueEdit->setValidator( nullptr ); valueEdit->setValidator( nullptr );
stepSizeEdit->setValidator( nullptr ); stepSizeEdit->setValidator( nullptr );
incrementCombo->setCurrentIndex( static_cast<int>(model::Variable::Increment::NEVER) );
stepSizeEdit->setText( "" );
break; break;
} }
@@ -186,8 +176,7 @@ namespace glabels
bool isNumeric = ( type == model::Variable::Type::INTEGER ) || bool isNumeric = ( type == model::Variable::Type::INTEGER ) ||
( type == model::Variable::Type::FLOATING_POINT ); ( type == model::Variable::Type::FLOATING_POINT );
incrementLabel->setEnabled( isNumeric ); incrementGroup->setVisible( isNumeric );
incrementCombo->setEnabled( isNumeric );
stepSizeLabel->setEnabled( isNumeric && (increment != model::Variable::Increment::NEVER) ); stepSizeLabel->setEnabled( isNumeric && (increment != model::Variable::Increment::NEVER) );
stepSizeEdit->setEnabled( isNumeric && (increment != model::Variable::Increment::NEVER) ); stepSizeEdit->setEnabled( isNumeric && (increment != model::Variable::Increment::NEVER) );
+1 -1
View File
@@ -126,7 +126,7 @@ namespace glabels
"x", "x",
"0", "0",
model::Variable::Increment::NEVER, model::Variable::Increment::NEVER,
"0" ); "1" );
dialog.setVariable( v ); dialog.setVariable( v );
dialog.setWindowTitle( tr("Add Variable") ); dialog.setWindowTitle( tr("Add Variable") );
+55 -41
View File
@@ -6,54 +6,24 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>471</width> <width>469</width>
<height>237</height> <height>297</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Dialog</string> <string>Dialog</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0" colspan="2"> <property name="verticalSpacing">
<layout class="QGridLayout" name="gridLayout"> <number>12</number>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Variable type:</string>
</property> </property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="typeCombo"/>
</item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="label"> <widget class="QGroupBox" name="incrementGroup">
<property name="text"> <property name="title">
<string>Name:</string> <string>Increment</string>
</property> </property>
</widget> <layout class="QGridLayout" name="gridLayout_3">
</item> <item row="0" column="0">
<item row="1" column="1">
<widget class="QLineEdit" name="nameEdit"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Initial value:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="valueEdit"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="incrementLabel">
<property name="text">
<string>Increment:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<item> <item>
<widget class="QComboBox" name="incrementCombo"/> <widget class="QComboBox" name="incrementCombo"/>
@@ -71,8 +41,9 @@
</layout> </layout>
</item> </item>
</layout> </layout>
</widget>
</item> </item>
<item row="1" column="1"> <item row="2" column="0">
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@@ -85,7 +56,50 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="2" column="0" colspan="2"> <item row="0" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Variable</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="1">
<widget class="QLineEdit" name="nameEdit"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Type:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="valueEdit"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Value:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="typeCombo"/>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox"> <widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
+16 -12
View File
@@ -184,26 +184,30 @@
<source>Dialog</source> <source>Dialog</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Variable type:</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Name:</source> <source>Name:</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Initial value:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Increment:</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Step size:</source> <source>Step size:</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Increment</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Variable</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Type:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Value:</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>Factory</name> <name>Factory</name>