Fix bug 3413:

http://bugzilla.lyx.org/show_bug.cgi?id=3413

* ui/QNomenclUi.ui
  - description field: replace LineEdit with TexEdit

* QNomencl.C: take care of the \n <-> \\ conversion in the description field.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17748 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-04-06 16:27:10 +00:00
parent f9347bc672
commit 61023d5649
3 changed files with 22 additions and 16 deletions

View File

@ -19,9 +19,10 @@
#include "QNomencl.h"
#include "Qt2BC.h"
#include "ButtonController.h"
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QTextEdit>
using std::string;
@ -44,7 +45,7 @@ void QNomencl::build_dialog()
bcview().setOK(dialog_->okPB);
bcview().setCancel(dialog_->closePB);
bcview().addReadOnly(dialog_->symbolED);
bcview().addReadOnly(dialog_->descrED);
bcview().addReadOnly(dialog_->descriptionTE);
bcview().addReadOnly(dialog_->prefixED);
}
@ -53,7 +54,9 @@ void QNomencl::update_contents()
{
dialog_->prefixED->setText(toqstr(controller().params()["prefix"]));
dialog_->symbolED->setText(toqstr(controller().params()["symbol"]));
dialog_->descrED->setText(toqstr(controller().params()["description"]));
QString description = toqstr(controller().params()["description"]);
description.replace("\\\\","\n");
dialog_->descriptionTE->setPlainText(description);
bc().valid(isValid());
}
@ -63,13 +66,16 @@ void QNomencl::apply()
{
controller().params()["prefix"] = qstring_to_ucs4(dialog_->prefixED->text());
controller().params()["symbol"] = qstring_to_ucs4(dialog_->symbolED->text());
controller().params()["description"] = qstring_to_ucs4(dialog_->descrED->text());
QString description = dialog_->descriptionTE->toPlainText();
description.replace('\n',"\\\\");
controller().params()["description"] = qstring_to_ucs4(description);
}
bool QNomencl::isValid()
{
return (!dialog_->symbolED->text().isEmpty() && !dialog_->descrED->text().isEmpty());
QString const description = dialog_->descriptionTE->toPlainText();
return !dialog_->symbolED->text().isEmpty() && !description.isEmpty();
}
} // namespace frontend

View File

@ -20,6 +20,7 @@
#include <QLineEdit>
#include <QWhatsThis>
#include <QCloseEvent>
#include <QTextEdit>
namespace lyx {
namespace frontend {
@ -33,10 +34,10 @@ QNomenclDialog::QNomenclDialog(QNomencl * form)
connect(closePB, SIGNAL(clicked()), form, SLOT(slotClose()));
connect(symbolED, SIGNAL(textChanged(const QString&)),
this, SLOT(change_adaptor()));
connect(descrED, SIGNAL(textChanged(const QString&)),
connect(descriptionTE, SIGNAL(textChanged()),
this, SLOT(change_adaptor()));
setFocusProxy(descrED);
setFocusProxy(descriptionTE);
}

View File

@ -5,8 +5,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>248</width>
<height>136</height>
<width>254</width>
<height>165</height>
</rect>
</property>
<property name="windowTitle" >
@ -25,9 +25,6 @@
<item row="2" column="1" >
<widget class="QLineEdit" name="prefixED" />
</item>
<item row="1" column="1" >
<widget class="QLineEdit" name="descrED" />
</item>
<item row="2" column="0" >
<widget class="QLabel" name="prefixLA" >
<property name="text" >
@ -44,7 +41,7 @@
<string>&amp;Description:</string>
</property>
<property name="buddy" >
<cstring>descrED</cstring>
<cstring>descriptionTE</cstring>
</property>
</widget>
</item>
@ -111,12 +108,14 @@
</item>
</layout>
</item>
<item row="1" column="1" >
<widget class="QTextEdit" name="descriptionTE" />
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11" />
<tabstops>
<tabstop>symbolED</tabstop>
<tabstop>descrED</tabstop>
<tabstop>prefixED</tabstop>
<tabstop>okPB</tabstop>
<tabstop>closePB</tabstop>