forked from NinjaCheetah/NUSGet
		
	Fixed dropdown styling once and for all
This commit is contained in:
		
							parent
							
								
									3a6ef23fb9
								
							
						
					
					
						commit
						1ee30146e5
					
				@ -122,6 +122,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
 | 
			
		||||
        list_view = QListView()
 | 
			
		||||
        list_view.setMouseTracking(True)
 | 
			
		||||
        self.ui.console_select_dropdown.setView(list_view)
 | 
			
		||||
        dropdown_delegate = ComboBoxItemDelegate()
 | 
			
		||||
        self.ui.console_select_dropdown.setItemDelegate(dropdown_delegate)
 | 
			
		||||
        self.ui.console_select_dropdown.currentIndexChanged.connect(self.selected_console_changed)
 | 
			
		||||
        # Title tree loading code. Now powered by Models:tm:
 | 
			
		||||
        wii_model = NUSGetTreeModel(wii_database, root_name="Wii Titles")
 | 
			
		||||
 | 
			
		||||
@ -8,7 +8,15 @@ import requests
 | 
			
		||||
from dataclasses import dataclass
 | 
			
		||||
from typing import List
 | 
			
		||||
 | 
			
		||||
from PySide6.QtCore import Qt as _Qt
 | 
			
		||||
from PySide6.QtCore import Qt, QSize
 | 
			
		||||
from PySide6.QtWidgets import QStyledItemDelegate, QSizePolicy
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# This is required to make the dropdown look correct with the custom styling. A little fuzzy on the why, but it has to
 | 
			
		||||
# do with how Qt handles rendering the dropdown items. The sizing has to be overridden so that they don't overlap.
 | 
			
		||||
class ComboBoxItemDelegate(QStyledItemDelegate):
 | 
			
		||||
    def sizeHint(self, option, index):
 | 
			
		||||
        return QSize(option.rect.width(), 33)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@dataclass
 | 
			
		||||
@ -42,7 +50,7 @@ class BatchResults:
 | 
			
		||||
 | 
			
		||||
def connect_label_to_checkbox(label, checkbox):
 | 
			
		||||
    def toggle_checkbox(event):
 | 
			
		||||
        if checkbox.isEnabled() and event.button() == _Qt.LeftButton:
 | 
			
		||||
        if checkbox.isEnabled() and event.button() == Qt.LeftButton:
 | 
			
		||||
            checkbox.toggle()
 | 
			
		||||
    label.mousePressEvent = toggle_checkbox
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -196,6 +196,7 @@ QPushButton:disabled {
 | 
			
		||||
 | 
			
		||||
QComboBox {
 | 
			
		||||
    background-color: transparent;
 | 
			
		||||
    combobox-popup: 0;
 | 
			
		||||
    border: 1px solid rgba(70, 70, 70, 1);
 | 
			
		||||
    border-radius: 8px;
 | 
			
		||||
    padding: 6px 10px;
 | 
			
		||||
@ -233,8 +234,6 @@ QComboBox QAbstractItemView {
 | 
			
		||||
    background-color: #2b2b2b;
 | 
			
		||||
    border: 1px solid #444444;
 | 
			
		||||
    border-radius: 8px;
 | 
			
		||||
    selection-background-color: #1a73e8;
 | 
			
		||||
    selection-color: white;
 | 
			
		||||
    padding: 4px;
 | 
			
		||||
    outline: none;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user