mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 05:25:26 +00:00
Minor checkedLineEdit fixes
* Do not disallow application if an invalid widget is disabled * Fix coloring of text
This commit is contained in:
parent
6741a8fbf8
commit
c7c3b39413
@ -53,6 +53,13 @@ CheckedLineEdit::CheckedLineEdit(QLineEdit * input, QWidget * label)
|
||||
|
||||
bool CheckedLineEdit::check() const
|
||||
{
|
||||
if (!input_->isEnabled()) {
|
||||
// we do not check diabled widgets
|
||||
if (label_)
|
||||
setValid(label_, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
QValidator const * validator = input_->validator();
|
||||
if (!validator)
|
||||
return true;
|
||||
|
@ -876,8 +876,8 @@ GuiDocument::GuiDocument(GuiView & lv)
|
||||
textLayoutModule->lspacingCO->insertItem(
|
||||
Spacing::Other, qt_("Custom"));
|
||||
// initialize the length validator
|
||||
bc().addCheckedLineEdit(textLayoutModule->indentLE);
|
||||
bc().addCheckedLineEdit(textLayoutModule->skipLE);
|
||||
bc().addCheckedLineEdit(textLayoutModule->indentLE, textLayoutModule->indentRB);
|
||||
bc().addCheckedLineEdit(textLayoutModule->skipLE, textLayoutModule->skipRB);
|
||||
|
||||
textLayoutModule->tableStyleCO->addItem(qt_("Default"), toqstr("default"));
|
||||
getTableStyles();
|
||||
@ -937,7 +937,7 @@ GuiDocument::GuiDocument(GuiView & lv)
|
||||
outputModule->synccustomCB->addItem("\\synctex=-1");
|
||||
outputModule->synccustomCB->addItem("\\usepackage[active]{srcltx}");
|
||||
|
||||
outputModule->synccustomCB->setValidator(new NoNewLineValidator(
|
||||
outputModule->synccustomCB->lineEdit()->setValidator(new NoNewLineValidator(
|
||||
outputModule->synccustomCB));
|
||||
|
||||
connect(outputModule->saveTransientPropertiesCB, SIGNAL(clicked()),
|
||||
@ -1522,14 +1522,14 @@ GuiDocument::GuiDocument(GuiView & lv)
|
||||
connect(mathsModule->MathNumberingPosCO, SIGNAL(activated(int)),
|
||||
this, SLOT(change_adaptor()));
|
||||
|
||||
connect(mathsModule->MathIndentCB, SIGNAL(toggled(bool)),
|
||||
this, SLOT(change_adaptor()));
|
||||
connect(mathsModule->MathIndentCB, SIGNAL(toggled(bool)),
|
||||
this, SLOT(allowMathIndent()));
|
||||
connect(mathsModule->MathIndentCO, SIGNAL(activated(int)),
|
||||
connect(mathsModule->MathIndentCB, SIGNAL(toggled(bool)),
|
||||
this, SLOT(change_adaptor()));
|
||||
connect(mathsModule->MathIndentCO, SIGNAL(activated(int)),
|
||||
this, SLOT(enableMathIndent(int)));
|
||||
connect(mathsModule->MathIndentCO, SIGNAL(activated(int)),
|
||||
this, SLOT(change_adaptor()));
|
||||
connect(mathsModule->MathIndentLE, SIGNAL(textChanged(const QString &)),
|
||||
this, SLOT(change_adaptor()));
|
||||
connect(mathsModule->MathIndentLengthCO, SIGNAL(activated(int)),
|
||||
@ -1541,7 +1541,7 @@ GuiDocument::GuiDocument(GuiView & lv)
|
||||
mathsModule->MathIndentLE->setValidator(new LengthValidator(
|
||||
mathsModule->MathIndentLE));
|
||||
// initialize the length validator
|
||||
bc().addCheckedLineEdit(mathsModule->MathIndentLE);
|
||||
bc().addCheckedLineEdit(mathsModule->MathIndentLE, mathsModule->MathIndentCB);
|
||||
mathsModule->MathNumberingPosCO->addItem(qt_("Left"));
|
||||
mathsModule->MathNumberingPosCO->addItem(qt_("Default"));
|
||||
mathsModule->MathNumberingPosCO->addItem(qt_("Right"));
|
||||
|
@ -239,10 +239,12 @@ void setValid(QWidget * widget, bool valid)
|
||||
if (qobject_cast<QCheckBox*>(widget) != nullptr) {
|
||||
// Check boxes need to be treated differenty, see
|
||||
// https://forum.qt.io/topic/93253/
|
||||
if (qobject_cast<QCheckBox*>(widget)->isChecked())
|
||||
widget->setStyleSheet("QCheckBox:unchecked{ color: red; }QCheckBox:checked{ color: red; }");
|
||||
} else {
|
||||
QPalette pal = widget->palette();
|
||||
pal.setColor(QPalette::Active, QPalette::WindowText, QColor(255, 0, 0));
|
||||
pal.setColor(QPalette::Active, QPalette::Text, QColor(255, 0, 0));
|
||||
widget->setPalette(pal);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user