[Qt-interest] QSpinBox subclassing + mouseMoveEvent override
Jakub Stasiak
kuba.stasiak at gmail.com
Wed Jun 17 20:27:30 CEST 2009
Hello
I'm currently trying to subclass QSpinBox and rewrite code regarding
mouseMoveEvent
method. And I encountered some problem, because I want to not use
QSpinBox::mouseMoveEvent (event) inside it, but actually do something.
First thing I've done
is copy code from QAbstractSpinBox::mouseMoveEvent, which is:
Q_D(QSpinBox);
d->updateHoverControl(event->pos());
// If we have a timer ID, update the state
if (d->spinClickTimerId != -1 && d->buttonSymbols != NoButtons) {
const StepEnabled se = stepEnabled();
if ((se & StepUpEnabled) && d->hoverControl == QStyle::SC_SpinBoxUp)
d->updateState(true);
else if ((se & StepDownEnabled) && d->hoverControl ==
QStyle::SC_SpinBoxDown)
d->updateState(false);
else
d->reset();
event->accept();
}
Note: changed Q_D(QAbstractSpinBox) to QSpinBox.
Of course (as I expected :)) can't compile it:
/usr/include/qt4/QtGui/qspinbox.h: In member function ‘virtual void
SpinBox::mouseMoveEvent(QMouseEvent*)’:
/usr/include/qt4/QtGui/qspinbox.h:122: error: ‘QSpinBoxPrivate*
QSpinBox::d_func()’ is private
SpinBox.cpp:9: error: within this context
As far as I am familiar with using Qt in my programs this is first
time trying to do something
like this... Any sugestions? :)
Greetings,
Jakub Stasiak
More information about the Qt-interest-old
mailing list