]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/Qt2BC.cpp
* src/frontends/qt4/ui/TextLayoutUi.ui:
[lyx.git] / src / frontends / qt4 / Qt2BC.cpp
1 /**
2  * \file Qt2BC.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Allan Rae
7  * \author Angus Leeming
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #include <config.h>
13
14 #include "Qt2BC.h"
15 #include "qt_helpers.h"
16
17 #include <QPushButton>
18 #include <QLineEdit>
19
20 namespace lyx {
21 namespace frontend {
22
23 Qt2BC::Qt2BC(ButtonController const & parent,
24              docstring const & cancel, docstring const & close)
25         : GuiBC<QPushButton, QWidget>(parent, cancel, close)
26 {}
27
28
29 void Qt2BC::setButtonEnabled(QPushButton * obj, bool enabled) const
30 {
31         obj->setEnabled(enabled);
32 }
33
34
35 void Qt2BC::setWidgetEnabled(QWidget * obj, bool enabled) const
36 {
37         // yuck, rtti, but the user comes first
38         if (QLineEdit * le = qobject_cast<QLineEdit*>(obj))
39                 le->setReadOnly(!enabled);
40         else
41                 obj->setEnabled(enabled);
42
43         obj->setFocusPolicy(enabled ? Qt::StrongFocus : Qt::NoFocus);
44 }
45
46
47 void Qt2BC::setButtonLabel(QPushButton * obj, docstring const & label) const
48 {
49         obj->setText(toqstr(label));
50 }
51
52 } // namespace frontend
53 } // namespace lyx