from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QWidget
from PyQt5.QtWidgets import QHBoxLayout
from PyQt5.QtWidgets import QCheckBox
class QCheckBoxUtils:
@staticmethod
def check_box_aligned_center():
widget = QWidget()
layout = QHBoxLayout()
check_box = QCheckBox()
layout.setAlignment(Qt.AlignCenter)
layout.addWidget(check_box)
widget.setLayout(layout)
return widget, check_box
@staticmethod
def get_check_box_from_widget(widget: QWidget):
components = widget.children()
check_box = None
for component in components:
if type(component) == QCheckBox:
check_box = component
return check_box
'[Framework] - PyQT' 카테고리의 다른 글
# 2. [Util] QTableWidgetUtils (0) | 2021.05.06 |
---|---|
# 1. QSplitter (0) | 2021.05.06 |
#0. closeEvent (0) | 2020.12.28 |
댓글