You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mathemagics/mathemagics/stacklevel.cpp

48 lines
1.0 KiB

#include <qlineedit.h>
#include <qpushbutton.h>
#include <qstring.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <kdialog.h>
#include <klocale.h>
#include "stacklevel.h"
StackLevel::StackLevel(int id, QWidget *parent, const char *name)
: QHBox(parent, name)
{
setSpacing(KDialog::spacingHint());
this->id = id;
m_edit = new QLineEdit(this);
QToolTip::add(m_edit, i18n("Stack level %1").arg(QString::number(id)));
connect(m_edit, SIGNAL(returnPressed()), this, SLOT(emitEdit()));
m_button = new QPushButton(this);
QWhatsThis::add(m_button, i18n("Roll from stack level %1").arg(QString::number(id)));
QToolTip::add(m_button, i18n("Roll\nShifted: Roll down"));
m_button->setText(QString::number(id));
connect(m_button, SIGNAL(clicked()), this, SLOT(emitButton()));
}
void StackLevel::emitButton()
{
emit buttonPressed(id);
}
void StackLevel::emitEdit()
{
emit returnPressed(id);
}
void StackLevel::setEnabled(bool enabled)
{
QHBox::setEnabled(enabled);
m_edit->setEnabled(enabled);
m_button->setEnabled(enabled);
}
#include "stacklevel.moc"