Commit f85c6efc authored by hjk's avatar hjk

Debugger: Consolidate watcher insertion code paths

All were targeting the same running engine, doing the same thing.

Change-Id: If1186f6467cde6b44a051ea5845d4528917ca8f9
Reviewed-by: David Schulz's avatarDavid Schulz <david.schulz@qt.io>
parent 83e51677
......@@ -428,8 +428,6 @@ public:
QString editorContents(const QModelIndexList &list = QModelIndexList());
void clearWatches();
void removeWatchItem(WatchItem *item);
void watchExpression(const QString &exp);
void watchExpression(const QString &exp, const QString &name);
void inputNewExpression();
public:
......@@ -1095,7 +1093,7 @@ bool WatchModel::setData(const QModelIndex &idx, const QVariant &value, int role
if (item && kev->key() == Qt::Key_Return
&& kev->modifiers() == Qt::ControlModifier
&& item->isLocal()) {
watchExpression(item->expression());
m_handler->watchExpression(item->expression(), QString());
return true;
}
}
......@@ -1531,16 +1529,6 @@ static QString removeWatchActionText(QString exp)
.arg(exp.replace('&', "&&"));
}
void WatchModel::watchExpression(const QString &exp)
{
watchExpression(exp, QString());
}
void WatchModel::watchExpression(const QString &exp, const QString &name)
{
currentEngine()->watchHandler()->watchExpression(exp, name);
}
static void copyToClipboard(const QString &clipboardText)
{
QClipboard *clipboard = QApplication::clipboard();
......@@ -1582,11 +1570,8 @@ void WatchModel::inputNewExpression()
connect(hint, &QLabel::linkActivated, [](const QString &link) {
HelpManager::handleHelpRequest(link); });
if (dlg.exec() == QDialog::Accepted) {
const QString exp = lineEdit->text().trimmed();
if (!exp.isEmpty())
m_handler->watchExpression(exp, exp);
}
if (dlg.exec() == QDialog::Accepted)
m_handler->watchExpression(lineEdit->text().trimmed());
}
bool WatchModel::contextMenuEvent(const ItemViewEvent &ev)
......@@ -2096,6 +2081,7 @@ QString WatchHandler::watcherName(const QString &exp)
return "watch." + QString::number(theWatcherNames[exp]);
}
// If \a name is empty, \a exp will be used as name.
void WatchHandler::watchExpression(const QString &exp, const QString &name)
{
// Do not insert the same entry more then once.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment