3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
7 * \author Angus Leeming
9 * Full author contact details are available in file CREDITS.
15 #include "qt_helpers.h"
17 #include <QPushButton>
25 Qt2BC::Qt2BC(ButtonController const & parent,
26 docstring const & cancel, docstring const & close)
27 : GuiBC<QPushButton, QWidget>(parent, cancel, close)
31 void Qt2BC::setButtonEnabled(QPushButton * obj, bool enabled) const
33 obj->setEnabled(enabled);
37 void Qt2BC::setWidgetEnabled(QWidget * obj, bool enabled) const
39 // yuck, rtti, but the user comes first
40 if (obj->inherits("QLineEdit")) {
41 QLineEdit * le(static_cast<QLineEdit*>(obj));
42 le->setReadOnly(!enabled);
44 obj->setEnabled(enabled);
47 Qt::FocusPolicy const p =
48 (enabled) ? Qt::StrongFocus : Qt::NoFocus;
49 obj->setFocusPolicy(p);
53 void Qt2BC::setButtonLabel(QPushButton * obj, docstring const & label) const
55 obj->setText(toqstr(label));
58 } // namespace frontend