2001-03-23 22:07:56 +00:00
|
|
|
/**
|
2001-08-23 21:21:50 +00:00
|
|
|
* \file Qt2BC.C
|
2001-03-23 22:07:56 +00:00
|
|
|
* Copyright 2001 the LyX Team
|
|
|
|
* Read the file COPYING
|
|
|
|
*
|
|
|
|
* \author Allan Rae <rae@lyx.org>
|
|
|
|
* \author Angus Leeming <a.leeming@ic.ac.uk>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
2001-08-23 21:21:50 +00:00
|
|
|
#include "Qt2BC.h"
|
2001-08-25 03:00:19 +00:00
|
|
|
#include "debug.h"
|
2001-03-23 22:07:56 +00:00
|
|
|
|
|
|
|
#include <qbutton.h>
|
2001-08-25 20:04:15 +00:00
|
|
|
#include <qlineedit.h>
|
2001-03-23 22:07:56 +00:00
|
|
|
|
2001-08-23 21:21:50 +00:00
|
|
|
Qt2BC::Qt2BC(string const & cancel, string const & close)
|
2001-06-16 14:48:12 +00:00
|
|
|
: GuiBC<QButton, QWidget>(cancel, close)
|
2001-03-23 22:07:56 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
|
2001-08-23 21:21:50 +00:00
|
|
|
void Qt2BC::setButtonEnabled(QButton * obj, bool enabled)
|
2001-03-23 22:07:56 +00:00
|
|
|
{
|
2001-06-16 14:48:12 +00:00
|
|
|
obj->setEnabled(enabled);
|
|
|
|
}
|
|
|
|
|
2001-03-23 22:07:56 +00:00
|
|
|
|
2001-08-23 21:21:50 +00:00
|
|
|
void Qt2BC::setWidgetEnabled(QWidget * obj, bool enabled)
|
2001-06-16 14:48:12 +00:00
|
|
|
{
|
2001-08-25 20:04:15 +00:00
|
|
|
// yuck, rtti, but the user comes first
|
|
|
|
if (obj->inherits("QLineEdit")) {
|
2002-03-21 21:21:28 +00:00
|
|
|
QLineEdit * le(static_cast<QLineEdit*>(obj));
|
2001-08-26 01:01:12 +00:00
|
|
|
le->setReadOnly(!enabled);
|
2001-08-25 20:04:15 +00:00
|
|
|
} else {
|
|
|
|
obj->setEnabled(enabled);
|
|
|
|
}
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2001-08-23 21:21:50 +00:00
|
|
|
QWidget::FocusPolicy const p =
|
2002-03-21 21:21:28 +00:00
|
|
|
(enabled) ? QWidget::StrongFocus : QWidget::NoFocus;
|
2001-08-23 21:21:50 +00:00
|
|
|
obj->setFocusPolicy(p);
|
2001-06-16 14:48:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-08-23 21:21:50 +00:00
|
|
|
void Qt2BC::setButtonLabel(QButton * obj, string const & label)
|
2001-06-16 14:48:12 +00:00
|
|
|
{
|
|
|
|
obj->setText(label.c_str());
|
2001-03-23 22:07:56 +00:00
|
|
|
}
|