fix bug 6298: impossible to create boxes with a custom width:

* LengthCombo.{cpp,h}:
	- new method to reset the combo to initial state
* GuiBox.cpp (setSpecial):
	- reset width length combo properly


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@31840 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2009-11-03 15:00:32 +00:00
parent b27b88c7f9
commit 9c1bd19887
4 changed files with 22 additions and 13 deletions

View File

@ -423,11 +423,8 @@ void GuiBox::setSpecial(bool ibox)
for (int i = 1; i < gui_names_spec_.size(); ++i)
widthUnitsLC->addItem(gui_names_spec_[i]);
// ... or remove 'em if needed
} else if (ibox && has_special) {
widthUnitsLC->clear();
for (int i = 0; i != num_units; ++i)
widthUnitsLC->addItem(qt_(unit_name_gui[i]));
}
} else if (ibox && has_special)
widthUnitsLC->reset();
// restore selected text, if possible
int const idx = widthUnitsLC->findText(current_text);
if (idx != -1)

View File

@ -24,14 +24,7 @@
LengthCombo::LengthCombo(QWidget * parent)
: QComboBox(parent)
{
for (int i = 0; i < lyx::num_units; i++) {
// mu does not make sense usually
// so it must be added manually, if needed
if (lyx::unit_name[i] == "mu")
continue;
QComboBox::addItem(lyx::qt_(lyx::unit_name_gui[i]),
lyx::toqstr(lyx::unit_name[i]));
}
reset();
connect(this, SIGNAL(activated(int)),
this, SLOT(has_activated(int)));
@ -129,4 +122,18 @@ void LengthCombo::addItem(QString const item)
QComboBox::addItem(item);
}
void LengthCombo::reset()
{
clear();
for (int i = 0; i < lyx::num_units; i++) {
// mu does not make sense usually
// so it must be added manually, if needed
if (lyx::unit_name[i] == "mu")
continue;
QComboBox::addItem(lyx::qt_(lyx::unit_name_gui[i]),
lyx::toqstr(lyx::unit_name[i]));
}
}
#include "LengthCombo_moc.cpp"

View File

@ -46,6 +46,8 @@ public:
virtual void addItem(lyx::Length::UNIT unit);
/// add an item to the combo
virtual void addItem(QString const item);
/// reset to initial state
virtual void reset();
protected Q_SLOTS:
virtual void has_activated(int index);

View File

@ -188,6 +188,9 @@ What's new
- Fix bad allocation exception when displaying long tooltips (bug 6215).
- Fix width definition in the box dialog after a box inset was transformed
from "Inner Box" type "None" to "Parbox" or "Minipage" (bug 6298).
- Fixed problem involving inability to turn off auto-save (bug 6227).
- Sort document classes case insensitively (bug 1492).