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
16 #include "qt_helpers.h"
19 #include <qlineedit.h>
22 Qt2BC::Qt2BC(ButtonController const & parent,
23 string const & cancel, string const & close)
24 : GuiBC<QButton, QWidget>(parent, cancel, close)
28 void Qt2BC::setButtonEnabled(QButton * obj, bool enabled) const
30 obj->setEnabled(enabled);
34 void Qt2BC::setWidgetEnabled(QWidget * obj, bool enabled) const
36 // yuck, rtti, but the user comes first
37 if (obj->inherits("QLineEdit")) {
38 QLineEdit * le(static_cast<QLineEdit*>(obj));
39 le->setReadOnly(!enabled);
41 obj->setEnabled(enabled);
44 QWidget::FocusPolicy const p =
45 (enabled) ? QWidget::StrongFocus : QWidget::NoFocus;
46 obj->setFocusPolicy(p);
50 void Qt2BC::setButtonLabel(QButton * obj, string const & label) const
52 obj->setText(toqstr(label));