2006-03-05 17:24:44 +00:00
|
|
|
/**
|
2007-04-26 03:53:02 +00:00
|
|
|
* \file Qt2BC.cpp
|
2006-03-05 17:24:44 +00:00
|
|
|
* 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>
|
|
|
|
|
|
|
|
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
|
2007-04-25 16:39:21 +00:00
|
|
|
if (QLineEdit * le = qobject_cast<QLineEdit*>(obj))
|
2006-03-05 17:24:44 +00:00
|
|
|
le->setReadOnly(!enabled);
|
2007-04-25 16:39:21 +00:00
|
|
|
else
|
2006-03-05 17:24:44 +00:00
|
|
|
obj->setEnabled(enabled);
|
|
|
|
|
2007-04-25 16:39:21 +00:00
|
|
|
obj->setFocusPolicy(enabled ? Qt::StrongFocus : Qt::NoFocus);
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
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
|