]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/InsetParamsWidget.cpp
Migrate GuiLine to InsetParamsWidget.
[lyx.git] / src / frontends / qt4 / InsetParamsWidget.cpp
1 // -*- C++ -*-\r
2 /**\r
3  * \file InsetParamsWidget.cpp\r
4  * This file is part of LyX, the document processor.\r
5  * Licence details can be found in the file COPYING.\r
6  *\r
7  * \author Abdelrazak Younes\r
8  *\r
9  * Full author contact details are available in file CREDITS.\r
10  */\r
11 \r
12 #include <config.h>\r
13 \r
14 #include "InsetParamsWidget.h"\r
15 \r
16 #include "qt_helpers.h"\r
17 \r
18 #include <QLineEdit>\r
19 \r
20 namespace lyx {\r
21 \r
22 namespace frontend {\r
23 \r
24 CheckedWidget::CheckedWidget(QLineEdit * input, QWidget * label)\r
25         : input_(input), label_(label)\r
26 {\r
27 }\r
28 \r
29 \r
30 bool CheckedWidget::check() const\r
31 {\r
32         bool const valid = input_->hasAcceptableInput();\r
33         // Visual feedback.\r
34         setValid(input_, valid);\r
35         if (label_)\r
36                 setValid(label_, valid);\r
37         return valid;\r
38 }\r
39 \r
40 \r
41 \r
42 InsetParamsWidget::InsetParamsWidget(QWidget * parent) : QWidget(parent)\r
43 {\r
44 }\r
45 \r
46 \r
47 void InsetParamsWidget::addCheckedWidget(QLineEdit * input, QWidget * label)\r
48 {\r
49         checked_widgets_.append(CheckedWidget(input, label));\r
50 }\r
51 \r
52 \r
53 bool InsetParamsWidget::checkWidgets() const\r
54 {\r
55         bool valid = true;\r
56         Q_FOREACH(CheckedWidget const & le, checked_widgets_)\r
57                         valid &= le.check();\r
58         return valid;\r
59 }\r
60 \r
61 } // namespace frontend\r
62 } // namespace lyx\r
63 \r
64 #include "moc_InsetParamsWidget.cpp"\r