config autonum widget: minor change about enable/disable apply button

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2351 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2013-06-27 14:02:59 +00:00
parent 5151fb9d1f
commit 238115df84
3 changed files with 26 additions and 7 deletions

View File

@@ -59,12 +59,20 @@ NumerotationContext NumPartEditorW::toNumContext() {
return nc;
}
/**
* @brief NumPartEditorW::isValid
* @return true if value field isn't empty or if type is folio
*/
bool NumPartEditorW::isValid() {
if (type_ != folio && ui -> value_field -> text().isEmpty()) return false;
return true;
}
/**
* @brief NumPartEditorW::on_type_combo_activated
* Action when user change the type comboBox
*/
void NumPartEditorW::on_type_combo_activated(int index) {
emit changed();
switch (index) {
case unit:
setType(unit);
@@ -82,13 +90,14 @@ void NumPartEditorW::on_type_combo_activated(int index) {
setType(folio);
break;
};
emit changed();
}
/**
* @brief NumPartEditorW::on_value_field_textChanged
* emit changed when @value_field text changed
*/
void NumPartEditorW::on_value_field_textChanged() {
void NumPartEditorW::on_value_field_textEdited() {
emit changed();
}
@@ -97,7 +106,7 @@ void NumPartEditorW::on_value_field_textChanged() {
*emit changed when @increase_spinBox value changed
*/
void NumPartEditorW::on_increase_spinBox_valueChanged() {
emit changed();
if (!ui -> value_field -> text().isEmpty()) emit changed();
}
/**
@@ -108,6 +117,7 @@ void NumPartEditorW::setType(NumPartEditorW::type t) {
ui -> type_combo -> setCurrentIndex(t);
ui -> value_field -> clear();
ui -> increase_spinBox -> setValue(1);
type_= t;
switch (t) {
case unit:
ui -> value_field -> setEnabled(true);