forked from openkylin/qt5-ukui-platformtheme
优化sliderbar动效(在步长为1的情况下) 根据控件是否设置动效属性来加载动效,不能使用共用的变量来判断
This commit is contained in:
parent
92128fc363
commit
95563ea198
|
@ -108,7 +108,7 @@ bool ConfigSliderAnimator::bindWidget(QWidget *w)
|
|||
m_silder_move_position->setStartValue(0.0);
|
||||
m_silder_move_position->setEndValue(1.0);
|
||||
m_silder_move_position->setDuration(150);
|
||||
m_silder_move_position->setEasingCurve(QEasingCurve::Linear);
|
||||
m_silder_move_position->setEasingCurve(QEasingCurve::InOutCubic);
|
||||
addAnimation(m_silder_move_position);
|
||||
|
||||
connect(m_slider_opacity, &QVariantAnimation::valueChanged, w, [=]() {
|
||||
|
|
|
@ -2285,9 +2285,6 @@ void UKUIConfigStyleParameters::initConfigTreeParameters(bool isDark, const QSty
|
|||
branchDisableBrush = disableBrush;
|
||||
|
||||
if (widget) {
|
||||
if (widget->property("animation").isValid())
|
||||
m_TreeParameters.animation = widget->property("animation").toBool();
|
||||
|
||||
if (widget->property("setRadius").isValid() && widget->property("setRadius").canConvert<int>()) {
|
||||
radius = widget->property("setRadius").value<int>();
|
||||
}
|
||||
|
@ -2643,9 +2640,6 @@ void UKUIConfigStyleParameters::initConfigCheckBoxParameters(bool isDark, const
|
|||
break;
|
||||
}
|
||||
|
||||
if (widget && widget->property("animation").isValid())
|
||||
m_CheckBoxParameters.animation = widget->property("animation").toBool();
|
||||
|
||||
m_CheckBoxParameters.checkBoxContentPen = contentPen;
|
||||
|
||||
if (widget) {
|
||||
|
@ -2895,9 +2889,6 @@ void UKUIConfigStyleParameters::initConfigRadioButtonParameters(bool isDark, con
|
|||
}
|
||||
}
|
||||
|
||||
if(widget && widget->property("animation").isValid())
|
||||
m_RadioButtonParameters.animation = widget->property("animation").toBool();
|
||||
|
||||
m_RadioButtonParameters.radioButtonDefaultPen = defaultPen;
|
||||
m_RadioButtonParameters.radioButtonHoverPen = hoverPen;
|
||||
m_RadioButtonParameters.radioButtonClickPen = clickPen;
|
||||
|
@ -3089,8 +3080,10 @@ void UKUIConfigStyleParameters::initConfigSliderParameters(bool isDark, const QS
|
|||
break;
|
||||
}
|
||||
|
||||
if (widget->property("animation").isValid())
|
||||
m_SliderParameters.animation = widget->property("animation").toBool();
|
||||
// if (widget->property("animation").isValid()){
|
||||
// qDebug() << "widget......" <<widget->objectName();
|
||||
// m_SliderParameters.animation = widget->property("animation").toBool();
|
||||
// }
|
||||
|
||||
if (widget) {
|
||||
if (widget->property("setGrooveRadius").isValid() && widget->property("setGrooveRadius").canConvert<int>()) {
|
||||
|
@ -3298,9 +3291,6 @@ void UKUIConfigStyleParameters::initConfigScrollBarParameters(bool isDark, const
|
|||
QBrush sliderClickBrush = scrollBarColorCfg.sliderClickBrush;
|
||||
QBrush sliderDisableBrush = scrollBarColorCfg.sliderDisableBrush;
|
||||
|
||||
if(widget->property("animation").isValid())
|
||||
m_ScrollBarParameters.animation = widget->property("animation").toBool();
|
||||
|
||||
QColor mix = option->palette.color(QPalette::Active, QPalette::BrightText);
|
||||
|
||||
const QStyleOptionSlider *bar = qstyleoption_cast<const QStyleOptionSlider *>(option);
|
||||
|
|
|
@ -389,8 +389,9 @@ bool UKUIConfigStyle::eventFilter(QObject *obj, QEvent *e)
|
|||
if(e->type() == QEvent::MouseButtonPress || e->type() == QEvent::MouseButtonDblClick){
|
||||
if(obj->property("animation").isValid() && !obj->property("animation").toBool())
|
||||
return false;
|
||||
if(!sp->m_SliderParameters.animation)
|
||||
return false;
|
||||
|
||||
// if(!sp->m_SliderParameters.animation)
|
||||
// return false;
|
||||
|
||||
auto *slider = qobject_cast<QSlider *>(obj);
|
||||
if(slider == nullptr || !slider->isEnabled())
|
||||
|
@ -407,8 +408,8 @@ bool UKUIConfigStyle::eventFilter(QObject *obj, QEvent *e)
|
|||
// if(mousePressEvent)
|
||||
// qDebug() << "mousepressevent....." << mousePressEvent->pos() << mousePressEvent->localPos() << slider->geometry();
|
||||
|
||||
QStyleOptionSlider *opt = new QStyleOptionSlider();
|
||||
opt->init(slider);
|
||||
// QStyleOptionSlider *opt = new QStyleOptionSlider();
|
||||
// opt->init(slider);
|
||||
// qDebug() << "pppppppp;;;;;;;;;:" << subControlRect(CC_Slider, opt, SC_SliderHandle, slider);
|
||||
|
||||
QRect handleRect = sliderHandleRec();
|
||||
|
@ -473,7 +474,7 @@ bool UKUIConfigStyle::eventFilter(QObject *obj, QEvent *e)
|
|||
|
||||
if(qobject_cast<QScrollBar*>(obj)){
|
||||
if(e->type() == QEvent::MouseButtonPress || e->type() == QEvent::MouseButtonDblClick){
|
||||
if(!sp->m_ScrollBarParameters.animation)
|
||||
if(obj->property("animation").isValid() && !obj->property("animation").toBool())
|
||||
return false;
|
||||
|
||||
auto *scrollbar = qobject_cast<QScrollBar *>(obj);
|
||||
|
@ -991,15 +992,14 @@ void UKUIConfigStyle::polish(QWidget *widget)
|
|||
|
||||
if(widget != nullptr && widget->inherits("QTreeView")){
|
||||
m_tree_animation_helper->registerWidget(widget);
|
||||
if(qobject_cast<QTreeView *>(widget)->isAnimated() && !widget->property("animation").isValid()){
|
||||
if(!qobject_cast<QTreeView *>(widget)->isAnimated() &&
|
||||
widget->property("animation").isValid() && !widget->property("animation").toBool()){
|
||||
qobject_cast<QTreeView *>(widget)->setAnimated(false);
|
||||
}
|
||||
else{
|
||||
widget->setProperty("animation", true);
|
||||
qobject_cast<QTreeView *>(widget)->setAnimated(true);
|
||||
}
|
||||
if(widget->property("animation").isValid()){
|
||||
sp->m_TreeParameters.animation = widget->property("animation").toBool();
|
||||
qobject_cast<QTreeView *>(widget)->setAnimated(sp->m_TreeParameters.animation);
|
||||
}
|
||||
else
|
||||
qobject_cast<QTreeView *>(widget)->setAnimated(sp->m_TreeParameters.animation);
|
||||
|
||||
auto tree = qobject_cast<QTreeView*>(widget);
|
||||
connect(tree, &QTreeView::expanded, this, [=](const QModelIndex &index){
|
||||
|
@ -2238,7 +2238,9 @@ void UKUIConfigStyle::drawPrimitive(QStyle::PrimitiveElement element, const QSty
|
|||
|
||||
auto animator = m_radiobutton_animation_helper->animator(widget);
|
||||
|
||||
if (enable && sp->m_RadioButtonParameters.animation &&
|
||||
bool hasAnimation = widget &&(!widget->property("animation").isValid() ||
|
||||
(widget->property("animation").isValid() && widget->property("animation").toBool()));
|
||||
if (enable && hasAnimation &&
|
||||
animator != nullptr && animator->isRunning("SunKenOn")) {
|
||||
float value = animator->value("SunKenOn").toFloat();
|
||||
QColor clickColor = sp->m_RadioButtonParameters.radioButtonClickBrush.color();
|
||||
|
@ -2275,7 +2277,7 @@ void UKUIConfigStyle::drawPrimitive(QStyle::PrimitiveElement element, const QSty
|
|||
painter->restore();
|
||||
return;
|
||||
}
|
||||
else if (enable && sp->m_RadioButtonParameters.animation &&
|
||||
else if (enable && hasAnimation &&
|
||||
animator != nullptr && animator->isRunning("Off")) {
|
||||
float value = animator->value("Off").toFloat();
|
||||
// qDebug() << "off SunKenOn value......" << qobject_cast<const QRadioButton *>(widget)->text() << value;
|
||||
|
@ -2304,7 +2306,7 @@ void UKUIConfigStyle::drawPrimitive(QStyle::PrimitiveElement element, const QSty
|
|||
if (enable) {
|
||||
if (on) {
|
||||
if (animator != nullptr) {
|
||||
if (sp->m_RadioButtonParameters.animation && !animator->isRunning("SunKenOn") ) {
|
||||
if (hasAnimation && !animator->isRunning("SunKenOn") ) {
|
||||
// qDebug() << "SunKenOn time....:" << qobject_cast<const QRadioButton *>(widget)->text() << animator->currentAnimatorTime("SunKenOn");
|
||||
if(animator->currentAnimatorTime("SunKenOn") == 0){
|
||||
animator->startAnimator("SunKenOn");
|
||||
|
@ -2341,7 +2343,7 @@ void UKUIConfigStyle::drawPrimitive(QStyle::PrimitiveElement element, const QSty
|
|||
painter->restore();
|
||||
return;
|
||||
} else {
|
||||
if (sp->m_RadioButtonParameters.animation && animator != nullptr) {
|
||||
if (hasAnimation && animator != nullptr) {
|
||||
if (!animator->isRunning("Off") && animator->currentAnimatorTime("SunKenOn") > 0 && animator->currentAnimatorTime("Off") == 0) {
|
||||
animator->startAnimator("Off");
|
||||
animator->setAnimatorCurrentTime("SunKenOn", 0);
|
||||
|
@ -2401,8 +2403,11 @@ void UKUIConfigStyle::drawPrimitive(QStyle::PrimitiveElement element, const QSty
|
|||
painter->setClipRect(rect);
|
||||
painter->setRenderHint(QPainter::Antialiasing, sp->m_CheckBoxParameters.radius != 0);
|
||||
|
||||
bool hasAnimation = widget &&(!widget->property("animation").isValid() ||
|
||||
(widget->property("animation").isValid() && widget->property("animation").toBool()));
|
||||
|
||||
auto animator = m_checkbox_animation_helper->animator(widget);
|
||||
if (sp->m_CheckBoxParameters.animation && animator != nullptr) {
|
||||
if (hasAnimation && animator != nullptr) {
|
||||
if(animator->isRunning("OnBase"))
|
||||
{
|
||||
float value = animator->value("OnBase").toFloat();
|
||||
|
@ -2450,7 +2455,7 @@ void UKUIConfigStyle::drawPrimitive(QStyle::PrimitiveElement element, const QSty
|
|||
|
||||
|
||||
if (animator != nullptr) {
|
||||
if(sp->m_CheckBoxParameters.animation && animator->isRunning("OnOpacity"))
|
||||
if(hasAnimation && animator->isRunning("OnOpacity"))
|
||||
{
|
||||
float value = animator->value("OnOpacity").toFloat();
|
||||
|
||||
|
@ -2478,7 +2483,7 @@ void UKUIConfigStyle::drawPrimitive(QStyle::PrimitiveElement element, const QSty
|
|||
}
|
||||
}
|
||||
|
||||
if (sp->m_CheckBoxParameters.animation && animator != nullptr && animator->isRunning("OnScale")) {
|
||||
if (hasAnimation && animator != nullptr && animator->isRunning("OnScale")) {
|
||||
float value = animator->value("OnScale").toFloat();
|
||||
// qDebug() << "OnScale.....value:" << value;
|
||||
if (on) {
|
||||
|
@ -2513,7 +2518,7 @@ void UKUIConfigStyle::drawPrimitive(QStyle::PrimitiveElement element, const QSty
|
|||
}
|
||||
}
|
||||
|
||||
if (sp->m_CheckBoxParameters.animation && animator != nullptr && animator->isRunning("Off")) {
|
||||
if (hasAnimation && animator != nullptr && animator->isRunning("Off")) {
|
||||
float value = animator->value("Off").toFloat();
|
||||
// qDebug() << "Off.....value:" << value;
|
||||
|
||||
|
@ -2571,7 +2576,7 @@ void UKUIConfigStyle::drawPrimitive(QStyle::PrimitiveElement element, const QSty
|
|||
|
||||
if (enable) {
|
||||
if (on | noChange) {
|
||||
if(sp->m_CheckBoxParameters.animation && animator != nullptr)
|
||||
if(hasAnimation && animator != nullptr)
|
||||
{
|
||||
if(!animator->isRunning("OnBase") && animator->currentAnimatorTime("OnBase") == 0)
|
||||
{
|
||||
|
@ -2631,7 +2636,7 @@ void UKUIConfigStyle::drawPrimitive(QStyle::PrimitiveElement element, const QSty
|
|||
painter->drawPath(path);
|
||||
} else {
|
||||
if (animator != nullptr) {
|
||||
if(sp->m_CheckBoxParameters.animation && !animator->isRunning("Off") &&
|
||||
if(hasAnimation && !animator->isRunning("Off") &&
|
||||
animator->currentAnimatorTime("Off") == 0 &&
|
||||
animator->currentAnimatorTime("OnScale") > 0 &&
|
||||
animator->currentAnimatorTime("OnOpacity") > 0 &&
|
||||
|
@ -4122,8 +4127,10 @@ void UKUIConfigStyle::drawControl(QStyle::ControlElement element, const QStyleOp
|
|||
painter->setPen(Qt::NoPen);
|
||||
painter->setRenderHint(QPainter::Antialiasing, true);
|
||||
|
||||
bool hasAnimation = widget &&(!widget->property("animation").isValid() ||
|
||||
(widget->property("animation").isValid() && widget->property("animation").toBool()));
|
||||
|
||||
if(sp->m_ScrollBarParameters.animation) {
|
||||
if(hasAnimation) {
|
||||
qreal len;
|
||||
if(sp->m_ScrollBarParameters.grooveWidthAnimation){
|
||||
//width animation
|
||||
|
@ -6130,7 +6137,12 @@ QRect UKUIConfigStyle::subControlRect(QStyle::ComplexControl control, const QSty
|
|||
}
|
||||
|
||||
auto animator = m_scrollbar_animation_helper->animator(widget);
|
||||
if (animator && sp->m_ScrollBarParameters.animation) {
|
||||
bool hasAnimation = widget &&(!widget->property("animation").isValid() ||
|
||||
(widget->property("animation").isValid() && widget->property("animation").toBool()));
|
||||
int sliderstart = lineLength + sliderPositionFromValue(bar->minimum, bar->maximum, bar->sliderPosition, maxlen - sliderlen, bar->upsideDown) + distance / 2;
|
||||
|
||||
// qDebug() << "sliderstart0000......" << sliderstart << lineLength << bar->sliderPosition;
|
||||
if (animator && hasAnimation) {
|
||||
// qDebug() << "bar value..." << bar->sliderValue << bar->sliderPosition;
|
||||
if(animator->isRunning("move_position") ||
|
||||
(animator->getExtraProperty("start_position").toInt() !=
|
||||
|
@ -6145,14 +6157,21 @@ QRect UKUIConfigStyle::subControlRect(QStyle::ComplexControl control, const QSty
|
|||
int endValue = animator->getExtraProperty("end_position").toInt();
|
||||
int v = startValue + (endValue - startValue) * 1.0 * animator->value("move_position").toReal();
|
||||
// qDebug() << "v...................." << v << startValue << endValue;
|
||||
if(v >= qMin(startValue, endValue) && v <= qMax(startValue, endValue))
|
||||
if(v >= qMin(startValue, endValue) && v <= qMax(startValue, endValue)){
|
||||
sbar->setValue(v);
|
||||
auto startPos = sliderPositionFromValue(bar->minimum, bar->maximum, startValue, maxlen - sliderlen, bar->upsideDown) + distance / 2;
|
||||
auto endPos = sliderPositionFromValue(bar->minimum, bar->maximum, endValue, maxlen - sliderlen, bar->upsideDown) + distance / 2;
|
||||
|
||||
// qDebug() << "startpos....:" << startPos << "endpos...:" << endPos;
|
||||
sliderstart = lineLength + startPos + (endPos - startPos) * 1.0 * animator->value("move_position").toReal();
|
||||
// qDebug() << "sliderstart11111......" << sliderstart;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int sliderstart = lineLength + sliderPositionFromValue(bar->minimum, bar->maximum, bar->sliderPosition, maxlen - sliderlen, bar->upsideDown) + distance / 2;
|
||||
switch (subControl) {
|
||||
case SC_ScrollBarSubLine:
|
||||
{
|
||||
|
@ -6245,7 +6264,11 @@ QRect UKUIConfigStyle::subControlRect(QStyle::ComplexControl control, const QSty
|
|||
{
|
||||
auto animator = m_slider_animation_helper->animator(widget);
|
||||
|
||||
if (slider && animator && sp->m_SliderParameters.animation){
|
||||
int sliderPos = sliderPositionFromValue(slider->minimum, slider->maximum, slider->sliderValue,
|
||||
proxy()->pixelMetric(PM_SliderSpaceAvailable, option, widget), slider->upsideDown);
|
||||
// qDebug() << "sliderPos000........" << sliderPos;
|
||||
bool hasAnimation = widget && ((widget->property("animation").isValid() && widget->property("animation").toBool())||(!widget->property("animation").isValid()));
|
||||
if (slider && animator && hasAnimation){
|
||||
if(animator->isRunning("move_position") ||
|
||||
(animator->getExtraProperty("start_position").toInt() !=
|
||||
animator->getExtraProperty("end_position").toInt() &&
|
||||
|
@ -6264,14 +6287,24 @@ QRect UKUIConfigStyle::subControlRect(QStyle::ComplexControl control, const QSty
|
|||
// << animator->getExtraProperty("start_position").toInt()
|
||||
// << animator->getExtraProperty("end_position").toInt();
|
||||
int v = startValue + (endValue - startValue) * 1.0 * animator->value("move_position").toReal();
|
||||
if(v >= qMin(startValue, endValue) && v <= qMax(startValue, endValue))
|
||||
// qDebug() << "vvvvvvvvvvv" << v;
|
||||
if(v >= qMin(startValue, endValue) && v <= qMax(startValue, endValue)){
|
||||
sbar->setValue(startValue + (endValue - startValue) * 1.0 * animator->value("move_position").toReal());
|
||||
|
||||
auto startPos = sliderPositionFromValue(slider->minimum, slider->maximum, startValue,
|
||||
proxy()->pixelMetric(PM_SliderSpaceAvailable, option, widget), slider->upsideDown);
|
||||
auto endPos = sliderPositionFromValue(slider->minimum, slider->maximum, endValue,
|
||||
proxy()->pixelMetric(PM_SliderSpaceAvailable, option, widget), slider->upsideDown);
|
||||
sliderPos = startPos + (endPos - startPos) * 1.0 * animator->value("move_position").toReal();
|
||||
// qDebug() << "sliderPos1111........" << sliderPos;
|
||||
}
|
||||
// qDebug() << "sbar value:" << sbar->value();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (animator && sp->m_SliderParameters.animation) {
|
||||
if (animator && hasAnimation) {
|
||||
if(!animator->isRunning("move_position") && animator->currentAnimatorTime("move_position") != 0){
|
||||
animator->setAnimatorCurrentTime("move_position", 0);
|
||||
animator->setExtraProperty("end_position", 0);
|
||||
|
@ -6288,8 +6321,7 @@ QRect UKUIConfigStyle::subControlRect(QStyle::ComplexControl control, const QSty
|
|||
else
|
||||
handleRect.setSize(QSize(handleThickness, handleLength));
|
||||
handleRect.moveCenter(rect.center());
|
||||
int sliderPos = sliderPositionFromValue(slider->minimum, slider->maximum, slider->sliderValue,
|
||||
proxy()->pixelMetric(PM_SliderSpaceAvailable, option, widget), slider->upsideDown);
|
||||
|
||||
if (horizontal) {
|
||||
handleRect.moveLeft(sliderPos + sp->Slider_Margin);
|
||||
} else {
|
||||
|
|
|
@ -54,7 +54,7 @@ public:
|
|||
QPen checkBoxOnHoverPen;
|
||||
QPen checkBoxOnClickPen;
|
||||
QPen checkBoxContentPen;
|
||||
bool animation = true;
|
||||
// bool animation = true;
|
||||
bool onHoverBrushIslinearGradient = false;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ public:
|
|||
QPen radioButtonOnDefaultPen;
|
||||
QPen radioButtonOnHoverPen;
|
||||
QPen radioButtonOnClickPen;
|
||||
bool animation = true;
|
||||
// bool animation = true;
|
||||
};
|
||||
}
|
||||
#endif // RADIOBUTTONPARAMETERS_H
|
||||
|
|
|
@ -26,5 +26,4 @@ using namespace UKUIConfigStyleSpace;
|
|||
|
||||
ConfigScrollBarParameters::ConfigScrollBarParameters()
|
||||
{
|
||||
animation = true;
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
QBrush scrollBarSliderHoverBrush;
|
||||
QBrush scrollBarSliderClickBrush;
|
||||
QBrush scrollBarSliderDisableBrush;
|
||||
bool animation = true;
|
||||
// bool animation = true;
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -45,6 +45,4 @@ ConfigSliderParameters::ConfigSliderParameters()
|
|||
sliderGrooveUnvalueDefaultBrush = QBrush(Qt::NoBrush);
|
||||
sliderGrooveUnvalueHoverBrush = QBrush(Qt::NoBrush);
|
||||
sliderGrooveUnvalueDisableBrush = QBrush(Qt::NoBrush);
|
||||
|
||||
animation = true;
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ public:
|
|||
QPen sliderGroovePen = Qt::NoPen;
|
||||
QPainterPath sliderHandlePath;
|
||||
|
||||
bool animation = true;
|
||||
// bool animation = true;
|
||||
|
||||
int sliderGrooveRadius = 2;
|
||||
};
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
QPen treeTextSelectPen;
|
||||
|
||||
bool indicatorIconHoverNeedHighLight = true;
|
||||
bool animation = true;
|
||||
// bool animation = true;
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ bool SliderAnimator::bindWidget(QWidget *w)
|
|||
m_silder_move_position->setStartValue(0.0);
|
||||
m_silder_move_position->setEndValue(1.0);
|
||||
m_silder_move_position->setDuration(150);
|
||||
m_silder_move_position->setEasingCurve(QEasingCurve::Linear);
|
||||
m_silder_move_position->setEasingCurve(QEasingCurve::InOutCubic);
|
||||
addAnimation(m_silder_move_position);
|
||||
|
||||
connect(m_slider_opacity, &QVariantAnimation::valueChanged, w, [=]() {
|
||||
|
|
|
@ -378,8 +378,6 @@ bool Qt5UKUIStyle::eventFilter(QObject *obj, QEvent *e)
|
|||
if(e->type() == QEvent::MouseButtonPress || e->type() == QEvent::MouseButtonDblClick){
|
||||
if(obj->property("animation").isValid() && !obj->property("animation").toBool())
|
||||
return false;
|
||||
if(!sp->sliderParameters.animation)
|
||||
return false;
|
||||
|
||||
auto *slider = qobject_cast<QSlider *>(obj);
|
||||
if(slider == nullptr || !slider->isEnabled())
|
||||
|
@ -462,7 +460,7 @@ bool Qt5UKUIStyle::eventFilter(QObject *obj, QEvent *e)
|
|||
|
||||
if(qobject_cast<QScrollBar*>(obj)){
|
||||
if(e->type() == QEvent::MouseButtonPress || e->type() == QEvent::MouseButtonDblClick){
|
||||
if(!sp->scrollBarParameters.animation)
|
||||
if(obj->property("animation").isValid() && !obj->property("animation").toBool())
|
||||
return false;
|
||||
|
||||
auto *scrollbar = qobject_cast<QScrollBar *>(obj);
|
||||
|
@ -1014,16 +1012,14 @@ void Qt5UKUIStyle::polish(QWidget *widget)
|
|||
|
||||
if(widget != nullptr && widget->inherits("QTreeView")){
|
||||
m_tree_animation_helper->registerWidget(widget);
|
||||
if(qobject_cast<QTreeView *>(widget)->isAnimated() && !widget->property("animation").isValid()){
|
||||
if(!qobject_cast<QTreeView *>(widget)->isAnimated() &&
|
||||
widget->property("animation").isValid() && !widget->property("animation").toBool()){
|
||||
qobject_cast<QTreeView *>(widget)->setAnimated(false);
|
||||
}
|
||||
else{
|
||||
widget->setProperty("animation", true);
|
||||
qobject_cast<QTreeView *>(widget)->setAnimated(true);
|
||||
}
|
||||
if(widget->property("animation").isValid()){
|
||||
sp->treeParameters.animation = widget->property("animation").toBool();
|
||||
qobject_cast<QTreeView *>(widget)->setAnimated(sp->treeParameters.animation);
|
||||
}
|
||||
else
|
||||
qobject_cast<QTreeView *>(widget)->setAnimated(sp->treeParameters.animation);
|
||||
|
||||
|
||||
auto tree = qobject_cast<QTreeView*>(widget);
|
||||
connect(tree, &QTreeView::expanded, this, [=](const QModelIndex &index){
|
||||
|
@ -2186,8 +2182,10 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO
|
|||
painter->setRenderHint(QPainter::Antialiasing, true);
|
||||
|
||||
auto animator = m_radiobutton_animation_helper->animator(widget);
|
||||
bool hasAnimation = widget &&(!widget->property("animation").isValid() ||
|
||||
(widget->property("animation").isValid() && widget->property("animation").toBool()));
|
||||
|
||||
if (enable && sp->radioButtonParameters.animation &&
|
||||
if (enable && hasAnimation &&
|
||||
animator != nullptr && animator->isRunning("SunKenOn")) {
|
||||
float value = animator->value("SunKenOn").toFloat();
|
||||
QColor clickColor = sp->radioButtonParameters.radioButtonClickBrush.color();
|
||||
|
@ -2222,7 +2220,7 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO
|
|||
painter->restore();
|
||||
return;
|
||||
}
|
||||
else if (enable && sp->radioButtonParameters.animation &&
|
||||
else if (enable && hasAnimation &&
|
||||
animator != nullptr && animator->isRunning("Off")) {
|
||||
float value = animator->value("Off").toFloat();
|
||||
// qDebug() << "off SunKenOn value......" << qobject_cast<const QRadioButton *>(widget)->text() << value;
|
||||
|
@ -2250,7 +2248,7 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO
|
|||
if (enable) {
|
||||
if (on) {
|
||||
if (animator != nullptr) {
|
||||
if (sp->radioButtonParameters.animation && !animator->isRunning("SunKenOn") ) {
|
||||
if (hasAnimation && !animator->isRunning("SunKenOn") ) {
|
||||
// qDebug() << "SunKenOn time....:" << qobject_cast<const QRadioButton *>(widget)->text() << animator->currentAnimatorTime("SunKenOn");
|
||||
if(animator->currentAnimatorTime("SunKenOn") == 0){
|
||||
animator->startAnimator("SunKenOn");
|
||||
|
@ -2287,7 +2285,7 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO
|
|||
painter->restore();
|
||||
return;
|
||||
} else {
|
||||
if (sp->radioButtonParameters.animation && animator != nullptr) {
|
||||
if (hasAnimation && animator != nullptr) {
|
||||
if (!animator->isRunning("Off") && animator->currentAnimatorTime("SunKenOn") > 0 && animator->currentAnimatorTime("Off") == 0) {
|
||||
animator->startAnimator("Off");
|
||||
animator->setAnimatorCurrentTime("SunKenOn", 0);
|
||||
|
@ -2349,7 +2347,10 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO
|
|||
painter->setRenderHint(QPainter::Antialiasing);
|
||||
|
||||
auto animator = m_checkbox_animation_helper->animator(widget);
|
||||
if (sp->checkBoxParameters.animation && animator != nullptr) {
|
||||
bool hasAnimation = widget &&(!widget->property("animation").isValid() ||
|
||||
(widget->property("animation").isValid() && widget->property("animation").toBool()));
|
||||
|
||||
if (hasAnimation && animator != nullptr) {
|
||||
if(animator->isRunning("OnBase"))
|
||||
{
|
||||
float value = animator->value("OnBase").toFloat();
|
||||
|
@ -2394,7 +2395,7 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO
|
|||
|
||||
|
||||
if (animator != nullptr) {
|
||||
if(sp->checkBoxParameters.animation && animator->isRunning("OnOpacity"))
|
||||
if(hasAnimation && animator->isRunning("OnOpacity"))
|
||||
{
|
||||
float value = animator->value("OnOpacity").toFloat();
|
||||
|
||||
|
@ -2422,7 +2423,7 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO
|
|||
}
|
||||
}
|
||||
|
||||
if (sp->checkBoxParameters.animation && animator != nullptr && animator->isRunning("OnScale")) {
|
||||
if (hasAnimation && animator != nullptr && animator->isRunning("OnScale")) {
|
||||
float value = animator->value("OnScale").toFloat();
|
||||
if (on) {
|
||||
path.moveTo(pathrect.left() + width / 2 - 0.4 * width/4.0 - value * 0.6 * width /4.0, pathrect.top() + heigth / 2);
|
||||
|
@ -2456,7 +2457,7 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO
|
|||
}
|
||||
}
|
||||
|
||||
if (sp->checkBoxParameters.animation && animator != nullptr && animator->isRunning("Off")) {
|
||||
if (hasAnimation && animator != nullptr && animator->isRunning("Off")) {
|
||||
float value = animator->value("Off").toFloat();
|
||||
// qDebug() << "Off.....value:" << value;
|
||||
|
||||
|
@ -2512,7 +2513,7 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO
|
|||
|
||||
if (enable) {
|
||||
if (on | noChange) {
|
||||
if(sp->checkBoxParameters.animation && animator != nullptr)
|
||||
if(hasAnimation && animator != nullptr)
|
||||
{
|
||||
if(!animator->isRunning("OnBase") && animator->currentAnimatorTime("OnBase") == 0)
|
||||
{
|
||||
|
@ -2572,7 +2573,7 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO
|
|||
painter->drawPath(path);
|
||||
} else {
|
||||
if (animator != nullptr) {
|
||||
if(sp->checkBoxParameters.animation && !animator->isRunning("Off") &&
|
||||
if(hasAnimation && !animator->isRunning("Off") &&
|
||||
animator->currentAnimatorTime("Off") == 0 &&
|
||||
animator->currentAnimatorTime("OnScale") > 0 &&
|
||||
animator->currentAnimatorTime("OnOpacity") > 0 &&
|
||||
|
@ -4062,8 +4063,10 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio
|
|||
painter->setPen(Qt::NoPen);
|
||||
painter->setRenderHint(QPainter::Antialiasing, true);
|
||||
|
||||
bool hasAnimation = widget &&(!widget->property("animation").isValid() ||
|
||||
(widget->property("animation").isValid() && widget->property("animation").toBool()));
|
||||
|
||||
if(sp->scrollBarParameters.animation == true) {
|
||||
if(hasAnimation) {
|
||||
qreal len;
|
||||
if(sp->scrollBarParameters.grooveWidthAnimation){
|
||||
//width animation
|
||||
|
@ -6076,7 +6079,10 @@ QRect Qt5UKUIStyle::subControlRect(QStyle::ComplexControl control, const QStyleO
|
|||
}
|
||||
|
||||
auto animator = m_scrollbar_animation_helper->animator(widget);
|
||||
if (animator && sp->scrollBarParameters.animation) {
|
||||
bool hasAnimation = widget &&(!widget->property("animation").isValid() ||
|
||||
(widget->property("animation").isValid() && widget->property("animation").toBool()));
|
||||
|
||||
if (animator && hasAnimation) {
|
||||
// qDebug() << "bar value..." << bar->sliderValue << bar->sliderPosition;
|
||||
if(animator->isRunning("move_position") ||
|
||||
(animator->getExtraProperty("start_position").toInt() !=
|
||||
|
@ -6190,8 +6196,10 @@ QRect Qt5UKUIStyle::subControlRect(QStyle::ComplexControl control, const QStyleO
|
|||
case SC_SliderHandle:
|
||||
{
|
||||
auto animator = m_slider_animation_helper->animator(widget);
|
||||
bool hasAnimation = widget &&(!widget->property("animation").isValid() ||
|
||||
(widget->property("animation").isValid() && widget->property("animation").toBool()));
|
||||
|
||||
if (slider && animator && sp->sliderParameters.animation){
|
||||
if (slider && animator && hasAnimation){
|
||||
if(animator->isRunning("move_position") ||
|
||||
(animator->getExtraProperty("start_position").toInt() !=
|
||||
animator->getExtraProperty("end_position").toInt() &&
|
||||
|
@ -6217,7 +6225,7 @@ QRect Qt5UKUIStyle::subControlRect(QStyle::ComplexControl control, const QStyleO
|
|||
}
|
||||
|
||||
|
||||
if (animator && sp->sliderParameters.animation) {
|
||||
if (animator && hasAnimation) {
|
||||
if(!animator->isRunning("move_position") && animator->currentAnimatorTime("move_position") != 0){
|
||||
animator->setAnimatorCurrentTime("move_position", 0);
|
||||
animator->setExtraProperty("end_position", 0);
|
||||
|
|
|
@ -1507,8 +1507,8 @@ void KClassicalStyleParameters::initTreeParameters(bool isDark, const QStyleOpti
|
|||
disableBrush = QBrush(Qt::transparent);
|
||||
branchDisableBrush = disableBrush;
|
||||
|
||||
if(widget->property("animation").isValid())
|
||||
treeParameters.animation = widget->property("animation").toBool();
|
||||
// if(widget->property("animation").isValid())
|
||||
// treeParameters.animation = widget->property("animation").toBool();
|
||||
|
||||
if(widget){
|
||||
if (widget->property("setRadius").isValid() && widget->property("setRadius").canConvert<int>()) {
|
||||
|
@ -1694,8 +1694,8 @@ void KClassicalStyleParameters::initCheckBoxParameters(bool isDark, const QStyle
|
|||
pathBrush = option->palette.brush(QPalette::Active, QPalette::Text);
|
||||
pathDisableBrush = option->palette.brush(QPalette::Disabled, QPalette::ButtonText);
|
||||
|
||||
if(widget->property("animation").isValid())
|
||||
checkBoxParameters.animation = widget->property("animation").toBool();
|
||||
// if(widget->property("animation").isValid())
|
||||
// checkBoxParameters.animation = widget->property("animation").toBool();
|
||||
|
||||
checkBoxParameters.checkBoxContentPen = QPen(QBrush(option->palette.brush(QPalette::Active, QPalette::ButtonText)), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
|
||||
|
@ -1882,8 +1882,8 @@ void KClassicalStyleParameters::initRadioButtonParameters(bool isDark, const QSt
|
|||
}
|
||||
}
|
||||
|
||||
if(widget->property("animation").isValid())
|
||||
radioButtonParameters.animation = widget->property("animation").toBool();
|
||||
// if(widget->property("animation").isValid())
|
||||
// radioButtonParameters.animation = widget->property("animation").toBool();
|
||||
|
||||
radioButtonParameters.radioButtonDefaultPen = defaultPen;
|
||||
radioButtonParameters.radioButtonHoverPen = hoverPen;
|
||||
|
@ -2027,10 +2027,10 @@ void KClassicalStyleParameters::initSliderParameters(bool isDark, const QStyleOp
|
|||
}
|
||||
|
||||
qDebug() << "sloder animation 00000000000" << widget->property("animation").isValid();
|
||||
if(widget->property("animation").isValid()){
|
||||
sliderParameters.animation = widget->property("animation").toBool();
|
||||
qDebug() << "slider animation11111" << widget->property("animation").toBool();
|
||||
}
|
||||
// if(widget->property("animation").isValid()){
|
||||
// sliderParameters.animation = widget->property("animation").toBool();
|
||||
// qDebug() << "slider animation11111" << widget->property("animation").toBool();
|
||||
// }
|
||||
|
||||
if(widget){
|
||||
if (widget->property("setGrooveRadius").isValid() && widget->property("setGrooveRadius").canConvert<int>()) {
|
||||
|
@ -2177,8 +2177,8 @@ void KClassicalStyleParameters::initScrollBarParameters(bool isDark, const QStyl
|
|||
QBrush sliderHoverBrush;
|
||||
QBrush sliderClickBrush;
|
||||
QBrush sliderDisableBrush;
|
||||
if(widget->property("animation").isValid())
|
||||
scrollBarParameters.animation = widget->property("animation").toBool();
|
||||
// if(widget->property("animation").isValid())
|
||||
// scrollBarParameters.animation = widget->property("animation").toBool();
|
||||
|
||||
const QStyleOptionSlider *bar = qstyleoption_cast<const QStyleOptionSlider *>(option);
|
||||
|
||||
|
|
|
@ -53,7 +53,6 @@ public:
|
|||
QPen checkBoxOnHoverPen;
|
||||
QPen checkBoxOnClickPen;
|
||||
QPen checkBoxContentPen;
|
||||
bool animation = true;
|
||||
bool onHoverBrushIslinearGradient = false;
|
||||
};
|
||||
|
||||
|
|
|
@ -55,7 +55,6 @@ public:
|
|||
QPen radioButtonOnDefaultPen;
|
||||
QPen radioButtonOnHoverPen;
|
||||
QPen radioButtonOnClickPen;
|
||||
bool animation = true;
|
||||
};
|
||||
|
||||
#endif // RADIOBUTTONPARAMETERS_H
|
||||
|
|
|
@ -25,5 +25,4 @@
|
|||
|
||||
ScrollBarParameters::ScrollBarParameters()
|
||||
{
|
||||
animation = true;
|
||||
}
|
||||
|
|
|
@ -42,8 +42,6 @@ public:
|
|||
QBrush scrollBarSliderHoverBrush;
|
||||
QBrush scrollBarSliderClickBrush;
|
||||
QBrush scrollBarSliderDisableBrush;
|
||||
bool animation = true;
|
||||
|
||||
};
|
||||
|
||||
#endif // SCROLLBARPARAMETERS_H
|
||||
|
|
|
@ -44,6 +44,4 @@ SliderParameters::SliderParameters()
|
|||
sliderGrooveUnvalueDefaultBrush = QBrush(Qt::NoBrush);
|
||||
sliderGrooveUnvalueHoverBrush = QBrush(Qt::NoBrush);
|
||||
sliderGrooveUnvalueDisableBrush = QBrush(Qt::NoBrush);
|
||||
|
||||
animation = true;
|
||||
}
|
||||
|
|
|
@ -56,8 +56,6 @@ public:
|
|||
QPen sliderGroovePen = Qt::NoPen;
|
||||
QPainterPath sliderHandlePath;
|
||||
|
||||
bool animation = true;
|
||||
|
||||
int sliderGrooveRadius = 2;
|
||||
};
|
||||
|
||||
|
|
|
@ -50,7 +50,6 @@ public:
|
|||
QPen treeTextSelectPen;
|
||||
|
||||
bool indicatorIconHoverNeedHighLight = true;
|
||||
bool animation = true;
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue