继承者: QGLPixelBuffer , QGLFramebufferObject , QPrinter , QSvgGenerator , QPicture , QPixmap , QImage , QBitmap , QWidget , QDesktopWidget , QHelpSearchResultWidget , QHelpSearchQueryWidget , QComboBox , QCalendarWidget , QAbstractButton , QPushButton , QCommandLinkButton , QCheckBox , QWizardPage , QWebInspector , QLineEdit , QSvgWidget , Phonon.VolumeSlider , Phonon.VideoPlayer , Phonon.SeekSlider , QWorkspace , QToolButton , QFrame , QToolBox , QAbstractScrollArea , QGraphicsView , QDeclarativeView , QAbstractItemView , QTreeView , QHelpContentWidget , QTreeWidget , QHeaderView , QTableView , QTableWidget , QColumnView , QListView , QUndoView , QListWidget , QHelpIndexWidget , QToolBar , QRubberBand , QTabWidget , QStatusBar , QTabBar , Phonon.EffectWidget , QStackedWidget , QSplitterHandle , QAbstractSlider , QSlider , QDial , QSplitter , QAbstractSpinBox , QDateTimeEdit , QTimeEdit , QDateEdit , QSplashScreen , QDoubleSpinBox , QSpinBox , QSizeGrip , QScrollBar , QScrollArea , QRadioButton , QProgressBar , QDialog , QAbstractPrintDialog , QPrintDialog , QAbstractPageSetupDialog , QPageSetupDialog , QFileDialog , QWizard , QProgressDialog , QPrintPreviewDialog , QFontDialog , QMessageBox , QInputDialog , QErrorMessage , QColorDialog , QPrintPreviewWidget , QPlainTextEdit , QTextEdit , QTextBrowser , QMenuBar , QMenu , QMdiSubWindow , QMdiArea , QMainWindow , QLCDNumber , QLabel , QGroupBox , QFontComboBox , QFocusFrame , QDockWidget , QGLWidget , QDialogButtonBox , QWebView
PySide.QtGui.QPaintDevice class is the base class of objects that can be painted.
A paint device is an abstraction of a two-dimensional space that can be drawn using a PySide.QtGui.QPainter 。它的默认坐标系统原点位于左上角位置。X 向右递增,Y 向下递增。单位是 1 像素。
The drawing capabilities of PySide.QtGui.QPaintDevice are currently implemented by the PySide.QtGui.QWidget , PySide.QtGui.QImage , PySide.QtGui.QPixmap , PySide.QtOpenGL.QGLPixelBuffer , PySide.QtGui.QPicture ,和 PySide.QtGui.QPrinter 子类。
To implement support for a new backend, you must derive from PySide.QtGui.QPaintDevice and reimplement the virtual PySide.QtGui.QPaintDevice.paintEngine() function to tell PySide.QtGui.QPainter which paint engine should be used to draw on this particular device. Note that you also must create a corresponding paint engine to be able to draw on the device, i.e derive from PySide.QtGui.QPaintEngine and reimplement its virtual functions.
警告
Qt requires that a PySide.QtGui.QApplication object exists before any paint devices can be created. Paint devices access window system resources, and these resources are not initialized before an application object is created.
PySide.QtGui.QPaintDevice class provides several functions returning the various device metrics: The PySide.QtGui.QPaintDevice.depth() function returns its bit depth (number of bit planes). The PySide.QtGui.QPaintDevice.height() function returns its height in default coordinate system units (e.g. pixels for PySide.QtGui.QPixmap and PySide.QtGui.QWidget ) while PySide.QtGui.QPaintDevice.heightMM() returns the height of the device in millimeters. Similiarily, the PySide.QtGui.QPaintDevice.width() and PySide.QtGui.QPaintDevice.widthMM() functions return the width of the device in default coordinate system units and in millimeters, respectively. Alternatively, the protected PySide.QtGui.QPaintDevice.metric() function can be used to retrieve the metric information by specifying the desired QPaintDevice.PaintDeviceMetric 作为自变量。
PySide.QtGui.QPaintDevice.logicalDpiX() and PySide.QtGui.QPaintDevice.logicalDpiY() functions return the horizontal and vertical resolution of the device in dots per inch. The PySide.QtGui.QPaintDevice.physicalDpiX() and PySide.QtGui.QPaintDevice.physicalDpiY() functions also return the resolution of the device in dots per inch, but note that if the logical and physical resolution differ, the corresponding PySide.QtGui.QPaintEngine must handle the mapping. Finally, the PySide.QtGui.QPaintDevice.colorCount() function returns the number of different colors available for the paint device.
另请参阅
Constructs a paint device. This constructor can be invoked only from subclasses of PySide.QtGui.QPaintDevice .
描述描绘设备的各种指标。
| 常量 | 描述 |
|---|---|
| QPaintDevice.PdmWidth | The width of the paint device in default coordinate system units (e.g. pixels for PySide.QtGui.QPixmap and PySide.QtGui.QWidget ). See also PySide.QtGui.QPaintDevice.width() . |
| QPaintDevice.PdmHeight | The height of the paint device in default coordinate system units (e.g. pixels for PySide.QtGui.QPixmap and PySide.QtGui.QWidget ). See also PySide.QtGui.QPaintDevice.height() . |
| QPaintDevice.PdmWidthMM | 描绘设备的宽度,以毫米为单位。另请参阅 PySide.QtGui.QPaintDevice.widthMM() . |
| QPaintDevice.PdmHeightMM | 描绘设备的高度,以毫米为单位。另请参阅 PySide.QtGui.QPaintDevice.heightMM() . |
| QPaintDevice.PdmNumColors | The number of different colors available for the paint device. See also PySide.QtGui.QPaintDevice.colorCount() . |
| QPaintDevice.PdmDepth | The bit depth (number of bit planes) of the paint device. See also PySide.QtGui.QPaintDevice.depth() . |
| QPaintDevice.PdmDpiX | 设备的水平分辨率 (以 DPI 每英寸点数为单位)。另请参阅 PySide.QtGui.QPaintDevice.logicalDpiX() . |
| QPaintDevice.PdmDpiY | 设备的垂直分辨率 (以 DPI 每英寸点数为单位)。另请参阅 PySide.QtGui.QPaintDevice.logicalDpiY() . |
| QPaintDevice.PdmPhysicalDpiX | 设备的水平分辨率 (以 DPI 每英寸点数为单位)。另请参阅 PySide.QtGui.QPaintDevice.physicalDpiX() . |
| QPaintDevice.PdmPhysicalDpiY | 设备的垂直分辨率 (以 DPI 每英寸点数为单位)。另请参阅 PySide.QtGui.QPaintDevice.physicalDpiY() . |
| 返回类型: | PySide.QtCore.int |
|---|
Returns the number of different colors available for the paint device. Since this value is an int, it will not be sufficient to represent the number of colors on 32 bit displays, in this case INT_MAX is returned instead.
| 返回类型: | PySide.QtCore.int |
|---|
返回描绘设备的位深度 (位平面的数量)。
| 返回类型: | PySide.QtCore.int |
|---|
Returns the device type identifier, which is QInternal.Widget if the device is a PySide.QtGui.QWidget , QInternal.Pixmap if it's a PySide.QtGui.QPixmap , QInternal.Printer if it's a PySide.QtGui.QPrinter , QInternal.Picture if it's a PySide.QtGui.QPicture ,或 QInternal.UnknownDevice in other cases.
| 返回类型: | PySide.QtCore.int |
|---|
Returns the height of the paint device in default coordinate system units (e.g. pixels for PySide.QtGui.QPixmap and PySide.QtGui.QWidget ).
| 返回类型: | PySide.QtCore.int |
|---|
Returns the height of the paint device in millimeters. Due to platform limitations it may not be possible to use this function to determine the actual physical size of a widget on the screen.
| 返回类型: | PySide.QtCore.int |
|---|
Returns the horizontal resolution of the device in dots per inch, which is used when computing font sizes. For X11, this is usually the same as could be computed from PySide.QtGui.QPaintDevice.widthMM() .
Note that if the PySide.QtGui.QPaintDevice.logicalDpiX() doesn't equal the PySide.QtGui.QPaintDevice.physicalDpiX() , the corresponding PySide.QtGui.QPaintEngine 必须处理分辨率映射。
| 返回类型: | PySide.QtCore.int |
|---|
Returns the vertical resolution of the device in dots per inch, which is used when computing font sizes. For X11, this is usually the same as could be computed from PySide.QtGui.QPaintDevice.heightMM() .
Note that if the PySide.QtGui.QPaintDevice.logicalDpiY() doesn't equal the PySide.QtGui.QPaintDevice.physicalDpiY() , the corresponding PySide.QtGui.QPaintEngine 必须处理分辨率映射。
| 参数: | metric – PySide.QtGui.QPaintDevice.PaintDeviceMetric |
|---|---|
| 返回类型: | PySide.QtCore.int |
Returns the metric information for the given paint device metric .
另请参阅
QPaintDevice.PaintDeviceMetric
| 返回类型: | PySide.QtCore.int |
|---|
使用 PySide.QtGui.QPaintDevice.colorCount() 代替。
Returns the number of different colors available for the paint device. Since this value is an int, it will not be sufficient to represent the number of colors on 32 bit displays, in this case INT_MAX is returned instead.
| 返回类型: | PySide.QtGui.QPaintEngine |
|---|
返回用于在设备上绘制的描绘引擎指针。
| 返回类型: | PySide.QtCore.bool |
|---|
Returns true if the device is currently being painted on, i.e. someone has called QPainter.begin() but not yet called QPainter.end() for this device; otherwise returns false.
另请参阅
| 返回类型: | PySide.QtCore.int |
|---|
Returns the horizontal resolution of the device in dots per inch. For example, when printing, this resolution refers to the physical printer's resolution. The logical DPI on the other hand, refers to the resolution used by the actual paint engine.
Note that if the PySide.QtGui.QPaintDevice.physicalDpiX() doesn't equal the PySide.QtGui.QPaintDevice.logicalDpiX() , the corresponding PySide.QtGui.QPaintEngine 必须处理分辨率映射。
| 返回类型: | PySide.QtCore.int |
|---|
Returns the horizontal resolution of the device in dots per inch. For example, when printing, this resolution refers to the physical printer's resolution. The logical DPI on the other hand, refers to the resolution used by the actual paint engine.
Note that if the PySide.QtGui.QPaintDevice.physicalDpiY() doesn't equal the PySide.QtGui.QPaintDevice.logicalDpiY() , the corresponding PySide.QtGui.QPaintEngine 必须处理分辨率映射。
| 返回类型: | PySide.QtCore.int |
|---|
Returns the width of the paint device in default coordinate system units (e.g. pixels for PySide.QtGui.QPixmap and PySide.QtGui.QWidget ).
| 返回类型: | PySide.QtCore.int |
|---|
Returns the width of the paint device in millimeters. Due to platform limitations it may not be possible to use this function to determine the actual physical size of a widget on the screen.