GuiTabular.cpp: fix #3517

- disable column alignment and width if there is a LaTeX argument
- use also for the LaTeX argument the editingFinished method (as for all other edit fields in the dialog)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36566 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Uwe Stöhr 2010-11-29 02:38:29 +00:00
parent aa69852341
commit d80053cda8

View File

@ -130,7 +130,7 @@ GuiTabular::GuiTabular(QWidget * parent)
this, SLOT(checkEnabled()));
connect(captionStatusCB, SIGNAL(clicked()),
this, SLOT(checkEnabled()));
connect(specialAlignmentED, SIGNAL(textEdited(QString)),
connect(specialAlignmentED, SIGNAL(editingFinished()),
this, SLOT(checkEnabled()));
connect(widthED, SIGNAL(editingFinished()),
this, SLOT(checkEnabled()));
@ -159,7 +159,6 @@ GuiTabular::GuiTabular(QWidget * parent)
connect(rightRB, SIGNAL(clicked()),
this, SLOT(checkEnabled()));
// initialize the length validator
addCheckedWidget(widthED, fixedWidthColLA);
addCheckedWidget(multirowOffsetED, multirowOffsetLA);
@ -171,17 +170,22 @@ GuiTabular::GuiTabular(QWidget * parent)
void GuiTabular::checkEnabled()
{
// if there is a LaTeX argument, the width and alignment will be overwrtitten
// therefore disable them in this case
widthED->setEnabled(specialAlignmentED->text().isEmpty());
// if the column has a width, multirows are always left-aligned
// therefore disable hAlignCB in this case
hAlignCB->setEnabled(!(multirowCB->isChecked()
&& !widgetsToLength(widthED, widthUnitCB).empty()));
&& !widgetsToLength(widthED, widthUnitCB).empty())
&& specialAlignmentED->text().isEmpty());
bool dalign =
hAlignCB->itemData(hAlignCB->currentIndex()).toString() == QString("decimal");
decimalPointLE->setEnabled(dalign);
decimalL->setEnabled(dalign);
vAlignCB->setEnabled(!multirowCB->isChecked()
&& !widgetsToLength(widthED, widthUnitCB).empty());
&& !widgetsToLength(widthED, widthUnitCB).empty()
&& specialAlignmentED->text().isEmpty());
topspaceED->setEnabled(topspaceCO->currentIndex() == 2);
topspaceUnitCB->setEnabled(topspaceCO->currentIndex() == 2);