]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/InsetParamsWidget.cpp
Fix the tab ordering of GuiDocument components.
[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         bool const valid = input_->hasAcceptableInput();
33         // Visual feedback.
34         setValid(input_, valid);
35         if (label_)
36                 setValid(label_, valid);
37         return valid;
38 }
39
40
41
42 InsetParamsWidget::InsetParamsWidget(QWidget * parent) : QWidget(parent)
43 {
44 }
45
46
47 void InsetParamsWidget::addCheckedWidget(QLineEdit * input, QWidget * label)
48 {
49         checked_widgets_.append(CheckedWidget(input, label));
50 }
51
52
53 bool InsetParamsWidget::checkWidgets() const
54 {
55         bool valid = true;
56         Q_FOREACH(CheckedWidget const & le, checked_widgets_)
57                         valid &= le.check();
58         return valid;
59 }
60
61 } // namespace frontend
62 } // namespace lyx
63
64 #include "moc_InsetParamsWidget.cpp"