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"
18 #include <qlineedit.h>
23 Qt2BC::Qt2BC(ButtonController const & parent,
24 string const & cancel, string const & close)
25 : GuiBC<QButton, QWidget>(parent, cancel, close)
29 void Qt2BC::setButtonEnabled(QButton * obj, bool enabled) const
31 obj->setEnabled(enabled);
35 void Qt2BC::setWidgetEnabled(QWidget * obj, bool enabled) const
37 // yuck, rtti, but the user comes first
38 if (obj->inherits("QLineEdit")) {
39 QLineEdit * le(static_cast<QLineEdit*>(obj));
40 le->setReadOnly(!enabled);
42 obj->setEnabled(enabled);
45 QWidget::FocusPolicy const p =
46 (enabled) ? QWidget::StrongFocus : QWidget::NoFocus;
47 obj->setFocusPolicy(p);
51 void Qt2BC::setButtonLabel(QButton * obj, string const & label) const
53 obj->setText(toqstr(label));