{
InsetLabel const * label = static_cast<InsetLabel const *>(inset);
InsetCommandParams const & params = label->params();
- keywordED->setText(toqstr(params["name"]));
+ setKeyword(toqstr(params["name"]));
}
InsetCommandParams p(insetCode());
if (!InsetCommand::string2params(sdata, p))
return false;
- keywordED->setText(toqstr(p["name"]));
+ setKeyword(toqstr(p["name"]));
return true;
}
return !keywordED->text().isEmpty();
}
+
+void GuiLabel::setKeyword(QString const & keyword)
+{
+ keywordED->setText(keyword);
+ // select without prefix
+ int const colonPos = keyword.indexOf(':');
+ if (colonPos == -1)
+ keywordED->selectAll();
+ else
+ keywordED->setSelection(colonPos + 1, keyword.length() - colonPos + 1);
+}
+
} // namespace frontend
} // namespace lyx
docstring dialogToParams() const override;
bool checkWidgets(bool readonly) const override;
bool initialiseParams(std::string const &) override;
+ ///
+ void setKeyword(QString const & keyword);
//@}
};