]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiLabel.cpp
6d9ee79daee40e912f591210b08bc146d1655f68
[lyx.git] / src / frontends / qt4 / GuiLabel.cpp
1 /**
2  * \file GuiLabel.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author John Levon
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "GuiLabel.h"
14
15 #include "qt_helpers.h"
16
17 #include "insets/InsetLabel.h"
18
19 #include <QLabel>
20 #include <QPushButton>
21 #include <QLineEdit>
22
23 using namespace std;
24
25 namespace lyx {
26 namespace frontend {
27
28 /////////////////////////////////////////////////////////////////
29 //
30 // GuiLabel
31 //
32 /////////////////////////////////////////////////////////////////
33
34 GuiLabel::GuiLabel(QWidget * parent) : InsetParamsWidget(parent)
35 {
36         setupUi(this);
37
38         connect(keywordED, SIGNAL(textChanged(const QString &)),
39                 this, SIGNAL(changed()));
40
41         setFocusProxy(keywordED);
42 }
43
44
45 void GuiLabel::paramsToDialog(Inset const * inset)
46 {
47         InsetLabel const * label = static_cast<InsetLabel const *>(inset);
48         InsetCommandParams const & params = label->params();
49         keywordED->setText(toqstr(params["name"]));
50 }
51
52
53 docstring GuiLabel::dialogToParams() const
54 {
55         InsetCommandParams params(insetCode());
56         params["name"] = qstring_to_ucs4(keywordED->text());
57         return from_ascii(InsetLabel::params2string("label", params));
58 }
59
60
61 bool GuiLabel::checkWidgets() const
62 {
63         if (!InsetParamsWidget::checkWidgets())
64                 return false;
65         return !keywordED->text().isEmpty();
66 }
67
68 } // namespace frontend
69 } // namespace lyx
70
71 #include "moc_GuiLabel.cpp"