3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
15 #include "qt_helpers.h"
17 #include "insets/InsetLabel.h"
20 #include <QPushButton>
28 /////////////////////////////////////////////////////////////////
32 /////////////////////////////////////////////////////////////////
34 GuiLabel::GuiLabel(QWidget * parent) : InsetParamsWidget(parent)
38 connect(keywordED, SIGNAL(textChanged(const QString &)),
39 this, SIGNAL(changed()));
41 setFocusProxy(keywordED);
45 void GuiLabel::paramsToDialog(Inset const * inset)
47 InsetLabel const * label = static_cast<InsetLabel const *>(inset);
48 InsetCommandParams const & params = label->params();
49 keywordED->setText(toqstr(params["name"]));
53 docstring GuiLabel::dialogToParams() const
55 InsetCommandParams params(insetCode());
56 params["name"] = qstring_to_ucs4(keywordED->text());
57 return from_utf8(InsetLabel::params2string(params));
61 bool GuiLabel::initialiseParams(std::string const & data)
63 InsetCommandParams p(insetCode());
64 if (!InsetCommand::string2params(data, p))
66 keywordED->setText(toqstr(p["name"]));
71 bool GuiLabel::checkWidgets() const
73 if (!InsetParamsWidget::checkWidgets())
75 return !keywordED->text().isEmpty();
78 } // namespace frontend
81 #include "moc_GuiLabel.cpp"