[Utils] QCheckBoxUtils
·
[Framework] - PyQT
from PyQt5.QtCore import Qtfrom PyQt5.QtWidgets import QWidgetfrom PyQt5.QtWidgets import QHBoxLayoutfrom PyQt5.QtWidgets import QCheckBoxclass QCheckBoxUtils: @staticmethod def check_box_aligned_center(): widget = QWidget() layout = QHBoxLayout() check_box = QCheckBox() layout.setAlignment(Qt.AlignCenter) layout.addWidget(check_box) widget.setLayo..
[Util] QTableWidgetUtils
·
[Framework] - PyQT
from collections import OrderedDictfrom qgis.PyQt.QtCore import Qtfrom PyQt5.QtWidgets import QTableWidgetfrom PyQt5.QtWidgets import QTableWidgetItemfrom siqms_src.utils.ui_utils import UIUtilsclass QTableFormat: def __init__(self): self._form = OrderedDict() def __len__(self): return len(self._form) def __sub__(self, row: tuple): self._form.pop(row) def __getit..
QSplitter
·
[Framework] - PyQT
필자는 위젯을 배치하여 유연하게 사이즈를 조절하는 법이 궁금했다.. 현재 두개의 QTableWidget을 QMainWindow에 생성한 상태이다. 정렬할 위젯들을 복수 선택한다. 위의 빨간 버튼을 클릭하면 가로든 세로든 유연하게 배치할 수 있다. QSplitter 안에 위젯들이 정렬된 것을 확인할 수 있다. 이는 실행되는 상태에서도 마우스를 통해 위젯의 크기를 조절할 수 있다.
closeEvent
·
[Framework] - PyQT
다이얼로그를 띄운 상태에서 해당 다이얼로그를 띄우는 버튼을 누르면 중복되서 띄워지는 현상이 발생했다.. -_-;; 그래서 혼자 예외처리를 한 결과.. if not self.dialog_legend: DialogLegend(....)다이얼로그 객체가 존재하지 않은 경우에만 띄우도록 예외처리를 했다. 그랬더니 문제가 발생했다. 중복되는 현상은 방지할 수 있었지만, 창을 닫고나서 두 번째부터 창을 띄울 수 없게 된 것이다. 이는 다이얼로그 객체가 남아있게 때문에 해당 조건문을 만족시키지 않기 때문이었다. 그렇다면 해당 객체를 없애냐? 그렇게 되면 이벤트가 발생하지 않는 좀비상태로 빠져버리고 말것이다.. 그 순간! 옆에 계신 선배님이 팁을 주셨다. closeEvent class DialogLegend(Q..