본문 바로가기

PyQt5_47

Bitmap Graphics in Qt 21. Bitmap Graphics in Qt The first step towards creating custom widgets in PyQt6 is understanding bitmap (pixel-based) graphic operations. All standard widgets draw themselves as bitmaps on a rectangular "canvas" that forms the shape of the widget. Once you understand how this works you can draw any custom widget you like! INFO: Bitmaps are rectangular grids of pixels , where each pixel (and it.. 2023. 3. 13.
Querying SQL databases with Qt models databases/tableview.py import os import sys from PyQt6.QtCore import Qt from PyQt6.QtWidgets import QApplication, QMainWindow, QTableView class MainWindow(QMainWindow): def __init__(self): super().__init__() self.table = QTableView() # self.model = ? # self.table.setModel(self.model) self.setCentralWidget(self.table) app = QApplication(sys.argv) window = MainWindow() window.show() app.exec() Con.. 2023. 3. 13.
Tabular data in ModelViews, with numpy & pandas 모델이 Qt가 이해할 수있는 형식으로 해당 데이터를 반환하는 한 모든 데이터 소스에서 모델 뷰를 사용할 수 있습니다. Python에서 표 형식 데이터로 작업하면 해당 데이터를 로드하고 작업하는 방법에 대한 여러 가지 가능성이 열립니다. 여기에서는 간단한 중첩 목록 목록으로 시작한 다음 Qt 응용 프로그램을 인기있는 numpy 및 pandas 라이브러리와 통합하는 단계로 이동합니다. 이렇게 하면 데이터 중심 응용 프로그램을 빌드하기 위한 훌륭한 기반이 제공됩니다. Introduction to QTableView QTableView 는 스프레드 시트와 같은 테이블보기로 데이터를 표시하는 Qt 뷰 위젯입니다. 모델 뷰 아키텍처의 모든 위젯과 마찬가지로 이 위젯은 별도의 모델을 사용하여 뷰에 데이터 및 프리젠테.. 2023. 3. 13.
The Model View Architecture — Model View Controller https://doc.qt.io/qt-5/model-view-programming.html#model-classes Model View Architecture As you start to build more complex applications with PyQt6 you’ll likely come across issues keeping widgets in sync with your data. Data stored in widgets (e.g. a simple QListWidget) is not easy to manipulate from Python — changes require you to get an item, get the data, and then set it back. The default so.. 2023. 3. 13.
Qt Style Sheets (QSS) https://doc.qt.io/qtforpython/overviews/stylesheet-examples.html Qt Style Sheets Examples - Qt for Python Copyright © 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 (https://www.gn doc.qt.io https://github.com/topics/.. 2023. 3. 13.
Icons 15. Icons Icons are small pictures which are used to aid navigation or understanding within a user interface. They are commonly found on buttons, either alongside or in place of text, or alongside actions in menus. By using easily recognizable indicators you can make your interface easier to use. In PyQt6 you have a number of different options for how to source and integrate icons into your appl.. 2023. 3. 13.
Palettes Qt에서 사용자 인터페이스를 그리는 데 사용되는 색상 선택을 팔레트라고합니다. 응용 프로그램 수준과 위젯 별 팔레트는 모두 QPalette 개체를 통해 관리됩니다. 팔레트는 응용 프로그램 수준과 위젯 수준 모두에서 설정할 수 있으므로 전역 표준 팔레트를 설정하고 위젯별로 이를 재정의할 수 있습니다. 전역 팔레트는 일반적으로 Qt 테마 (일반적으로 OS에 따라 다름)에 의해 정의되지만이를 재정의하여 전체 앱의 모양을 변경할 수 있습니다. 활성 전역 팔레트는 QApplication.palette() 에서 액세스하거나 새로운 빈 QPalette 인스턴스를 만들어 액세스 할 수 있습니다. 예를 들면 다음과 같습니다. from PyQt6.QtGui import QPalette palette = QPalette().. 2023. 3. 13.
Styles Styles 스타일은 Qt가 응용 프로그램의 모양과 느낌을 광범위하게 변경하고 위젯이 표시되고 동작하는 방식을 수정하는 방법입니다. Qt는 특정 플랫폼에서 애플리케이션을 실행할 때 플랫폼별 스타일을 자동으로 적용하기 때문에 애플리케이션이 macOS에서 실행될 때 macOS 애플리케이션처럼 보이고 Windows에서 Windows 애플리케이션을 실행할 때 응용 프로그램이 macOS 응용 프로그램처럼 보입니다. 이러한 플랫폼별 스타일은 호스트 플랫폼에서 기본 위젯을 사용하므로 다른 플랫폼에서는 사용할 수 없습니다. 그러나 플랫폼 스타일이 응용 프로그램의 스타일을 지정하는 유일한 옵션은 아닙니다. Qt는 또한 Fusion이라는 크로스 플랫폼 스타일과 함께 제공되어 애플리케이션에 일관된 크로스 플랫폼, 현대적인 .. 2023. 3. 13.
Qt Designer Loading your .ui file in Python designer/example_1.py import os import sys from PyQt6 import QtWidgets, uic basedir = os.path.dirname(__file__) app = QtWidgets.QApplication(sys.argv) window = uic.loadUi(os.path.join(basedir, "mainwindow.ui")) window.show() app.exec() To load a UI from the __init__ block of an existing widget (e.g. a QMainWindow) you can use uic.loadUI(filename, self). designer/e.. 2023. 3. 13.