3 * Copyright 2001 the LyX Team
4 * Read the file COPYING
6 * \author Allan Rae <rae@lyx.org>
7 * \author Angus Leeming <a.leeming@ic.ac.uk>
13 #pragma implementation
20 #include <qlineedit.h>
22 Qt2BC::Qt2BC(string const & cancel, string const & close)
23 : GuiBC<QButton, QWidget>(cancel, close)
27 void Qt2BC::setButtonEnabled(QButton * obj, bool enabled)
29 lyxerr << "Qt2BC: setting button "
30 << obj << " to " << enabled << std::endl;
32 obj->setEnabled(enabled);
36 void Qt2BC::setWidgetEnabled(QWidget * obj, bool enabled)
38 // yuck, rtti, but the user comes first
39 if (obj->inherits("QLineEdit")) {
40 QLineEdit * le(static_cast<QLineEdit*>(obj));
41 le->setReadOnly(enabled);
43 obj->setEnabled(enabled);
46 QWidget::FocusPolicy const p =
47 (enabled) ? QWidget::StrongFocus : QWidget::NoFocus;
48 obj->setFocusPolicy(p);
52 void Qt2BC::setButtonLabel(QButton * obj, string const & label)
54 obj->setText(label.c_str());