2006-03-05 17:24:44 +00:00
|
|
|
/**
|
|
|
|
* \file Qt2BC.C
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Allan Rae
|
|
|
|
* \author Angus Leeming
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include "Qt2BC.h"
|
|
|
|
#include "qt_helpers.h"
|
|
|
|
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QLineEdit>
|
|
|
|
|
2006-10-09 13:28:32 +00:00
|
|
|
using lyx::docstring;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
|
|
|
Qt2BC::Qt2BC(ButtonController const & parent,
|
2006-10-09 13:28:32 +00:00
|
|
|
docstring const & cancel, docstring const & close)
|
2006-03-05 17:24:44 +00:00
|
|
|
: GuiBC<QPushButton, QWidget>(parent, cancel, close)
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
void Qt2BC::setButtonEnabled(QPushButton * obj, bool enabled) const
|
|
|
|
{
|
|
|
|
obj->setEnabled(enabled);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Qt2BC::setWidgetEnabled(QWidget * obj, bool enabled) const
|
|
|
|
{
|
|
|
|
// yuck, rtti, but the user comes first
|
|
|
|
if (obj->inherits("QLineEdit")) {
|
|
|
|
QLineEdit * le(static_cast<QLineEdit*>(obj));
|
|
|
|
le->setReadOnly(!enabled);
|
|
|
|
} else {
|
|
|
|
obj->setEnabled(enabled);
|
|
|
|
}
|
|
|
|
|
|
|
|
Qt::FocusPolicy const p =
|
|
|
|
(enabled) ? Qt::StrongFocus : Qt::NoFocus;
|
|
|
|
obj->setFocusPolicy(p);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-10-09 13:28:32 +00:00
|
|
|
void Qt2BC::setButtonLabel(QPushButton * obj, docstring const & label) const
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
|
|
|
obj->setText(toqstr(label));
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|