widgets and modules
-
HI,
One of the biggest challanges I seem to face while developing my QT GUI is which module contains the widget I want to work with.Is there a graph or sheet somewhere that shows these relationships easily for QT6?
TIA
@MIckH
Not sure what your issue is. AllQWidgets are in the ... widgets module. You look at the docs page to see what to include, e.g. https://doc.qt.io/qt-6/qspinbox.html tells you to#include <QSpinBox>. The various widget classes are listed on Widgets Classes. -
@MIckH
Not sure what your issue is. AllQWidgets are in the ... widgets module. You look at the docs page to see what to include, e.g. https://doc.qt.io/qt-6/qspinbox.html tells you to#include <QSpinBox>. The various widget classes are listed on Widgets Classes.@JonB
ok, i'll be more specific. while you are right about them all being in 'widgets' its not best practice to just call that module for everythingHere is what Im talking about:
from PyQt6.QtCore import Qt from PyQt6.QtGui import QStandardItemModel, QStandardItem, QFont, QBrush from PyQt6.QtWidgets import QApplication, QMainWindow, QTableView, QWidget from PyQt6.QtCore import Qt, QItemSelectionModel from PyQt6.QtWidgets import QComboBox, QPushButton, QCheckBox, QStyledItemDelegate from PyQt6.QtGui import QGuiApplicationIm looking for a list, cheatsheet etc that details the heirachy of the widget classes so I know which module to import them from.
(I know that example is messy)Also, does anyone know why Vscode gives the following warning when its clearly not true?
No name 'QComboBox' in module 'PyQt6.QtWidgets'PylintE0611:no-name-in-module
cheers
-
@JonB
ok, i'll be more specific. while you are right about them all being in 'widgets' its not best practice to just call that module for everythingHere is what Im talking about:
from PyQt6.QtCore import Qt from PyQt6.QtGui import QStandardItemModel, QStandardItem, QFont, QBrush from PyQt6.QtWidgets import QApplication, QMainWindow, QTableView, QWidget from PyQt6.QtCore import Qt, QItemSelectionModel from PyQt6.QtWidgets import QComboBox, QPushButton, QCheckBox, QStyledItemDelegate from PyQt6.QtGui import QGuiApplicationIm looking for a list, cheatsheet etc that details the heirachy of the widget classes so I know which module to import them from.
(I know that example is messy)Also, does anyone know why Vscode gives the following warning when its clearly not true?
No name 'QComboBox' in module 'PyQt6.QtWidgets'PylintE0611:no-name-in-module
cheers
Aside from the documentation page of any class telling you which module it is in,


there is All Classes by Module and other views accessible from hereAs for why Pylint reports that, you'd have to look at the limits of that tool and the Python wrapper provided by Riverbank.
-
Aside from the documentation page of any class telling you which module it is in,


there is All Classes by Module and other views accessible from hereAs for why Pylint reports that, you'd have to look at the limits of that tool and the Python wrapper provided by Riverbank.