Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. How to make the tip of a QSlider in PySide2 look like a triangle?
Qt 6.11 is out! See what's new in the release blog

How to make the tip of a QSlider in PySide2 look like a triangle?

Scheduled Pinned Locked Moved Solved Qt for Python
3 Posts 2 Posters 601 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    makalidap
    wrote on last edited by
    #1

    GNvuV.png
    I want to make the end of QSlider triangular like in the image above, but I couldn't do it. When I use the code`

    self.mindelayclicki.setTickPosition(QSlider.TicksBelow)
    

    it becomes triangular, but I want it to be included in the stylesheet I added, and I don't want it to be in the red area:lBSO7.png
    MyCode:

    from PySide2.QtWidgets import QMainWindow, QApplication, QSlider
    from PySide2.QtGui import Qt
    
    from sys import exit, argv
    
    
    class MyWin(QMainWindow):
        def __init__(self):
            super().__init__()
            self.setFixedSize(400, 400)
            self.mindelayclicki = QSlider(Qt.Horizontal, self)
            self.mindelayclicki.setGeometry(20, 100, 350, 25)
            self.mindelayclicki.setStyleSheet("""
                QSlider::groove:horizontal {
                    height: 8px;
                    margin: 0px;
                    background-color: #E7EAEA;
                    border:1px solid #D6D6D6;
                }
                QSlider::handle:horizontal {
                    height: 20px;
                    width: 12px;
                    margin: -12px 0px -12px 0px;
                    background-color: #007AD9;
                }
                    """)
            self.show()
    app = QApplication(argv)
    window = MyWin()
    exit(app.exec_())
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Did you consider using custom images ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • M Offline
        M Offline
        makalidap
        wrote on last edited by
        #3

        Thank you, it didn't occur to me

        1 Reply Last reply
        0
        • M makalidap has marked this topic as solved on

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved