Exemplo n.º 1
0
QWidget * PrefsDialog::createZoomerForm() {
	QGroupBox * zoomer = new QGroupBox(tr("Mouse Wheel Behavior"), this );

	QHBoxLayout * zhlayout = new QHBoxLayout();
	zhlayout->setSpacing(SPACING);

    QFrame * frame = new QFrame();
    frame->setFixedWidth(FORMLABELWIDTH);

    QVBoxLayout * vLayout = new QVBoxLayout();
    vLayout->setSpacing(0);
    vLayout->setMargin(0);

    for (int i = 0; i < 3; i++) {
	    m_wheelLabel[i] = new QLabel();
        vLayout->addWidget(m_wheelLabel[i]);
    }

	updateWheelText();

    frame->setLayout(vLayout);
	zhlayout->addWidget(frame);

	QPushButton * pushButton = new QPushButton(tr("Change Wheel Behavior"), this);
	connect(pushButton, SIGNAL(clicked()), this, SLOT(changeWheelBehavior()));
	zhlayout->addWidget(pushButton);

	zoomer->setLayout(zhlayout);

	return zoomer;
}
Exemplo n.º 2
0
void PrefsDialog::changeWheelBehavior() {
	if (++m_wheelMapping >= ZoomableGraphicsView::WheelMappingCount) {
		m_wheelMapping = 0;
	}

	m_settings.insert("wheelMapping", QString("%1").arg(m_wheelMapping));
	updateWheelText();
}