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 "support/debug.h"
16 #include "qt_helpers.h"
19 #include <QPushButton>
21 #include <QCloseEvent>
28 /////////////////////////////////////////////////////////////////
30 // Base implementation
32 /////////////////////////////////////////////////////////////////
34 GuiLabel::GuiLabel(GuiView & lv)
35 : GuiCommand(lv, "label", qt_("Label"))
39 connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
40 connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
41 connect(keywordED, SIGNAL(textChanged(const QString &)),
42 this, SLOT(change_adaptor()));
44 setFocusProxy(keywordED);
46 bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
48 bc().setCancel(closePB);
49 bc().addReadOnly(keywordED);
53 void GuiLabel::change_adaptor()
59 void GuiLabel::reject()
65 void GuiLabel::closeEvent(QCloseEvent * e)
72 void GuiLabel::updateContents()
74 docstring const contents = params_["name"];
75 keywordED->setText(toqstr(contents));
76 bc().setValid(!contents.empty());
80 void GuiLabel::applyView()
82 params_["name"] = qstring_to_ucs4(keywordED->text());
86 bool GuiLabel::isValid()
88 return !keywordED->text().isEmpty();
92 Dialog * createGuiLabel(GuiView & lv) { return new GuiLabel(lv); }
95 } // namespace frontend
98 #include "GuiLabel_moc.cpp"