Skip to content

Inverted Appearance Slider #360

Open
@hmaarrfk

Description

@hmaarrfk

The Qt Slider can have an inverted apperance.

However, QDarkstyle doesn't style it correctly:

We need a CSS that looks like:

QSlider::sub-page:horizontal[invertedAppearance=true], QSlider::sub-page:vertical[invertedAppearance=true] {
     background: rgb(108, 111, 112);
     border-radius: 2px;
}

xref:
https://github.com/aws/lumberyard/blob/master/dev/Code/Sandbox/Editor/Style/NewEditorStylesheet.qss#L1504

Describe Your Environment

* OPERATING SYSTEM---------------------------------------------------------------
    - System........................ Linux
    - Release....................... 6.11.4-301.fc41.x86_64
    - Platform...................... Linux-6.11.4-301.fc41.x86_64-x86_64-with-glibc2.40
    - Version....................... #1 SMP PREEMPT_DYNAMIC Sun Oct 20 15:02:33 UTC 2024
* PYTHON DISTRIBUTION------------------------------------------------------------
    - Version....................... 3.10.16
    - C Compiler.................... GCC 13.3.0
    - C API Version................. 1013
    - Implementation................ cpython
    - Implementation Version........ 3.10.16
* QT BINDINGS--------------------------------------------------------------------
    - PyQt5 Version................. 5.15.9
    - PyQt5 Qt Version.............. 5.15.8
* QT ABSTRACTIONS----------------------------------------------------------------
    - qtpy Version.................. 2.4.2
    - qtpy Binding.................. pyqt5
    - qtpy Binding Variable......... os.environ['QT_API']
    - qtpy Import Name.............. qtpy
    - qtpy Status................... OK
* PYTHON PACKAGES----------------------------------------------------------------
    - helpdev....................... 0.7.1
    - QDarkStyle.................... 3.2.3

Language

Python

Description / Steps to Reproduce [if necessary]

  1. Create a horizontal slider with an invertedApparance set to True
  2. Create a vertical slider with an invertedAppearance set to True

Observe how their apperance isn't inverted

Actual Result

I feel like I got the horizontal slider, but not the vertical one.... very confusing...
image

Expected Results / Proposed Result

Notice how the inverted ones look inverted
image

Relevant Code [if necessary]

[A piece of code to reproduce and/or fix this issue]

diff --git a/qdarkstyle/qss/_styles.scss b/qdarkstyle/qss/_styles.scss
index 7c7874e..e2f4772 100644
--- a/qdarkstyle/qss/_styles.scss
+++ b/qdarkstyle/qss/_styles.scss
@@ -1449,6 +1449,17 @@ QSlider {
                 background: $COLOR_ACCENT_1;
             }
         }
+        &:vertical[invertedAppearance=true] {
+            background: $COLOR_BACKGROUND_4;
+        }
+        &:horizontal[invertedAppearance=true] {
+            background: $COLOR_ACCENT_2;
+            border: $BORDER_2;
+
+            &:disabled[invertedAppearance=true] {
+                background: $COLOR_ACCENT_1;
+            }
+        }
     }
 
     &::sub-page {
@@ -1464,6 +1475,27 @@ QSlider {
                 background: $COLOR_ACCENT_1;
             }
         }
+        &:horizontal[invertedAppearance=true] {
+            background: $COLOR_BACKGROUND_4;
+        }
+        // I can't tell where these colors are being used...
+        &vertical {
+            background: #0f0;
+            background-color: #0f0;
+            &:disabled {
+                background: #000;
+                background-color: #000;
+            }
+        }
+        &vertical[invertedAppearance=true] {
+            background: #f00;
+            background-color: #f00;
+
+            &:disabled[invertedAppearance=true] {
+                background: #00f;
+                background-color: #00f;
+            }
+        }
     }
 
     &::handle {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions