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 Disable Hover Effect for Arrows in PYQT6 QTreeView?
QtWS25 Last Chance

How to Disable Hover Effect for Arrows in PYQT6 QTreeView?

Scheduled Pinned Locked Moved Unsolved Qt for Python
1 Posts 1 Posters 128 Views
  • 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.
  • devdd960D Offline
    devdd960D Offline
    devdd960
    wrote on last edited by
    #1

    As seen in the image is it possible to remove the hover effect on the arrows(marked in the image), since its not aligning with the curved hover effect on the item , i just wanna disable it. How can this be achieved?

    self.tree_view = QTreeView() 
            self.tree_view.setStyleSheet("""
        QTreeView {
            padding: 9px;
            background-color: #000000;
            outline: 0px;
        }
        QTreeView::item {
            padding: 9px 9px;
            color: white;  /* Text color */
            border-radius: 9px;  /* Rounded corners */
            background: transparent;  /* Default background */  
                                         
        }   
        QTreeView::item:hover {
            background-color: #FF0000;  /* Background color on hover */
            color: #FFFFFF;  /* Text color on hover */  
            border-radius: 19px; /* Rounded corners */ 
            margin-left: 9px;  /* Fixed-width effect by adding margins */
            margin-right: 9px;
                                         
        }   
        QTreeView::item:selected {
            background-color: #FF0000;  /* Background color when selected */
            color: #FFFFFF;  /* Text color when selected */ 
            border-radius: 19px;
            padding: 9px 9px; 
            margin-left: 9px;  /* Fixed-width effect by adding margins */
            margin-right: 9px;
        }""")
    
            self.tree_view.setModel(self.file_model)
            self.tree_view.setRootIndex(self.file_model.index(self.current_path))
            self.tree_view.setSelectionMode(QTreeView.SelectionMode.SingleSelection)
            self.tree_view.setHeaderHidden(False)    
            self.tree_view.setColumnHidden(1, True)  # Hide Date Modified column (index 2) 
            self.tree_view.setColumnHidden(2, True)  # Hide Date Modified column (index 2) 
            self.tree_view.setColumnHidden(3, True)  # Hide Date Modified column (index 2)
            self.tree_view.setColumnWidth(0, 900)  # Make the file/folder names column wider
            self.tree_view.doubleClicked.connect(self.handle_double_click)
            layout.addWidget(self.tree_view) 
            if save_mode: 
                self.input_field = QLineEdit(self)
                self.input_field.setPlaceholderText("Enter the file name...")
                layout.addWidget(self.input_field)
    
            # Bottom layout for file type selector and buttons
            bottom_layout = QHBoxLayout()
    
            self.file_type_selector = QComboBox() 
            self.file_type_selector.setStyleSheet(f"""
            QComboBox {{
                background-color: #FF0000;
                color: #FFFFFF; 
                font-size: 19px; 
                border: 3px solid #000000;
                border-radius: 33px;  
                padding-left: 9px;
                outline: none;  
            }}
            QComboBox::drop-down {{
                subcontrol-origin: padding;
                subcontrol-position: top right;
                width: 36px;
                border: none;
                padding-right: 5px;
            }}
            QComboBox::down-arrow {{
                width: 10px;
                height: 10px;
                icon-size: 10px 10px;
            }}
            QComboBox QAbstractItemView {{
                background-color: #000000;
                color: #FFFFFF;
                selection-background-color: #FF0000;
                border: 9px solid #FF0000;  
                border-radius: 32px;  
                outline: 0px;
            }}
            QComboBox QAbstractItemView::item {{
                background-color: transparent;  /* Make background transparent */
                color: #FFFFFF; 
                padding: 9px 9px;  /* Add some padding for spacing */
                border-radius: 19px; /* Rounded corners */
            }}
            QComboBox QAbstractItemView::item:hover {{
                background-color: #FF0000;  /* Background color on hover */
                color: #FFFFFF; 
                border-radius: 19px; /* Rounded corners */ 
                margin-left: 60px;  /* Fixed-width effect by adding margins */
                margin-right: 60px;
            }}
            QComboBox QAbstractItemView::item:selected {{
            background-color: #FF0000;  /* Background color when selected */
                color: #FFFFFF; 
                padding: 9px 9px;
                border-radius: 19px; /* Rounded corners */ 
                margin-left: 60px;  /* Fixed-width effect by adding margins */
                margin-right: 60px; 
                /* Ensure padding is applied to prevent square edges */
            }}
            QComboBox QAbstractScrollArea QScrollBar {{
                width: 0px;  /* Hides the scrollbar */
                height: 0px;
            }}    """) 
    
    

    This is the styling sheet used for styling the file dialogue made for returning the file paths to the app. No styling is applied in the main App class, This is a separate class used directly in the main App class
    Screenshot 2024-11-25 005112.png

    1 Reply Last reply
    0

    • Login

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