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