zoukankan      html  css  js  c++  java
  • PyQt 学习笔记4——库结构

    代码结构

    PyQt安装完后PythonLibsite-packagesPyQt5 有相关的pyd文件,这个是编译后的python库文件,相当于DLL或者是SO库文件,代码编辑器无法直接预览, 所以Pycharm帮我们根据pyd反编译得到:
    C:Usersxxxx.PyCharm2018.3systempython_stubs498501734PyQt5Qt.py 这个文件是方便查看接口的参数和返回值及文档说明

    PyQt 包涵的代码模块

    PyQt 给我们提供了很多各种功能的模块,包涵UI、网络、多媒体、线程、硬件操作等模块, 下面罗列了相关的模块和功能说明,现有个大概的了解,用到时再去官网查阅相关模块的类和使用说明

    模块名 功能
    Enginio 访问Qt Cloud Services的类(不建议使用)
    QAxContainer 用于访问ActiveX控件和COM对象的类
    Qt 其他模块的合并
    Qt3DAnimation 在模拟中支持动画的类
    Qt3DCore 支持近实时仿真系统的核心类
    Qt3DExtras 与Qt3D一起使用的预构建元素
    Qt3DInput 使用Qt3D时处理用户输入的类
    Qt3DLogic 启用帧同步的类
    Qt3DRender 启用2D和3D渲染的类
    QtAndroidExtras 特定于Android的其他类
    QtBluetooth 类支持蓝牙设备之间的连接
    QtChart 支持2D图表创建的类
    QtCore Qt核心类包涵QObject等类,有关信号、曹、事件循环等底层操作
    QtDBus 使用D-Bus协议支持IPC的类
    QtDataVisualization 支持3D数据可视化的类
    QtDesigner 允许使用Python扩展Qt Designer的类
    QtGui 小部件和OpenGL GUI共有的核心类
    QtHelp 用于创建和查看可搜索文档的类
    QtLocation 用于创建映射应用程序的类
    QtMacExtras 特定于macOS和iOS的其他类
    QtMultimedia 多媒体内容,照相机和音频等类
    QtMultimediaWidgets 提供其他与多媒体相关的小部件和控件
    QtNetwork 核心网类
    QtNetworkAuth 网络授权类
    QtNfc 支持NFC的设备之间的连接性的类
    QtOpenGL 在传统小部件中渲染OpenGL的类(不建议使用)
    QtPositioning 用于从卫星,wifi等获取定位信息的类。
    QtPrintSuptport 打印支持的类
    QtPurchasing 支持从应用商店中进行应用内购买的类
    QtQml 与QML语言集成的类
    QtQuick 使用Python代码扩展QML应用程序的类
    QtQuickWidgets 用于在传统小部件中渲染QML场景的类
    QtRemoteObjects 用于在进程或系统之间共享QObject的API的类
    QtSensors 用于访问系统的硬件传感器的类
    QtSerialPort 用于访问系统串行端口的类
    QtSql 与SQL数据库集成的类
    QtSvg 提供SVG支持的类
    QtTest 支持GUI应用程序的单元测试
    QtWebChannel 在Python和HTML / JavaScript之间进行点对点通信的类
    QtWebEngine 用于将QML Web Engine对象与Python集成的类
    QtWebEngineCore 核心Web引擎类
    QtWebEngineWidgets 基于Chromium的Web浏览器
    QtWebKit 基于WebKit2的Web浏览器(不建议使用)
    QtWebKitWidgets 基于WebKit1的Web浏览器(不建议使用)
    QtWebSockets 实现WebSocket协议的类
    QtWidgets 用于创建经典桌面式UI的类
    QtWinExtras Windows特有的其他类
    QtX11Extras X11特有的其他类
    QtXml 支持XML的SAX和DOM接口的类
    QtXmlPatterns 支持其他XML技术的类。
    sip 绑定开发人员和用户的实用程序
    uic 用于处理Qt Designer创建的文件的类

    使用得时候需要什么模块到PyQt/Qt.py查看,并导入就可以了

    
    from PyQt5.QtBluetooth import (QBluetooth, QBluetoothAddress, 
        QBluetoothDeviceDiscoveryAgent, QBluetoothDeviceInfo, QBluetoothHostInfo, 
        QBluetoothLocalDevice, QBluetoothServer, QBluetoothServiceDiscoveryAgent, 
        QBluetoothServiceInfo, QBluetoothSocket, QBluetoothTransferManager, 
        QBluetoothTransferReply, QBluetoothTransferRequest, QBluetoothUuid, 
        QLowEnergyAdvertisingData, QLowEnergyAdvertisingParameters, 
        QLowEnergyCharacteristic, QLowEnergyCharacteristicData, 
        QLowEnergyConnectionParameters, QLowEnergyController, 
        QLowEnergyDescriptor, QLowEnergyDescriptorData, QLowEnergyService, 
        QLowEnergyServiceData)
    
    from PyQt5.QtCore import (QAbstractAnimation, QAbstractEventDispatcher, 
        QAbstractItemModel, QAbstractListModel, QAbstractNativeEventFilter, 
        QAbstractProxyModel, QAbstractState, QAbstractTableModel, 
        QAbstractTransition, QAnimationGroup, QBasicTimer, QBitArray, QBuffer, 
        QByteArray, QByteArrayMatcher, QCborError, QCborKnownTags, 
        QCborSimpleType, QCborStreamReader, QCborStreamWriter, QChildEvent, 
        QCollator, QCollatorSortKey, QCommandLineOption, QCommandLineParser, 
        QConcatenateTablesProxyModel, QCoreApplication, QCryptographicHash, 
        QDataStream, QDate, QDateTime, QDeadlineTimer, QDir, QDirIterator, 
        QDynamicPropertyChangeEvent, QEasingCurve, QElapsedTimer, QEvent, 
        QEventLoop, QEventLoopLocker, QEventTransition, QFile, QFileDevice, 
        QFileInfo, QFileSelector, QFileSystemWatcher, QFinalState, 
        QGenericArgument, QGenericReturnArgument, QHistoryState, QIODevice, 
        QIdentityProxyModel, QItemSelection, QItemSelectionModel, 
        QItemSelectionRange, QJsonDocument, QJsonParseError, QJsonValue, QLibrary, 
        QLibraryInfo, QLine, QLineF, QLocale, QLockFile, QLoggingCategory, 
        QMargins, QMarginsF, QMessageAuthenticationCode, QMessageLogContext, 
        QMessageLogger, QMetaClassInfo, QMetaEnum, QMetaMethod, QMetaObject, 
        QMetaProperty, QMetaType, QMimeData, QMimeDatabase, QMimeType, 
        QModelIndex, QMutex, QMutexLocker, QObject, QObjectCleanupHandler, 
        QOperatingSystemVersion, QParallelAnimationGroup, QPauseAnimation, 
        QPersistentModelIndex, QPluginLoader, QPoint, QPointF, QProcess, 
        QProcessEnvironment, QPropertyAnimation, QRandomGenerator, QReadLocker, 
        QReadWriteLock, QRect, QRectF, QRegExp, QRegularExpression, 
        QRegularExpressionMatch, QRegularExpressionMatchIterator, QResource, 
        QRunnable, QSaveFile, QSemaphore, QSemaphoreReleaser, 
        QSequentialAnimationGroup, QSettings, QSharedMemory, QSignalBlocker, 
        QSignalMapper, QSignalTransition, QSize, QSizeF, QSocketNotifier, 
        QSortFilterProxyModel, QStandardPaths, QState, QStateMachine, 
        QStorageInfo, QStringListModel, QSysInfo, QSystemSemaphore, 
        QT_TRANSLATE_NOOP, QT_TR_NOOP, QT_TR_NOOP_UTF8, QTemporaryDir, 
        QTemporaryFile, QTextBoundaryFinder, QTextCodec, QTextDecoder, 
        QTextEncoder, QTextStream, QTextStreamManipulator, QThread, QThreadPool, 
        QTime, QTimeLine, QTimeZone, QTimer, QTimerEvent, QTranslator, 
        QTransposeProxyModel, QUrl, QUrlQuery, QUuid, QVariant, QVariantAnimation, 
        QVersionNumber, QWaitCondition, QWinEventNotifier, QWriteLocker, 
        QXmlStreamAttribute, QXmlStreamAttributes, QXmlStreamEntityDeclaration, 
        QXmlStreamEntityResolver, QXmlStreamNamespaceDeclaration, 
        QXmlStreamNotationDeclaration, QXmlStreamReader, QXmlStreamWriter, Q_ARG, 
        Q_CLASSINFO, Q_ENUM, Q_ENUMS, Q_FLAG, Q_FLAGS, Q_RETURN_ARG, Qt, 
        QtCriticalMsg, QtDebugMsg, QtFatalMsg, QtInfoMsg, QtMsgType, QtSystemMsg, 
        QtWarningMsg, bin_, bom, center, dec, endl, fixed, flush, forcepoint, 
        forcesign, hex_, left, lowercasebase, lowercasedigits, noforcepoint, 
        noforcesign, noshowbase, oct_, pyqt5_enable_new_onexit_scheme, 
        pyqtBoundSignal, pyqtPickleProtocol, pyqtProperty, pyqtRemoveInputHook, 
        pyqtRestoreInputHook, pyqtSetPickleProtocol, pyqtSignal, pyqtSlot, qAbs, 
        qAddPostRoutine, qAddPreRoutine, qChecksum, qCompress, qCritical, qDebug, 
        qEnvironmentVariable, qErrnoWarning, qFatal, qFloatDistance, 
        qFormatLogMessage, qFuzzyCompare, qInf, qInfo, qInstallMessageHandler, 
        qIsFinite, qIsInf, qIsNaN, qIsNull, qQNaN, qRegisterResourceData, 
        qRemovePostRoutine, qRound, qRound64, qSNaN, qSetFieldWidth, 
        qSetMessagePattern, qSetPadChar, qSetRealNumberPrecision, qSharedBuild, 
        qUncompress, qUnregisterResourceData, qVersion, qWarning, qrand, qsrand, 
        reset, right, scientific, showbase, uppercasebase, uppercasedigits, ws)
    
    from PyQt5.QtDBus import (QDBus, QDBusAbstractAdaptor, QDBusAbstractInterface, 
        QDBusArgument, QDBusConnection, QDBusConnectionInterface, QDBusError, 
        QDBusInterface, QDBusMessage, QDBusObjectPath, QDBusPendingCall, 
        QDBusPendingCallWatcher, QDBusPendingReply, QDBusReply, 
        QDBusServiceWatcher, QDBusSignature, QDBusUnixFileDescriptor, 
        QDBusVariant)
    
    from PyQt5.QtDesigner import (QAbstractExtensionFactory, 
        QAbstractExtensionManager, QAbstractFormBuilder, 
        QDesignerActionEditorInterface, QDesignerContainerExtension, 
        QDesignerCustomWidgetCollectionInterface, QDesignerCustomWidgetInterface, 
        QDesignerFormEditorInterface, QDesignerFormWindowCursorInterface, 
        QDesignerFormWindowInterface, QDesignerFormWindowManagerInterface, 
        QDesignerMemberSheetExtension, QDesignerObjectInspectorInterface, 
        QDesignerPropertyEditorInterface, QDesignerPropertySheetExtension, 
        QDesignerTaskMenuExtension, QDesignerWidgetBoxInterface, 
        QExtensionFactory, QExtensionManager, QFormBuilder, 
        QPyDesignerContainerExtension, QPyDesignerCustomWidgetCollectionPlugin, 
        QPyDesignerCustomWidgetPlugin, QPyDesignerMemberSheetExtension, 
        QPyDesignerPropertySheetExtension, QPyDesignerTaskMenuExtension)
    
    from PyQt5.QtGui import (QAbstractOpenGLFunctions, 
        QAbstractTextDocumentLayout, QActionEvent, QBackingStore, QBitmap, QBrush, 
        QClipboard, QCloseEvent, QColor, QConicalGradient, QContextMenuEvent, 
        QCursor, QDesktopServices, QDoubleValidator, QDrag, QDragEnterEvent, 
        QDragLeaveEvent, QDragMoveEvent, QDropEvent, QEnterEvent, QExposeEvent, 
        QFileOpenEvent, QFocusEvent, QFont, QFontDatabase, QFontInfo, 
        QFontMetrics, QFontMetricsF, QGlyphRun, QGradient, QGuiApplication, 
        QHelpEvent, QHideEvent, QHoverEvent, QIcon, QIconDragEvent, QIconEngine, 
        QImage, QImageIOHandler, QImageReader, QImageWriter, QInputEvent, 
        QInputMethod, QInputMethodEvent, QInputMethodQueryEvent, QIntValidator, 
        QKeyEvent, QKeySequence, QLinearGradient, QMatrix2x2, QMatrix2x3, 
        QMatrix2x4, QMatrix3x2, QMatrix3x3, QMatrix3x4, QMatrix4x2, QMatrix4x3, 
        QMatrix4x4, QMouseEvent, QMoveEvent, QMovie, QNativeGestureEvent, 
        QOffscreenSurface, QOpenGLBuffer, QOpenGLContext, QOpenGLContextGroup, 
        QOpenGLDebugLogger, QOpenGLDebugMessage, QOpenGLFramebufferObject, 
        QOpenGLFramebufferObjectFormat, QOpenGLPaintDevice, 
        QOpenGLPixelTransferOptions, QOpenGLShader, QOpenGLShaderProgram, 
        QOpenGLTexture, QOpenGLTextureBlitter, QOpenGLTimeMonitor, 
        QOpenGLTimerQuery, QOpenGLVersionProfile, QOpenGLVertexArrayObject, 
        QOpenGLWindow, QPageLayout, QPageSize, QPagedPaintDevice, QPaintDevice, 
        QPaintDeviceWindow, QPaintEngine, QPaintEngineState, QPaintEvent, 
        QPainter, QPainterPath, QPainterPathStroker, QPalette, QPdfWriter, QPen, 
        QPicture, QPictureIO, QPixelFormat, QPixmap, QPixmapCache, 
        QPlatformSurfaceEvent, QPointingDeviceUniqueId, QPolygon, QPolygonF, 
        QQuaternion, QRadialGradient, QRasterWindow, QRawFont, QRegExpValidator, 
        QRegion, QRegularExpressionValidator, QResizeEvent, QRgba64, QScreen, 
        QScrollEvent, QScrollPrepareEvent, QSessionManager, QShortcutEvent, 
        QShowEvent, QStandardItem, QStandardItemModel, QStaticText, 
        QStatusTipEvent, QStyleHints, QSurface, QSurfaceFormat, 
        QSyntaxHighlighter, QTabletEvent, QTextBlock, QTextBlockFormat, 
        QTextBlockGroup, QTextBlockUserData, QTextCharFormat, QTextCursor, 
        QTextDocument, QTextDocumentFragment, QTextDocumentWriter, QTextFormat, 
        QTextFragment, QTextFrame, QTextFrameFormat, QTextImageFormat, 
        QTextInlineObject, QTextItem, QTextLayout, QTextLength, QTextLine, 
        QTextList, QTextListFormat, QTextObject, QTextObjectInterface, 
        QTextOption, QTextTable, QTextTableCell, QTextTableCellFormat, 
        QTextTableFormat, QTouchDevice, QTouchEvent, QTransform, QValidator, 
        QVector2D, QVector3D, QVector4D, QWhatsThisClickedEvent, QWheelEvent, 
        QWindow, QWindowStateChangeEvent, qAlpha, qBlue, qGray, qGreen, qIsGray, 
        qPixelFormatAlpha, qPixelFormatCmyk, qPixelFormatGrayscale, 
        qPixelFormatHsl, qPixelFormatHsv, qPixelFormatRgba, qPixelFormatYuv, 
        qPremultiply, qRed, qRgb, qRgba, qRgba64, qUnpremultiply, 
        qt_set_sequence_auto_mnemonic)
    
    from PyQt5.QtHelp import (QCompressedHelpInfo, QHelpContentItem, 
        QHelpContentModel, QHelpContentWidget, QHelpEngine, QHelpEngineCore, 
        QHelpFilterData, QHelpFilterEngine, QHelpIndexModel, QHelpIndexWidget, 
        QHelpSearchEngine, QHelpSearchQuery, QHelpSearchQueryWidget, 
        QHelpSearchResult, QHelpSearchResultWidget)
    
    from PyQt5.QtLocation import (QGeoCodeReply, QGeoCodingManager, 
        QGeoCodingManagerEngine, QGeoManeuver, QGeoRoute, QGeoRouteLeg, 
        QGeoRouteReply, QGeoRouteRequest, QGeoRouteSegment, QGeoRoutingManager, 
        QGeoRoutingManagerEngine, QGeoServiceProvider, QLocation, 
        QNavigationManager, QPlace, QPlaceAttribute, QPlaceCategory, 
        QPlaceContactDetail, QPlaceContent, QPlaceContentReply, 
        QPlaceContentRequest, QPlaceDetailsReply, QPlaceEditorial, QPlaceIcon, 
        QPlaceIdReply, QPlaceImage, QPlaceManager, QPlaceManagerEngine, 
        QPlaceMatchReply, QPlaceMatchRequest, QPlaceProposedSearchResult, 
        QPlaceRatings, QPlaceReply, QPlaceResult, QPlaceReview, QPlaceSearchReply, 
        QPlaceSearchRequest, QPlaceSearchResult, QPlaceSearchSuggestionReply, 
        QPlaceSupplier, QPlaceUser)
    
    from PyQt5.QtMultimedia import (QAbstractVideoBuffer, QAbstractVideoFilter, 
        QAbstractVideoSurface, QAudio, QAudioBuffer, QAudioDecoder, 
        QAudioDeviceInfo, QAudioEncoderSettings, QAudioFormat, QAudioInput, 
        QAudioOutput, QAudioProbe, QAudioRecorder, QCamera, QCameraExposure, 
        QCameraFocus, QCameraFocusZone, QCameraImageCapture, 
        QCameraImageProcessing, QCameraInfo, QCameraViewfinderSettings, 
        QImageEncoderSettings, QMediaBindableInterface, QMediaContent, 
        QMediaControl, QMediaMetaData, QMediaObject, QMediaPlayer, QMediaPlaylist, 
        QMediaRecorder, QMediaResource, QMediaService, QMediaTimeInterval, 
        QMediaTimeRange, QMultimedia, QRadioData, QRadioTuner, QSound, 
        QSoundEffect, QVideoEncoderSettings, QVideoFilterRunnable, QVideoFrame, 
        QVideoProbe, QVideoSurfaceFormat)
    
    from PyQt5.QtMultimediaWidgets import (QCameraViewfinder, QGraphicsVideoItem, 
        QVideoWidget)
    
    from PyQt5.QtNetwork import (QAbstractNetworkCache, QAbstractSocket, 
        QAuthenticator, QDnsDomainNameRecord, QDnsHostAddressRecord, QDnsLookup, 
        QDnsMailExchangeRecord, QDnsServiceRecord, QDnsTextRecord, QHostAddress, 
        QHostInfo, QHstsPolicy, QHttpMultiPart, QHttpPart, QLocalServer, 
        QLocalSocket, QNetworkAccessManager, QNetworkAddressEntry, 
        QNetworkCacheMetaData, QNetworkConfiguration, 
        QNetworkConfigurationManager, QNetworkCookie, QNetworkCookieJar, 
        QNetworkDatagram, QNetworkDiskCache, QNetworkInterface, QNetworkProxy, 
        QNetworkProxyFactory, QNetworkProxyQuery, QNetworkReply, QNetworkRequest, 
        QNetworkSession, QOcspCertificateStatus, QOcspResponse, 
        QOcspRevocationReason, QPasswordDigestor, QSsl, QSslCertificate, 
        QSslCertificateExtension, QSslCipher, QSslConfiguration, 
        QSslDiffieHellmanParameters, QSslEllipticCurve, QSslError, QSslKey, 
        QSslPreSharedKeyAuthenticator, QSslSocket, QTcpServer, QTcpSocket, 
        QUdpSocket)
    
    from PyQt5.QtNetworkAuth import (QAbstractOAuth, QAbstractOAuth2, 
        QAbstractOAuthReplyHandler, QOAuth1, QOAuth1Signature, 
        QOAuth2AuthorizationCodeFlow, QOAuthHttpServerReplyHandler, 
        QOAuthOobReplyHandler)
    
    from PyQt5.QtNfc import (QNdefFilter, QNdefMessage, QNdefNfcIconRecord, 
        QNdefNfcSmartPosterRecord, QNdefNfcTextRecord, QNdefNfcUriRecord, 
        QNdefRecord, QNearFieldManager, QNearFieldShareManager, 
        QNearFieldShareTarget, QNearFieldTarget, QQmlNdefRecord)
    
    from PyQt5.QtOpenGL import QGL, QGLContext, QGLFormat, QGLWidget
    
    from PyQt5.QtPositioning import (QGeoAddress, QGeoAreaMonitorInfo, 
        QGeoAreaMonitorSource, QGeoCircle, QGeoCoordinate, QGeoLocation, QGeoPath, 
        QGeoPolygon, QGeoPositionInfo, QGeoPositionInfoSource, QGeoRectangle, 
        QGeoSatelliteInfo, QGeoSatelliteInfoSource, QGeoShape, 
        QNmeaPositionInfoSource)
    
    from PyQt5.QtPrintSupport import (QAbstractPrintDialog, QPageSetupDialog, 
        QPrintDialog, QPrintEngine, QPrintPreviewDialog, QPrintPreviewWidget, 
        QPrinter, QPrinterInfo)
    
    from PyQt5.QtQml import (QJSEngine, QJSValue, QJSValueIterator, 
        QQmlAbstractUrlInterceptor, QQmlApplicationEngine, QQmlComponent, 
        QQmlContext, QQmlEngine, QQmlError, QQmlExpression, QQmlExtensionPlugin, 
        QQmlFileSelector, QQmlImageProviderBase, QQmlIncubationController, 
        QQmlIncubator, QQmlListProperty, QQmlListReference, 
        QQmlNetworkAccessManagerFactory, QQmlParserStatus, QQmlProperty, 
        QQmlPropertyMap, QQmlPropertyValueSource, QQmlScriptString, qjsEngine, 
        qmlAttachedPropertiesObject, qmlClearTypeRegistrations, 
        qmlRegisterRevision, qmlRegisterSingletonType, qmlRegisterType, 
        qmlRegisterUncreatableType, qmlTypeId)
    
    from PyQt5.QtQuick import (QQuickAsyncImageProvider, QQuickCloseEvent, 
        QQuickFramebufferObject, QQuickImageProvider, QQuickImageResponse, 
        QQuickItem, QQuickItemGrabResult, QQuickPaintedItem, QQuickRenderControl, 
        QQuickTextDocument, QQuickTextureFactory, QQuickView, QQuickWindow, 
        QSGAbstractRenderer, QSGBasicGeometryNode, QSGClipNode, QSGDynamicTexture, 
        QSGEngine, QSGFlatColorMaterial, QSGGeometry, QSGGeometryNode, 
        QSGImageNode, QSGMaterial, QSGMaterialShader, QSGMaterialType, QSGNode, 
        QSGOpacityNode, QSGOpaqueTextureMaterial, QSGRectangleNode, QSGRenderNode, 
        QSGRendererInterface, QSGSimpleRectNode, QSGSimpleTextureNode, QSGTexture, 
        QSGTextureMaterial, QSGTextureProvider, QSGTransformNode, 
        QSGVertexColorMaterial)
    
    from PyQt5.QtQuickWidgets import QQuickWidget
    
    from PyQt5.QtRemoteObjects import (QAbstractItemModelReplica, 
        QRemoteObjectAbstractPersistedStore, QRemoteObjectDynamicReplica, 
        QRemoteObjectHost, QRemoteObjectHostBase, QRemoteObjectNode, 
        QRemoteObjectRegistry, QRemoteObjectRegistryHost, QRemoteObjectReplica, 
        QRemoteObjectSourceLocationInfo, QtRemoteObjects)
    
    from PyQt5.QtSensors import (QAccelerometer, QAccelerometerFilter, 
        QAccelerometerReading, QAltimeter, QAltimeterFilter, QAltimeterReading, 
        QAmbientLightFilter, QAmbientLightReading, QAmbientLightSensor, 
        QAmbientTemperatureFilter, QAmbientTemperatureReading, 
        QAmbientTemperatureSensor, QCompass, QCompassFilter, QCompassReading, 
        QDistanceFilter, QDistanceReading, QDistanceSensor, QGyroscope, 
        QGyroscopeFilter, QGyroscopeReading, QHolsterFilter, QHolsterReading, 
        QHolsterSensor, QHumidityFilter, QHumidityReading, QHumiditySensor, 
        QIRProximityFilter, QIRProximityReading, QIRProximitySensor, QLidFilter, 
        QLidReading, QLidSensor, QLightFilter, QLightReading, QLightSensor, 
        QMagnetometer, QMagnetometerFilter, QMagnetometerReading, 
        QOrientationFilter, QOrientationReading, QOrientationSensor, 
        QPressureFilter, QPressureReading, QPressureSensor, QProximityFilter, 
        QProximityReading, QProximitySensor, QRotationFilter, QRotationReading, 
        QRotationSensor, QSensor, QSensorFilter, QSensorReading, QTapFilter, 
        QTapReading, QTapSensor, QTiltFilter, QTiltReading, QTiltSensor, 
        qoutputrange)
    
    from PyQt5.QtSerialPort import QSerialPort, QSerialPortInfo
    
    from PyQt5.QtSql import (QSql, QSqlDatabase, QSqlDriver, 
        QSqlDriverCreatorBase, QSqlError, QSqlField, QSqlIndex, QSqlQuery, 
        QSqlQueryModel, QSqlRecord, QSqlRelation, QSqlRelationalDelegate, 
        QSqlRelationalTableModel, QSqlResult, QSqlTableModel)
    
    from PyQt5.QtSvg import (QGraphicsSvgItem, QSvgGenerator, QSvgRenderer, 
        QSvgWidget)
    
    from PyQt5.QtTest import QAbstractItemModelTester, QSignalSpy, QTest
    
    from PyQt5.QtWebChannel import QWebChannel, QWebChannelAbstractTransport
    
    from PyQt5.QtWebSockets import (QMaskGenerator, QWebSocket, 
        QWebSocketCorsAuthenticator, QWebSocketProtocol, QWebSocketServer)
    
    from PyQt5.QtWidgets import (QAbstractButton, QAbstractGraphicsShapeItem, 
        QAbstractItemDelegate, QAbstractItemView, QAbstractScrollArea, 
        QAbstractSlider, QAbstractSpinBox, QAction, QActionGroup, QApplication, 
        QBoxLayout, QButtonGroup, QCalendarWidget, QCheckBox, QColorDialog, 
        QColumnView, QComboBox, QCommandLinkButton, QCommonStyle, QCompleter, 
        QDataWidgetMapper, QDateEdit, QDateTimeEdit, QDesktopWidget, QDial, 
        QDialog, QDialogButtonBox, QDirModel, QDockWidget, QDoubleSpinBox, 
        QErrorMessage, QFileDialog, QFileIconProvider, QFileSystemModel, 
        QFocusFrame, QFontComboBox, QFontDialog, QFormLayout, QFrame, QGesture, 
        QGestureEvent, QGestureRecognizer, QGraphicsAnchor, QGraphicsAnchorLayout, 
        QGraphicsBlurEffect, QGraphicsColorizeEffect, QGraphicsDropShadowEffect, 
        QGraphicsEffect, QGraphicsEllipseItem, QGraphicsGridLayout, QGraphicsItem, 
        QGraphicsItemGroup, QGraphicsLayout, QGraphicsLayoutItem, 
        QGraphicsLineItem, QGraphicsLinearLayout, QGraphicsObject, 
        QGraphicsOpacityEffect, QGraphicsPathItem, QGraphicsPixmapItem, 
        QGraphicsPolygonItem, QGraphicsProxyWidget, QGraphicsRectItem, 
        QGraphicsRotation, QGraphicsScale, QGraphicsScene, 
        QGraphicsSceneContextMenuEvent, QGraphicsSceneDragDropEvent, 
        QGraphicsSceneEvent, QGraphicsSceneHelpEvent, QGraphicsSceneHoverEvent, 
        QGraphicsSceneMouseEvent, QGraphicsSceneMoveEvent, 
        QGraphicsSceneResizeEvent, QGraphicsSceneWheelEvent, 
        QGraphicsSimpleTextItem, QGraphicsTextItem, QGraphicsTransform, 
        QGraphicsView, QGraphicsWidget, QGridLayout, QGroupBox, QHBoxLayout, 
        QHeaderView, QInputDialog, QItemDelegate, QItemEditorCreatorBase, 
        QItemEditorFactory, QKeyEventTransition, QKeySequenceEdit, QLCDNumber, 
        QLabel, QLayout, QLayoutItem, QLineEdit, QListView, QListWidget, 
        QListWidgetItem, QMainWindow, QMdiArea, QMdiSubWindow, QMenu, QMenuBar, 
        QMessageBox, QMouseEventTransition, QOpenGLWidget, QPanGesture, 
        QPinchGesture, QPlainTextDocumentLayout, QPlainTextEdit, QProgressBar, 
        QProgressDialog, QProxyStyle, QPushButton, QRadioButton, QRubberBand, 
        QScrollArea, QScrollBar, QScroller, QScrollerProperties, QShortcut, 
        QSizeGrip, QSizePolicy, QSlider, QSpacerItem, QSpinBox, QSplashScreen, 
        QSplitter, QSplitterHandle, QStackedLayout, QStackedWidget, QStatusBar, 
        QStyle, QStyleFactory, QStyleHintReturn, QStyleHintReturnMask, 
        QStyleHintReturnVariant, QStyleOption, QStyleOptionButton, 
        QStyleOptionComboBox, QStyleOptionComplex, QStyleOptionDockWidget, 
        QStyleOptionFocusRect, QStyleOptionFrame, QStyleOptionGraphicsItem, 
        QStyleOptionGroupBox, QStyleOptionHeader, QStyleOptionMenuItem, 
        QStyleOptionProgressBar, QStyleOptionRubberBand, QStyleOptionSizeGrip, 
        QStyleOptionSlider, QStyleOptionSpinBox, QStyleOptionTab, 
        QStyleOptionTabBarBase, QStyleOptionTabWidgetFrame, QStyleOptionTitleBar, 
        QStyleOptionToolBar, QStyleOptionToolBox, QStyleOptionToolButton, 
        QStyleOptionViewItem, QStylePainter, QStyledItemDelegate, QSwipeGesture, 
        QSystemTrayIcon, QTabBar, QTabWidget, QTableView, QTableWidget, 
        QTableWidgetItem, QTableWidgetSelectionRange, QTapAndHoldGesture, 
        QTapGesture, QTextBrowser, QTextEdit, QTimeEdit, QToolBar, QToolBox, 
        QToolButton, QToolTip, QTreeView, QTreeWidget, QTreeWidgetItem, 
        QTreeWidgetItemIterator, QUndoCommand, QUndoGroup, QUndoStack, QUndoView, 
        QVBoxLayout, QWhatsThis, QWidget, QWidgetAction, QWidgetItem, QWizard, 
        QWizardPage, qApp, qDrawBorderPixmap, qDrawPlainRect, qDrawShadeLine, 
        qDrawShadePanel, qDrawShadeRect, qDrawWinButton, qDrawWinPanel)
    
    from PyQt5.QtWinExtras import (QWinJumpList, QWinJumpListCategory, 
        QWinJumpListItem, QWinTaskbarButton, QWinTaskbarProgress, 
        QWinThumbnailToolBar, QWinThumbnailToolButton, QtWin)
    
    from PyQt5.QtXml import (QDomAttr, QDomCDATASection, QDomCharacterData, 
        QDomComment, QDomDocument, QDomDocumentFragment, QDomDocumentType, 
        QDomElement, QDomEntity, QDomEntityReference, QDomImplementation, 
        QDomNamedNodeMap, QDomNode, QDomNodeList, QDomNotation, 
        QDomProcessingInstruction, QDomText, QXmlAttributes, QXmlContentHandler, 
        QXmlDTDHandler, QXmlDeclHandler, QXmlDefaultHandler, QXmlEntityResolver, 
        QXmlErrorHandler, QXmlInputSource, QXmlLexicalHandler, QXmlLocator, 
        QXmlNamespaceSupport, QXmlParseException, QXmlReader, QXmlSimpleReader)
    
    from PyQt5.QtXmlPatterns import (QAbstractMessageHandler, 
        QAbstractUriResolver, QAbstractXmlNodeModel, QAbstractXmlReceiver, 
        QSimpleXmlNodeModel, QSourceLocation, QXmlFormatter, QXmlItem, QXmlName, 
        QXmlNamePool, QXmlNodeModelIndex, QXmlQuery, QXmlResultItems, QXmlSchema, 
        QXmlSchemaValidator, QXmlSerializer)
    
    

    上面的py文件很清楚列除了所以PyQt 的类, 以及类所在的模块,这样清晰的罗列类似的结构关系。

    在调试代码得时候,为了方便可以直接全部导入,但是这样会导致占用很多内存,而且运行启动速度,但是很方便,我们在发布代码时候改成按需导入即可

    from PyQt5.Qt import * 
    

    按类名检索

    在PyQ官网还提供了按类名首写字母检索,之前说过PyQt和源生Qt的命名方式完全一样,Qt所以的类都是以打头。官网PyQt类大全
    可以点击下面类的首先字母查看对应的所有类, 然后Ctrl+F查找定位
    3 | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y

    随便点击一个类能进入类的详情页面,里面包涵了该类所属的模块、该类的父类、继承该类的子类、类的描述、枚举常量、接口等信息
    Qwidget类描述

    模块描述

    如上面描述Qt库把各个类集合到特定的功能模块里,下面大致了解一下各个模块的说明
    QtGui 涵盖了各种各样的图形相关功能的类,比如字体、图形、背景、图标、颜色等等操作类;
    QtCore 涵盖了图形无关的Qt核心模块,比如信号/曹、时间、文件、目录、数据、连接、网络等非GUI图形的操作类;
    QtWebKite 涵盖了网页响应的类,使用他可以实现与浏览器类似的功能,实现web展现;
    QtSql 是有关于数据库相关的操作
    Qt 模块在内部导入所有Qt相关类

    Qt 很多类用的时候可能记不清,那比如我想使用QPushButton类应该怎么导入,在哪个模块里?有两种方法可以导入:

    • 方法一
    from Qt import * 
    button = QPushButton()
    
    • 方法二 使用Pycharm开发工具, 把光标放在QPushButton上按 的Alt+Enter 自动导入
  • 相关阅读:
    Codeforces Round #296 (Div. 2B. Error Correct System
    实验十二 图的建立与遍历
    1561: (More) Multiplication
    1562: Fun House
    hdu 2203 亲和串
    hdu 3549Flow Problem
    poj 2182 Lost Cows
    poj 3468A Simple Problem with Integers
    hdu1698 Just a Hook
    栈和队列的面试题Java实现
  • 原文地址:https://www.cnblogs.com/onsunsl/p/PyQt5_Models_List.html
Copyright © 2011-2022 走看看