forked from openkylin/qt5-ukui-platformtheme
slider vertical状态响应鼠标中间键方向问题处理 scrollbar也存在这个问题修改
This commit is contained in:
parent
c19bd0a2dc
commit
f3741d9638
|
@ -598,7 +598,8 @@
|
|||
},
|
||||
"UseButtonPalette":{
|
||||
"DefaultBrush" : {"value": "Button_at", "type": "paletterole"},
|
||||
"HoverBrush" : {"type": "gradient"},
|
||||
"HoverBrush" : {"value": "95, 95, 95 ~ 65, 65, 65", "type": "gradient"},
|
||||
"ClickBrush" : {"value": "95, 95, 95", "type": "color"},
|
||||
"DisableBrush" : {"value": "Button_dis", "type": "paletterole"},
|
||||
"TextColor" : {"value": "BrightText_at", "type": "paletterole"},
|
||||
"TextHoverColor" : {"value": "BrightText_at", "type": "paletterole"},
|
||||
|
|
|
@ -383,7 +383,7 @@ bool UKUIConfigStyle::eventFilter(QObject *obj, QEvent *e)
|
|||
|
||||
if((e->type() ==QEvent::MouseButtonPress || e->type() == QEvent::MouseButtonDblClick) && (proxy()->styleHint(QStyle::SH_Slider_AbsoluteSetButtons) == mousePressEvent->button() ||
|
||||
proxy()->styleHint(QStyle::SH_Slider_PageSetButtons) == mousePressEvent->button())){
|
||||
//qDebug() << "e->type:" << e->type() << mousePressEvent->button();
|
||||
// qDebug() << "e->type:" << e->type() << mousePressEvent->button();
|
||||
if(obj->property("animation").isValid() && !obj->property("animation").toBool())
|
||||
return false;
|
||||
|
||||
|
@ -412,6 +412,8 @@ bool UKUIConfigStyle::eventFilter(QObject *obj, QEvent *e)
|
|||
|
||||
QRect handleRect = sliderHandleRec();
|
||||
if(horizontal){
|
||||
// qDebug() << "mousepressevent1111 pos...." << mousePressEvent->pos().x() << handleRect.x();
|
||||
|
||||
if(mousePressEvent->pos().x() <= handleRect.x()){
|
||||
animator->setExtraProperty("addValue", false);
|
||||
|
||||
|
@ -423,6 +425,7 @@ bool UKUIConfigStyle::eventFilter(QObject *obj, QEvent *e)
|
|||
return false;
|
||||
}
|
||||
else{
|
||||
// qDebug() << "mousepressevent1111 pos...." << mousePressEvent->pos().y() << handleRect.y();
|
||||
if(mousePressEvent->pos().y() <= handleRect.y()){
|
||||
animator->setExtraProperty("addValue", true);
|
||||
|
||||
|
@ -459,15 +462,19 @@ bool UKUIConfigStyle::eventFilter(QObject *obj, QEvent *e)
|
|||
sliderMin = gr.x();
|
||||
sliderMax = gr.right() - sliderLength + 1;
|
||||
pos = (mousePressEvent->pos() - center).x();
|
||||
// qDebug() << "pos....:" << mousePressEvent->pos() << center << pos;
|
||||
// qDebug() << "Horizontal pos....:" << mousePressEvent->pos() << center << pos;
|
||||
} else {
|
||||
sliderLength = sr.height();
|
||||
sliderMin = gr.y();
|
||||
sliderMax = gr.bottom() - sliderLength + 1;
|
||||
pos = (mousePressEvent->pos() - center).y();
|
||||
// qDebug() << "vertical pos....:" << mousePressEvent->pos() << center << pos;
|
||||
}
|
||||
// qDebug() << "minumum..." << slider->minimum() << slider->maximum() << sliderMin << sliderMax << pos;
|
||||
int sliderValue = sliderValueFromPosition(slider->minimum(), slider->maximum(), pos - sliderMin, sliderMax - sliderMin, opt->upsideDown);
|
||||
// qDebug() << "minumum..." << slider->minimum() << slider->maximum() << sliderMin << sliderMax << pos << opt->upsideDown;
|
||||
bool upsideDown = (slider->orientation() == Qt::Horizontal) ?
|
||||
(slider->invertedAppearance() != (slider->layoutDirection() == Qt::RightToLeft))
|
||||
: (!slider->invertedAppearance());
|
||||
int sliderValue = sliderValueFromPosition(slider->minimum(), slider->maximum(), pos - sliderMin, sliderMax - sliderMin, upsideDown);//opt->upsideDown);
|
||||
// qDebug() << "sliderValue....." << sliderValue << slider->value();
|
||||
step = sliderValue - slider->value();
|
||||
// qDebug() << "step0000...." << step;
|
||||
|
@ -527,11 +534,11 @@ bool UKUIConfigStyle::eventFilter(QObject *obj, QEvent *e)
|
|||
|
||||
if(horizontal){
|
||||
if(mousePressEvent->pos().x() <= scrollbarSliderRec().x()){
|
||||
animator->setExtraProperty("addValue", scrollbar->layoutDirection() == Qt::RightToLeft ? true : false);
|
||||
animator->setExtraProperty("addValue", /*scrollbar->layoutDirection() == Qt::RightToLeft ? true :*/ false);
|
||||
|
||||
}
|
||||
else if(mousePressEvent->pos().x() >= scrollbarSliderRec().x() + scrollbarSliderRec().width()){
|
||||
animator->setExtraProperty("addValue", scrollbar->layoutDirection() == Qt::RightToLeft ? false : true);
|
||||
animator->setExtraProperty("addValue", /*scrollbar->layoutDirection() == Qt::RightToLeft ? false :*/ true);
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
@ -597,9 +604,12 @@ bool UKUIConfigStyle::eventFilter(QObject *obj, QEvent *e)
|
|||
|
||||
}
|
||||
|
||||
bool upsideDown = scrollbar->invertedAppearance();
|
||||
// if(scrollbar->layoutDirection() == Qt::RightToLeft && scrollbar->orientation() == Qt::Horizontal)
|
||||
// upsideDown = !upsideDown;
|
||||
// qDebug() << "minimum..." << scrollbar->minimum() << scrollbar->maximum() << pos << sliderMin << sliderMax;
|
||||
int scrollValue = sliderValueFromPosition(scrollbar->minimum(), scrollbar->maximum(), pos - sliderMin,
|
||||
sliderMax - sliderMin, opt->upsideDown);
|
||||
sliderMax - sliderMin, upsideDown);//opt->upsideDown);
|
||||
// qDebug() << "scrollValue....." << scrollValue << scrollbar->value();
|
||||
step = scrollValue - scrollbar->value();
|
||||
// qDebug() << "step0000...." << step;
|
||||
|
|
Loading…
Reference in New Issue