예제 #1
0
	void CodeSpinBox::contextMenuEvent(QContextMenuEvent *event)
	{
		QMenu *menu = codeLineEdit()->createStandardContextMenu();

		menu->addSeparator();

		const uint se = stepEnabled();

		QAction *up = menu->addAction(tr("&Step up"));
		up->setShortcut(QKeySequence(Qt::Key_Up));
		up->setEnabled(se & StepUpEnabled);

		QAction *down = menu->addAction(tr("Step &down"));
		down->setShortcut(QKeySequence(Qt::Key_Down));
		down->setEnabled(se & StepDownEnabled);

		menu->addSeparator();

		codeLineEdit()->addShortcuts(menu);

		const QAction *action = menu->exec(event->globalPos());

		if(action == up)
			stepBy(1);
		else if(action == down)
			stepBy(-1);

		delete menu;

		event->accept();
	}
예제 #2
0
void SpinBox::keyPressEvent(QKeyEvent *event)
{
    int steps = 1;

    if ((event->key() >= Qt::Key_0) && (event->key() <= Qt::Key_9))
        return;
    if ((event->key() >= Qt::Key_A) && (event->key() <= Qt::Key_Z))
        return;

    switch (event->key()) {
    case Qt::Key_Left:
        focusPreviousChild();
        break;
    case Qt::Key_Right:
        focusNextChild();
        break;
    case Qt::Key_F2:
    case Qt::Key_F4: {
        event->accept();
        const bool up = (event->key() == Qt::Key_F2);
        if (!(stepEnabled() & (up ? StepUpEnabled : StepDownEnabled)))
            return;
        if (!up)
            steps *= -1;
        stepBy(steps);
        return;
    }
    default:
        QSpinBox::keyPressEvent(event);
    }
}
예제 #3
0
int  QDateEdit_QtDShell::__override_stepEnabled(bool static_call) const
{
    if (static_call) {
        return QDateTimeEdit::stepEnabled();
    } else {
        return stepEnabled();
    }
}
예제 #4
0
void SpinBox::initStyleOption(QStyleOptionSpinBox& so) const
{
	so.init(this);
//	so.activeSubControls = ??;
	so.subControls   = mUpDownOnly ? QStyle::SC_SpinBoxUp | QStyle::SC_SpinBoxDown | QStyle::SC_SpinBoxFrame
	                               : QStyle::SC_SpinBoxUp | QStyle::SC_SpinBoxDown | QStyle::SC_SpinBoxFrame | QStyle::SC_SpinBoxEditField;
	so.buttonSymbols = buttonSymbols();
	so.frame         = hasFrame();
	so.stepEnabled   = stepEnabled();
}
void DAVAFloat32SpinBox::paintEvent(QPaintEvent *event)
{
	QStyleOptionSpinBox opt;
	initStyleOption(&opt);

	// draw buttons disabled if they are
	opt.stepEnabled = stepEnabled();

	QStylePainter p(this);
	p.drawComplexControl(QStyle::CC_SpinBox, opt);
}
예제 #6
0
QAbstractSpinBox::StepEnabled DhQAbstractSpinBox::DvhstepEnabled() const {
  return stepEnabled();
}