Fixed crash after put value from empty list.
--HG-- branch : develop
This commit is contained in:
parent
624eb87a25
commit
58bffd4005
|
@ -345,13 +345,14 @@ void DialogTool::PutValHere(QLineEdit *lineEdit, QListWidget *listWidget)
|
||||||
SCASSERT(lineEdit != nullptr);
|
SCASSERT(lineEdit != nullptr);
|
||||||
SCASSERT(listWidget != nullptr);
|
SCASSERT(listWidget != nullptr);
|
||||||
QListWidgetItem *item = listWidget->currentItem();
|
QListWidgetItem *item = listWidget->currentItem();
|
||||||
SCASSERT(item != nullptr);
|
if (item != nullptr)
|
||||||
|
{
|
||||||
int pos = lineEdit->cursorPosition();
|
int pos = lineEdit->cursorPosition();
|
||||||
lineEdit->setText(lineEdit->text().insert(lineEdit->cursorPosition(), item->text()));
|
lineEdit->setText(lineEdit->text().insert(lineEdit->cursorPosition(), item->text()));
|
||||||
lineEdit->setFocus();
|
lineEdit->setFocus();
|
||||||
lineEdit->setCursorPosition(pos + item->text().size());
|
lineEdit->setCursorPosition(pos + item->text().size());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogTool::PutValHere(QPlainTextEdit *plainTextEdit, QListWidget *listWidget)
|
void DialogTool::PutValHere(QPlainTextEdit *plainTextEdit, QListWidget *listWidget)
|
||||||
|
@ -359,12 +360,13 @@ void DialogTool::PutValHere(QPlainTextEdit *plainTextEdit, QListWidget *listWidg
|
||||||
SCASSERT(plainTextEdit != nullptr);
|
SCASSERT(plainTextEdit != nullptr);
|
||||||
SCASSERT(listWidget != nullptr);
|
SCASSERT(listWidget != nullptr);
|
||||||
QListWidgetItem *item = listWidget->currentItem();
|
QListWidgetItem *item = listWidget->currentItem();
|
||||||
SCASSERT(item != nullptr);
|
if (item != nullptr)
|
||||||
|
{
|
||||||
QTextCursor cursor = plainTextEdit->textCursor();
|
QTextCursor cursor = plainTextEdit->textCursor();
|
||||||
cursor.insertText(item->text());
|
cursor.insertText(item->text());
|
||||||
plainTextEdit->setTextCursor(cursor);
|
plainTextEdit->setTextCursor(cursor);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user