Unsolved how can i know whether i click in the region of the UpDownArrow buttons of QDoubleSpinbox or the edit region of the rest area of QDoubleSpinbox ?
-
how can i know whether i click in the region of the UpDownArrow buttons of QDoubleSpinbox or the edit region of the rest area of QDoubleSpinbox ?
-
Hi,
please tell what you want to achieve to prevent an x-y problem.
-Michael. -
void MyDoubleSpinBox::mousePressEvent(QMouseEvent* event) { QDoubleSpinBox::mousePressEvent(event); QStyleOptionSpinBox opt; this->initStyleOption(&opt); const QStyle* style = this->style(); const QPoint pos = event->pos(); if( style->subControlRect(QStyle::CC_SpinBox,&opt,QStyle::SC_SpinBoxUp).contains(pos) ) //upButton pressed else if( style->subControlRect(QStyle::CC_SpinBox,&opt,QStyle::SC_SpinBoxDown).contains(pos) ) // downButton pressed else if( style->subControlRect(QStyle::CC_SpinBox,&opt,QStyle::SC_SpinBoxEditField).contains(pos) ) // editfield pressed }