2001-03-23 22:07:56 +00:00
|
|
|
/**
|
2001-08-23 21:21:50 +00:00
|
|
|
* \file Qt2BC.C
|
2002-09-24 13:57:09 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2001-03-23 22:07:56 +00:00
|
|
|
*
|
2002-10-20 01:48:28 +00:00
|
|
|
* \author Allan Rae
|
|
|
|
* \author Angus Leeming
|
2002-09-24 13:57:09 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS
|
2001-03-23 22:07:56 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2001-08-23 21:21:50 +00:00
|
|
|
#include "Qt2BC.h"
|
2001-08-25 03:00:19 +00:00
|
|
|
#include "debug.h"
|
2002-12-17 20:37:13 +00:00
|
|
|
#include "qt_helpers.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
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2003-03-10 03:13:28 +00:00
|
|
|
Qt2BC::Qt2BC(ButtonController const & parent,
|
|
|
|
string const & cancel, string const & close)
|
|
|
|
: GuiBC<QButton, QWidget>(parent, cancel, close)
|
2001-03-23 22:07:56 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
|
2003-03-14 00:20:42 +00:00
|
|
|
void Qt2BC::setButtonEnabled(QButton * obj, bool enabled) const
|
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
|
|
|
|
2003-03-14 00:20:42 +00:00
|
|
|
void Qt2BC::setWidgetEnabled(QWidget * obj, bool enabled) const
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-03-14 00:20:42 +00:00
|
|
|
void Qt2BC::setButtonLabel(QButton * obj, string const & label) const
|
2001-06-16 14:48:12 +00:00
|
|
|
{
|
2002-12-17 20:37:13 +00:00
|
|
|
obj->setText(toqstr(label));
|
2001-03-23 22:07:56 +00:00
|
|
|
}
|