Still show position slider groove when inactive

This commit is contained in:
craig.p.drummond
2014-06-20 17:54:59 +00:00
parent fdda3a62a0
commit ea953dda52
2 changed files with 7 additions and 15 deletions

View File

@@ -133,7 +133,6 @@ protected:
PosSlider::PosSlider(QWidget *p)
: QSlider(p)
, isActive(false)
, shown(false)
{
setPageStep(0);
@@ -164,9 +163,11 @@ void PosSlider::updateStyleSheet()
"background: solid rgba(%6, %7, %8, %9); "
"border-radius: %10px } ");
QString fillFormat=QLatin1String("QSlider::")+QLatin1String(Qt::RightToLeft==layoutDirection() ? "add" : "sub")+
QLatin1String("-page:horizontal {border: %1px solid palette(highlight); "
"background: solid palette(highlight); "
"border-radius: %2px; margin: %3px;}");
QLatin1String("-page:horizontal {border: %1px solid palette(highlight); "
"background: solid palette(highlight); "
"border-radius: %2px; margin: %3px;}")+
QLatin1String("QSlider::")+QLatin1String(Qt::RightToLeft==layoutDirection() ? "add" : "sub")+
QLatin1String("-page:horizontal:disabled {border: 0px; background: solid rgba(0, 0, 0, 0)}");
QLabel lbl(parentWidget());
lbl.ensurePolished();
QColor textColor=lbl.palette().color(QPalette::Active, QPalette::Text);
@@ -177,13 +178,6 @@ void PosSlider::updateStyleSheet()
fillFormat.arg(lineWidth).arg(lineWidth).arg(lineWidth*2));
}
void PosSlider::paintEvent(QPaintEvent *e)
{
if (isActive) {
QSlider::paintEvent(e);
}
}
void PosSlider::mouseMoveEvent(QMouseEvent *e)
{
if (maximum()!=minimum()) {
@@ -197,7 +191,7 @@ void PosSlider::mouseMoveEvent(QMouseEvent *e)
void PosSlider::wheelEvent(QWheelEvent *ev)
{
if (!isActive) {
if (!isEnabled()) {
return;
}
@@ -243,7 +237,7 @@ void PosSlider::setRange(int min, int max)
setToolTip(QString());
}
isActive=active;
setEnabled(active);
}
NowPlayingWidget::NowPlayingWidget(QWidget *p)

View File

@@ -43,7 +43,6 @@ public:
void showEvent(QShowEvent *e);
void updateStyleSheet();
void paintEvent(QPaintEvent *e);
void mouseMoveEvent(QMouseEvent *e);
void wheelEvent(QWheelEvent *ev);
void setRange(int min, int max);
@@ -52,7 +51,6 @@ Q_SIGNALS:
void positionSet();
private:
bool isActive;
bool shown;
};