mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-12 03:23:12 +00:00
* GuiThesaurus.cpp:
- entry parsing should work for all cases now. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27602 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
f901b7f245
commit
90a4256e03
@ -105,15 +105,18 @@ void GuiThesaurus::selectionChanged()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
QString item = meaningsTV->currentItem()->text(col);
|
QString item = meaningsTV->currentItem()->text(col);
|
||||||
// cut out the classification in brackets
|
// cut out the classification in brackets:
|
||||||
// (as in "hominid (generic term)")
|
// "hominid (generic term)" -> "hominid"
|
||||||
// FIXME: not ideal yet. We need to cut off classifications
|
|
||||||
// at the beginning as well
|
|
||||||
// (as in "(noun) man" and "(noun) male (generic term)")
|
|
||||||
QRegExp re("^([^\\(\\)]+)\\b\\(?.*\\)?.*$");
|
QRegExp re("^([^\\(\\)]+)\\b\\(?.*\\)?.*$");
|
||||||
|
// This is for items with classifications at the beginning:
|
||||||
|
// "(noun) man" -> "man"; "(noun) male (generic term)" -> "male"
|
||||||
|
QRegExp rex("^(\\(.+\\))\\s*([^\\(\\)]+)\\s*\\(?.*\\)?.*$");
|
||||||
int pos = re.indexIn(item);
|
int pos = re.indexIn(item);
|
||||||
if (pos > -1)
|
if (pos > -1)
|
||||||
item = re.cap(1).trimmed();
|
item = re.cap(1).trimmed();
|
||||||
|
pos = rex.indexIn(item);
|
||||||
|
if (pos > -1)
|
||||||
|
item = rex.cap(2).trimmed();
|
||||||
replaceED->setText(item);
|
replaceED->setText(item);
|
||||||
replacePB->setEnabled(true);
|
replacePB->setEnabled(true);
|
||||||
changed();
|
changed();
|
||||||
@ -129,15 +132,18 @@ void GuiThesaurus::itemClicked(QTreeWidgetItem * /*item*/, int /*col*/)
|
|||||||
void GuiThesaurus::selectionClicked(QTreeWidgetItem * item, int col)
|
void GuiThesaurus::selectionClicked(QTreeWidgetItem * item, int col)
|
||||||
{
|
{
|
||||||
QString str = item->text(col);
|
QString str = item->text(col);
|
||||||
// cut out the classification in brackets
|
// cut out the classification in brackets:
|
||||||
// (as in "hominid (generic term)")
|
// "hominid (generic term)" -> "hominid"
|
||||||
// FIXME: not ideal yet. We need to cut off classifications
|
|
||||||
// at the beginning as well
|
|
||||||
// (as in "(noun) man" and "(noun) male (generic term)")
|
|
||||||
QRegExp re("^([^\\(\\)]+)\\b\\(?.*\\)?.*$");
|
QRegExp re("^([^\\(\\)]+)\\b\\(?.*\\)?.*$");
|
||||||
|
// This is for items with classifications at the beginning:
|
||||||
|
// "(noun) man" -> "man"; "(noun) male (generic term)" -> "male"
|
||||||
|
QRegExp rex("^(\\(.+\\))\\s*([^\\(\\)]+)\\s*\\(?.*\\)?.*$");
|
||||||
int pos = re.indexIn(str);
|
int pos = re.indexIn(str);
|
||||||
if (pos > -1)
|
if (pos > -1)
|
||||||
str = re.cap(1).trimmed();
|
str = re.cap(1).trimmed();
|
||||||
|
pos = rex.indexIn(str);
|
||||||
|
if (pos > -1)
|
||||||
|
str = rex.cap(2).trimmed();
|
||||||
entryCO->insertItem(0, str);
|
entryCO->insertItem(0, str);
|
||||||
entryCO->setCurrentIndex(0);
|
entryCO->setCurrentIndex(0);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user