Improved settings layout.
This commit is contained in:
parent
83744eb3f4
commit
53c6bccfe6
4 changed files with 102 additions and 13 deletions
31
wobuzz/ui/settings/sub_category.py
Normal file
31
wobuzz/ui/settings/sub_category.py
Normal file
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
from PyQt6.QtCore import Qt
|
||||
from PyQt6.QtGui import QFont
|
||||
from PyQt6.QtWidgets import QGroupBox, QLabel, QSizePolicy, QFormLayout
|
||||
|
||||
|
||||
class SubCategory(QGroupBox):
|
||||
description_font = QFont()
|
||||
description_font.setPointSize(8)
|
||||
|
||||
def __init__(self, title: str, description: str, parent=None):
|
||||
super().__init__(title, parent)
|
||||
|
||||
self.setSizePolicy(QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Fixed)
|
||||
self.setAlignment(Qt.AlignmentFlag.AlignLeading | Qt.AlignmentFlag.AlignVCenter)
|
||||
|
||||
self.layout = QFormLayout()
|
||||
self.setLayout(self.layout)
|
||||
|
||||
self.description = QLabel(description + "\n", self)
|
||||
self.layout.addRow(self.description)
|
||||
|
||||
def add_setting(self, text: str, setting, description: str=None):
|
||||
self.layout.addRow(text, setting)
|
||||
|
||||
if description is not None:
|
||||
description_label = QLabel(" " + description)
|
||||
description_label.setFont(self.description_font)
|
||||
self.layout.addRow(description_label)
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue