The QWindow 類錶示在底層窗口係統中的窗口。 更多...
| 頭: | #include <QWindow> |
| qmake: | QT += gui |
| Since: | Qt 5.0 |
| 繼承: | QObject and QSurface |
| 繼承者: | QAbstract3DGraph , QPaintDeviceWindow ,和 QQuickWindow |
| enum | AncestorMode { ExcludeTransients, IncludeTransients } |
| enum | Visibility { Windowed, Minimized, Maximized, FullScreen, AutomaticVisibility, Hidden } |
|
| QWindow (QScreen * targetScreen = Q_NULLPTR) | |
| QWindow (QWindow * parent ) | |
| virtual | ~QWindow () |
| QSize | baseSize () const |
| Qt::ScreenOrientation | contentOrientation () const |
| void | create () |
| QCursor | cursor () const |
| void | destroy () |
| qreal | devicePixelRatio () const |
| QString | filePath () const |
| Qt::WindowFlags | flags () const |
| virtual QObject * | focusObject () const |
| QRect | frameGeometry () const |
| QMargins | frameMargins () const |
| QPoint | framePosition () const |
| QRect | geometry () const |
| int | height () const |
| QIcon | icon () const |
| bool | isActive () const |
| bool | isAncestorOf (const QWindow * child , AncestorMode mode = IncludeTransients) const |
| bool | isExposed () const |
| bool | isModal () const |
| bool | isTopLevel () const |
| bool | isVisible () const |
| QPoint | mapFromGlobal (const QPoint & pos ) const |
| QPoint | mapToGlobal (const QPoint & pos ) const |
| QRegion | mask () const |
| int | maximumHeight () const |
| QSize | maximumSize () const |
| int | maximumWidth () const |
| int | minimumHeight () const |
| QSize | minimumSize () const |
| int | minimumWidth () const |
| Qt::WindowModality | modality () const |
| qreal | opacity () const |
| QWindow * | parent (AncestorMode mode ) const |
| QWindow * | parent () const |
| QPoint | position () const |
| void | reportContentOrientationChange (Qt::ScreenOrientation orientation ) |
| QSurfaceFormat | requestedFormat () const |
| void | resize (const QSize & newSize ) |
| void | resize (int w , int h ) |
| QScreen * | screen () const |
| void | setBaseSize (const QSize & size ) |
| void | setCursor (const QCursor & cursor ) |
| void | setFilePath (const QString & filePath ) |
| void | setFlag (Qt::WindowType flag , bool on = true) |
| void | setFlags (Qt::WindowFlags flags ) |
| void | setFormat (const QSurfaceFormat & format ) |
| void | setFramePosition (const QPoint & point ) |
| void | setGeometry (int posx , int posy , int w , int h ) |
| void | setGeometry (const QRect & rect ) |
| void | setIcon (const QIcon & icon ) |
| bool | setKeyboardGrabEnabled (bool grab ) |
| void | setMask (const QRegion & region ) |
| void | setMaximumSize (const QSize & size ) |
| void | setMinimumSize (const QSize & size ) |
| void | setModality (Qt::WindowModality modality ) |
| bool | setMouseGrabEnabled (bool grab ) |
| void | setOpacity (qreal level ) |
| void | setParent (QWindow * parent ) |
| void | setPosition (const QPoint & pt ) |
| void | setPosition (int posx , int posy ) |
| void | setScreen (QScreen * newScreen ) |
| void | setSizeIncrement (const QSize & size ) |
| void | setSurfaceType (SurfaceType surfaceType ) |
| void | setTransientParent (QWindow * parent ) |
| void | setVisibility (Visibility v ) |
| void | setWindowState (Qt::WindowState state ) |
| QSize | sizeIncrement () const |
| QString | title () const |
| QWindow * | transientParent () const |
| Qt::WindowType | type () const |
| void | unsetCursor () |
| Visibility | visibility () const |
| int | width () const |
| WId | winId () const |
| Qt::WindowState | windowState () const |
| int | x () const |
| int | y () const |
| virtual QSurfaceFormat | format () const |
| virtual QSize | size () const |
| virtual SurfaceType | surfaceType () const |
| void | alert (int msec ) |
| bool | close () |
| void | hide () |
| void | lower () |
| void | raise () |
| void | requestActivate () |
| void | requestUpdate () |
| void | setHeight (int arg ) |
| void | setMaximumHeight (int h ) |
| void | setMaximumWidth (int w ) |
| void | setMinimumHeight (int h ) |
| void | setMinimumWidth (int w ) |
| void | setTitle ( const QString & ) |
| void | setVisible (bool visible ) |
| void | setWidth (int arg ) |
| void | setX (int arg ) |
| void | setY (int arg ) |
| void | show () |
| void | showFullScreen () |
| void | showMaximized () |
| void | showMinimized () |
| void | showNormal () |
| void | activeChanged () |
| void | contentOrientationChanged (Qt::ScreenOrientation orientation ) |
| void | focusObjectChanged (QObject * object ) |
| void | heightChanged (int arg ) |
| void | maximumHeightChanged (int arg ) |
| void | maximumWidthChanged (int arg ) |
| void | minimumHeightChanged (int arg ) |
| void | minimumWidthChanged (int arg ) |
| void | modalityChanged (Qt::WindowModality modality ) |
| void | opacityChanged (qreal opacity ) |
| void | screenChanged (QScreen * screen ) |
| void | visibilityChanged (QWindow::Visibility visibility ) |
| void | visibleChanged (bool arg ) |
| void | widthChanged (int arg ) |
| void | windowStateChanged (Qt::WindowState windowState ) |
| void | windowTitleChanged (const QString & title ) |
| void | xChanged (int arg ) |
| void | yChanged (int arg ) |
| QWindow * | fromWinId (WId id ) |
| virtual void | exposeEvent (QExposeEvent * ev ) |
| virtual void | focusInEvent (QFocusEvent * ev ) |
| virtual void | focusOutEvent (QFocusEvent * ev ) |
| virtual void | hideEvent (QHideEvent * ev ) |
| virtual void | keyPressEvent (QKeyEvent * ev ) |
| virtual void | keyReleaseEvent (QKeyEvent * ev ) |
| virtual void | mouseDoubleClickEvent (QMouseEvent * ev ) |
| virtual void | mouseMoveEvent (QMouseEvent * ev ) |
| virtual void | mousePressEvent (QMouseEvent * ev ) |
| virtual void | mouseReleaseEvent (QMouseEvent * ev ) |
| virtual void | moveEvent (QMoveEvent * ev ) |
| virtual bool | nativeEvent (const QByteArray & eventType , void * message , long * result ) |
| virtual void | resizeEvent (QResizeEvent * ev ) |
| virtual void | showEvent (QShowEvent * ev ) |
| virtual void | tabletEvent (QTabletEvent * ev ) |
| virtual void | touchEvent (QTouchEvent * ev ) |
| virtual void | wheelEvent (QWheelEvent * ev ) |
| virtual bool | event (QEvent * ev ) |
The QWindow 類錶示在底層窗口係統中的窗口。
供給父級的窗口,將變成其父級窗口的本機子級窗口。
應用程序通常使用 QWidget or QQuickView 為其 UI,而不是 QWindow 直接。仍然是可能的直接渲染到 QWindow with QBackingStore or QOpenGLContext ,當希望把依賴關係降到最低 (或想要直接使用 OpenGL) 時。 光柵窗口範例 and OpenGL 窗口範例 是有用參考範例為如何渲染到 QWindow 使用任一方式。
窗口可以潛在使用大量內存。度量通常是寬度乘以高度,乘以顔色深度。窗口還可能包括多個緩衝,以支持雙緩衝和三緩衝,及深度和蠟紙緩衝。要釋放窗口內存資源,調用 destroy () 函數。
QWindow has reportContentOrientationChange () 可以用於指定窗口內容相對屏幕的布局。內容取嚮隻需對窗口係統提示窗口內容的取嚮。它很有用當希望保持相同窗口大小,卻取而代之鏇轉內容,尤其是做不同取嚮之間的鏇轉動畫時。窗口係統可以使用此值,以確定係統彈齣窗口 (或對話框) 的布局。
默認情況下,窗口不可見,且必須調用 setVisible (true),或 show () 或類似的以使之可見。要使窗口再次被隱藏,調用 setVisible (false) 或 hide ()。visible 特性描述應用程序想要窗口所處的狀態。從屬底層係統,可能仍不會在屏幕中展示可見窗口。例如,它可能被其它不透明窗口所覆蓋,或被移到屏幕物理區域外。在擁有暴露通知的窗口係統, isExposed () 訪問器描述窗口是否應該被視為在屏幕中直接可見。 exposeEvent () 函數被調用,每當窗口係統中的窗口曝光改變時。在不使此信息對應用程序可見的窗口係統中, isExposed () 隻需返迴相同值如 isVisible ().
QWindow::Visibility 查詢透過 visibility () 是方便 API 組閤函數 visible() 和 windowState ().
有 2 個 Qt API 可以用於將內容渲染到窗口, QBackingStore 渲染時采用 QPainter 並將內容刷新到窗口按類型 QSurface::RasterSurface ,和 QOpenGLContext 渲染采用 OpenGL 到窗口按類型 QSurface::OpenGLSurface .
應用程序可以盡快啓動渲染當
isExposed
() 返迴
true
,且可以保持渲染直到其
isExposed
() 返迴
false
。要找齣何時
isExposed
() 改變,重實現
exposeEvent
()。窗口會始終獲取重置大小事件,在首個暴露事件之前。
若窗口的寬度和高度未初始化,窗口將從平颱窗口獲得閤理默認幾何體。若位置未初始化,則平颱窗口將允許窗口係統定位窗口。例如,在 X11,窗口管理器通常會做某種智能定位,以試著避免有新窗口完全遮蓋現有窗口。不管怎樣 setGeometry () 初始化位置和大小兩者,所以若需要固定大小而非自動位置,應該調用 resize () 或 setWidth () 和 setHeight () 代替。
此枚舉用於控製是否應該將瞬時父級認為是祖先。
| 常量 | 值 | 描述 |
|---|---|---|
QWindow::ExcludeTransients
|
0
|
瞬時父級不被認為是祖先。 |
QWindow::IncludeTransients
|
1
|
瞬時父級被認為是祖先。 |
此枚舉描述窗口占據 (或應該占據) 屏幕的什麼部分。
| 常量 | 值 | 描述 |
|---|---|---|
QWindow::Windowed
|
2
|
The window occupies part of the screen, but not necessarily the entire screen. This state will occur only on windowing systems which support showing multiple windows simultaneously. In this state it is possible for the user to move and resize the window manually, if WindowFlags permit it and if it is supported by the windowing system. |
QWindow::Minimized
|
3
|
The window is reduced to an entry or icon on the task bar, dock, task list or desktop, depending on how the windowing system handles minimized windows. |
QWindow::Maximized
|
4
|
The window occupies one entire screen, and the titlebar is still visible. On most windowing systems this is the state achieved by clicking the maximize button on the toolbar. |
QWindow::FullScreen
|
5
|
The window occupies one entire screen, is not resizable, and there is no titlebar. On some platforms which do not support showing multiple simultaneous windows, this can be the usual visibility when the window is not hidden. |
QWindow::AutomaticVisibility
|
1
|
This means to give the window a default visible state, which might be fullscreen or windowed depending on the platform. It can be given as a parameter to setVisibility but will never be read back from the visibility accessor. |
QWindow::Hidden
|
0
|
窗口無論如何不可見,不管怎樣,它可能記住可以通過設置 AutomaticVisibility 還原的潛在可見性。 |
該枚舉在 Qt 5.1 引入或被修改。
此特性保持窗口的活動狀態
該特性在 Qt 5.1 引入。
訪問函數:
| bool | isActive () const |
通知程序信號:
| void | activeChanged () |
另請參閱 requestActivate ().
此特性保持窗口內容的取嚮
這是窗口管理器的提示,若它需要顯示相關窗口的額外內容 (像:彈齣窗口、對話框、狀態欄或類似的)。
推薦取嚮為 QScreen::orientation () 但應用程序不必支持所有可能取嚮,因此可以選擇忽略當前屏幕取嚮。
窗口和內容取嚮之間的差異,確定內容的鏇轉量。 QScreen::angleBetween (), QScreen::transformBetween (),和 QScreen::mapBetween () 可以用於計算必要變換。
訪問函數:
| Qt::ScreenOrientation | contentOrientation () const |
| void | reportContentOrientationChange (Qt::ScreenOrientation orientation ) |
通知程序信號:
| void | contentOrientationChanged (Qt::ScreenOrientation orientation ) |
此特性保持窗口的窗口標誌
The window flags control the window's appearance in the windowing system, whether it's a dialog, popup, or a regular window, and whether it should have a title bar, etc.
The actual window flags might differ from the flags set with setFlags() if the requested flags could not be fulfilled.
訪問函數:
| Qt::WindowFlags | flags () const |
| void | setFlags (Qt::WindowFlags flags ) |
另請參閱 setFlag ().
此特性保持窗口幾何體的高度
訪問函數:
| int | height () const |
| void | setHeight (int arg ) |
通知程序信號:
| void | heightChanged (int arg ) |
此特性保持窗口幾何體的最大高度
訪問函數:
| int | maximumHeight () const |
| void | setMaximumHeight (int h ) |
通知程序信號:
| void | maximumHeightChanged (int arg ) |
This property holds the maximum width of the window's geometry
訪問函數:
| int | maximumWidth () const |
| void | setMaximumWidth (int w ) |
通知程序信號:
| void | maximumWidthChanged (int arg ) |
此特性保持窗口幾何體的最小高度
訪問函數:
| int | minimumHeight () const |
| void | setMinimumHeight (int h ) |
通知程序信號:
| void | minimumHeightChanged (int arg ) |
此特性保持窗口幾何體的最小寬度
訪問函數:
| int | minimumWidth () const |
| void | setMinimumWidth (int w ) |
通知程序信號:
| void | minimumWidthChanged (int arg ) |
此特性保持窗口的模態
A modal window prevents other windows from receiving input events. Qt supports two types of modality: Qt::WindowModal and Qt::ApplicationModal .
默認情況下,此特性為 Qt::NonModal
訪問函數:
| Qt::WindowModality | modality () const |
| void | setModality (Qt::WindowModality modality ) |
通知程序信號:
| void | modalityChanged (Qt::WindowModality modality ) |
另請參閱 Qt::WindowModality .
此特性保持窗口係統中窗口的不透明度。
If the windowing system supports window opacity, this can be used to fade the window in and out, or to make it semitransparent.
A value of 1.0 or above is treated as fully opaque, whereas a value of 0.0 or below is treated as fully transparent. Values inbetween represent varying levels of translucency between the two extremes.
默認值為 1.0。
該特性在 Qt 5.1 引入。
訪問函數:
| qreal | opacity () const |
| void | setOpacity (qreal level ) |
通知程序信號:
| void | opacityChanged (qreal opacity ) |
此特性保持窗口係統的窗口標題
The window title might appear in the title area of the window decorations, depending on the windowing system and the window flags. It might also be used by the windowing system to identify the window in other contexts, such as in the task switcher.
訪問函數:
| QString | title () const |
| void | setTitle ( const QString & ) |
通知程序信號:
| void | windowTitleChanged (const QString & title ) |
另請參閱 flags ().
此特性保持窗口的屏幕占用狀態
Visibility is whether the window should appear in the windowing system as normal, minimized, maximized, fullscreen or hidden.
To set the visibility to AutomaticVisibility means to give the window a default visible state, which might be fullscreen or windowed depending on the platform. When reading the visibility property you will always get the actual state, never AutomaticVisibility .
該特性在 Qt 5.1 引入。
訪問函數:
| Visibility | visibility () const |
| void | setVisibility (Visibility v ) |
通知程序信號:
| void | visibilityChanged (QWindow::Visibility visibility ) |
此特性保持窗口是否可見
This property controls the visibility of the window in the windowing system.
By default, the window is not visible, you must call setVisible(true), or show () or similar to make it visible.
訪問函數:
| bool | isVisible () const |
| void | setVisible (bool visible ) |
通知程序信號:
| void | visibleChanged (bool arg ) |
另請參閱 show ().
此特性保持窗口幾何體的寬度
訪問函數:
| int | width () const |
| void | setWidth (int arg ) |
通知程序信號:
| void | widthChanged (int arg ) |
此特性保持窗口幾何體的 X 位置
訪問函數:
| int | x () const |
| void | setX (int arg ) |
通知程序信號:
| void | xChanged (int arg ) |
此特性保持窗口幾何體的 Y 位置
訪問函數:
| int | y () const |
| void | setY (int arg ) |
通知程序信號:
| void | yChanged (int arg ) |
創建頂層窗口在 targetScreen .
窗口不展示直到 setVisible (true), show (),或調用類似的。
另請參閱 setScreen ().
創建窗口作為子級,為給定 parent 窗口。
窗口會被嵌入在父級窗口內,其坐標相對於父級。
屏幕繼承自父級。
另請參閱 setParent ().
[虛擬]
QWindow::
~QWindow
()
銷毀窗口。
[slot]
void
QWindow::
alert
(
int
msec
)
導緻展示警報
msec
毫秒。若
msec
is
0
(默認),則無限期展示警報,直到窗口再次變為活動為止。此函數對活動窗口不起作用。
在警報狀態下,窗口指示 "要求關注",例如:通過刷新 (或彈跳) 任務欄條目。
該函數在 Qt 5.1 引入。
返迴窗口的基尺寸。
另請參閱 setBaseSize ().
[slot]
bool
QWindow::
close
()
關閉窗口。
這關閉窗口,高效調用
destroy
(),且潛在離開應用程序。返迴
true
當成功時,false 若它擁有父級窗口 (在這種情況下,取而代之應關閉頂層窗口)。
另請參閱 destroy () 和 QGuiApplication::quitOnLastWindowClosed ().
分配窗口關聯的平颱資源。
It is at this point that the surface format set using setFormat () gets resolved into an actual native surface. However, the window remains hidden until setVisible () 被調用。
Note that it is not usually necessary to call this function directly, as it will be implicitly called by show (), setVisible (), and other functions that require access to the platform resources.
調用 destroy () 以釋放平颱資源,若有必要。
另請參閱 destroy ().
用於此窗口的光標形狀
另請參閱 setCursor () 和 unsetCursor ().
釋放關聯此窗口的本機平颱資源。
另請參閱 create ().
Returns the ratio between physical pixels and device-independent pixels for the window. This value is dependent on the screen the window is on, and may change when the window is moved.
Common values are 1.0 on normal displays and 2.0 on Apple "retina" displays.
注意: For windows not backed by a platform window, meaning that create () was not called, the function will fall back to the associated QScreen 的設備像素比率。
另請參閱 QScreen::devicePixelRatio ().
[virtual protected]
bool
QWindow::
event
(
QEvent
*
ev
)
重實現自 QObject::event ().
覆寫此以處理任何事件 (
ev
) 被發送給窗口。返迴
true
若事件被識彆並處理。
記得調用基類版本,若希望如往常一樣分派鼠標事件、鍵事件、重置大小事件、等。
[virtual protected]
void
QWindow::
exposeEvent
(
QExposeEvent
*
ev
)
暴露事件 ( ev ) 由窗口係統所發送,每當屏幕窗口曝光改變時。
應用程序可以開始渲染到窗口,采用 QBackingStore and QOpenGLContext 一旦它獲得 exposeEvent(),這樣 isExposed () 為 true。
若窗口被移齣屏幕,完全被另一窗口、圖標化或類似窗口所遮蓋,可能調用此函數,且值的 isExposed () 可能變為 false。當這發生時,應用程序應停止其渲染,因為它對用戶不再可見。
重置大小事件將始終被發送,在暴露事件首次展示窗口之前。
另請參閱 isExposed ().
錶示此窗口的文件名。
另請參閱 setFilePath ().
[virtual protected]
void
QWindow::
focusInEvent
(
QFocusEvent
*
ev
)
覆寫此以處理聚焦入事件 ( ev ).
發送聚焦入事件,當窗口接收鍵盤聚焦時。
另請參閱 focusOutEvent ().
[虛擬]
QObject
*QWindow::
focusObject
() const
返迴 QObject 將是聚焦捆綁事件 (譬如:鍵事件) 的最終接收者。
[signal]
void
QWindow::
focusObjectChanged
(
QObject
*
object
)
此信號被發射,當聚焦捆綁事件的最終接收者變為 object .
另請參閱 focusObject ().
[virtual protected]
void
QWindow::
focusOutEvent
(
QFocusEvent
*
ev
)
覆寫此以處理聚焦齣事件 ( ev ).
發送聚焦齣事件,當窗口失去鍵盤聚焦時。
另請參閱 focusInEvent ().
[虛擬]
QSurfaceFormat
QWindow::
format
() const
重實現自 QSurface::format ().
返迴此窗口的實際格式。
After the window has been created, this function will return the actual surface format of the window. It might differ from the requested format if the requested format could not be fulfilled by the platform. It might also be a superset, for example certain buffer sizes may be larger than requested.
注意: Depending on the platform, certain values in this surface format may still contain the requested values, that is, the values that have been passed to setFormat (). Typical examples are the OpenGL version, profile and options. These may not get updated during create () since these are context specific and a single window may be used together with multiple contexts over its lifetime. Use the QOpenGLContext 's format() instead to query such values.
另請參閱 setFormat (), create (), requestedFormat (),和 QOpenGLContext::format ().
返迴窗口幾何體,包括其窗口框架。
幾何體與其屏幕 virtualGeometry() 相關。
另請參閱 geometry () 和 frameMargins ().
返迴窗口周圍的窗口框架邊距。
另請參閱 geometry () 和 frameGeometry ().
返迴窗口的左上位置,包括其窗口框架。
這返迴相同值如 frameGeometry (). topLeft ().
另請參閱 setFramePosition (), geometry (),和 frameGeometry ().
[static]
QWindow
*QWindow::
fromWinId
(
WId
id
)
創建由另一進程 (或由使用 Qt 下本機庫) 創建的窗口的本地錶示。
給定句柄 id 到本機窗口,此方法創建 QWindow 對象可以用於錶示窗口,當援引方法像 setParent () 和 setTransientParent ().
這可以在支持它的平颱中使用,以嵌入 QWindow 在本機窗口,或把本機窗口嵌入在 QWindow .
若外來窗口不被支持,或在平颱插件嵌入本地窗口失敗,此函數返迴 0。
注意: 結果 QWindow 不應用於操縱底層本機窗口 (除重新父級化外),或用於觀察本機窗口的狀態變化。對這類操作的任何支持都是偶然的,高度依賴平颱且未經測試。
另請參閱 setParent () 和 setTransientParent ().
返迴窗口幾何體,不包括窗口框架。
幾何體與其屏幕 virtualGeometry() 相關。
另請參閱 setGeometry (), frameMargins (),和 frameGeometry ().
[slot]
void
QWindow::
hide
()
隱藏窗口。
相當於調用 setVisible (false).
另請參閱 show () 和 setVisible ().
[virtual protected]
void
QWindow::
hideEvent
(
QHideEvent
*
ev
)
覆寫此以處理隱藏事件 ( ev ).
函數被調用,當窗口請求在窗口係統中隱藏時。
設置窗口係統的窗口圖標
另請參閱 setIcon ().
返迴
true
if the window should appear active from a style perspective.
對於擁有輸入聚焦的窗口,及與聚焦窗口在同一父級/瞬時父級鏈中的窗口都如此。
要獲取目前有聚焦的窗口,使用 QGuiApplication::focusWindow ().
注意: getter 函數對於特性 active .
返迴
true
若窗口是祖先對於給定
child
。若
mode
is
IncludeTransients
,則認為瞬時父級也是祖先。
返迴若此窗口暴露於窗口係統。
當未暴露時,窗口由應用程序展示,但尚未展示在窗口係統是,所以,應最小化渲染應用程序及其它圖形活動。
An exposeEvent () 被發送每當此值改變時。
另請參閱 exposeEvent ().
返迴窗口是否是模態的。
模態窗口阻止其它窗口獲取任何輸入。
另請參閱 QWindow::modality .
返迴窗口是否在頂層 (即:沒有父級窗口)。
[virtual protected]
void
QWindow::
keyPressEvent
(
QKeyEvent
*
ev
)
覆寫此以處理鍵按下事件 ( ev ).
另請參閱 keyReleaseEvent ().
[virtual protected]
void
QWindow::
keyReleaseEvent
(
QKeyEvent
*
ev
)
覆寫此以處理鍵釋放事件 ( ev ).
另請參閱 keyPressEvent ().
[slot]
void
QWindow::
lower
()
降低窗口係統中的窗口。
請求降低窗口將齣現在其它窗口下方。
翻譯全局屏幕坐標 pos 到窗口坐標。
另請參閱 mapToGlobal ().
翻譯窗口坐標
pos
到全局屏幕坐標。例如:
mapToGlobal(QPoint(0,0))
將給齣窗口左上像素的全局坐標。
另請參閱 mapFromGlobal ().
返迴窗口中設置的遮罩。
The mask is a hint to the windowing system that the application does not want to receive mouse or touch input outside the given region.
另請參閱 setMask ().
返迴窗口的最大尺寸。
另請參閱 setMaximumSize ().
返迴窗口的最小尺寸。
另請參閱 setMinimumSize ().
[signal]
void
QWindow::
modalityChanged
(
Qt::WindowModality
modality
)
此信號被發射當 Qwindow::modality 特性變為 modality .
注意: 通知程序信號對於特性 modality .
[virtual protected]
void
QWindow::
mouseDoubleClickEvent
(
QMouseEvent
*
ev
)
覆寫此以處理鼠標雙擊事件 ( ev ).
另請參閱 mousePressEvent () 和 QStyleHints::mouseDoubleClickInterval ().
[virtual protected]
void
QWindow::
mouseMoveEvent
(
QMouseEvent
*
ev
)
覆寫此以處理鼠標移動事件 ( ev ).
[virtual protected]
void
QWindow::
mousePressEvent
(
QMouseEvent
*
ev
)
覆寫此以處理鼠標按下事件 ( ev ).
另請參閱 mouseReleaseEvent ().
[virtual protected]
void
QWindow::
mouseReleaseEvent
(
QMouseEvent
*
ev
)
覆寫此以處理鼠標釋放事件 ( ev ).
另請參閱 mousePressEvent ().
[virtual protected]
void
QWindow::
moveEvent
(
QMoveEvent
*
ev
)
覆寫此以處理窗口移動事件 ( ev ).
[virtual protected]
bool
QWindow::
nativeEvent
(const
QByteArray
&
eventType
,
void
*
message
,
long
*
result
)
覆寫此以處理平颱從屬事件。將給定 eventType , message and result .
這會使應用程序不可移植。
纔應返迴 true 若事件已處理。
返迴父級窗口,若有的話。
若 mode is IncludeTransients ,則返迴瞬時父級若沒有父級。
沒有父級的窗口稱為頂層窗口。
該函數在 Qt 5.9 引入。
另請參閱 setParent ().
返迴父級窗口,若有的話。
沒有父級的窗口稱為頂層窗口。
返迴排除任何窗口框架的桌麵窗口位置
另請參閱 setPosition ().
[slot]
void
QWindow::
raise
()
在窗口係統中提升窗口。
請求提升窗口將齣現在其它窗口上方。
[slot]
void
QWindow::
requestActivate
()
請求激活窗口 (即:接收鍵盤聚焦)。
另請參閱 isActive (), QGuiApplication::focusWindow (),和 QWindowsWindowFunctions::setWindowActivationBehavior ().
[slot]
void
QWindow::
requestUpdate
()
調度 QEvent::UpdateRequest 事件以交付到此窗口。
The event is delivered in sync with the display vsync on platforms where this is possible. Otherwise, the event is delivered after a delay of 5 ms. The additional time is there to give the event loop a bit of idle time to gather system events, and can be overridden using the QT_QPA_UPDATE_IDLE_TIME environment variable.
When driving animations, this function should be called once after drawing has completed. Calling this function multiple times will result in a single event being delivered to the window.
子類化的 QWindow 應重實現 event (), intercept the event and call the application's rendering code, then call the base class implementation.
注意: The subclass' reimplementation of event () must invoke the base class implementation, unless it is absolutely sure that the event does not need to be handled by the base class. For example, the default implementation of this function relies on QEvent::Timer events. Filtering them away would therefore break the delivery of the update events.
該函數在 Qt 5.5 引入。
返迴此窗口請求的錶麵格式。
If the requested format was not supported by the platform implementation, the requestedFormat will differ from the actual window format.
此值的設置是采用 setFormat ().
另請參閱 setFormat () 和 format ().
將窗口 (不包括任何窗口框架) 大小設為 newSize
將窗口 (不包括任何窗口框架) 大小設為 QSize 構造自寬度 w 和高度 h
[virtual protected]
void
QWindow::
resizeEvent
(
QResizeEvent
*
ev
)
覆寫此以處理重置大小事件 ( ev ).
The resize event is called whenever the window is resized in the windowing system, either directly through the windowing system acknowledging a setGeometry () 或 resize () request, or indirectly through the user resizing the window manually.
返迴在其中展示窗口的屏幕,或 null 若沒有的話。
對於子級窗口,這返迴相應頂層窗口屏幕。
另請參閱 setScreen () 和 QScreen::virtualSiblings ().
[signal]
void
QWindow::
screenChanged
(
QScreen
*
screen
)
此信號被發射當窗口的 screen 改變,通過明確設置采用 setScreen (),或自動當移除窗口屏幕時。
設置基 size 為窗口。
The base size is used to calculate a proper window size if the window defines sizeIncrement ().
另請參閱 setMinimumSize (), setMaximumSize (), setSizeIncrement (),和 baseSize ().
設置用於此窗口的光標形狀
鼠標 cursor will assume this shape when it is over this window, unless an override cursor is set. See the 預定義光標對象列錶 瞭解有用形狀範圍。
If no cursor has been set, or after a call to unsetCursor (), the parent window's cursor is used.
By default, the cursor has the Qt::ArrowCursor 形狀。
Some underlying window implementations will reset the cursor if it leaves a window even if the mouse is grabbed. If you want to have a cursor set for all windows, even when outside the window, consider QGuiApplication::setOverrideCursor ().
另請參閱 cursor () 和 QGuiApplication::setOverrideCursor ().
set the file name this window is representing.
The windowing system might use filePath to display the path of the document this window is representing in the tile bar.
另請參閱 filePath ().
設置窗口標誌 flag on this window if on 為 true;否則清零標誌。
該函數在 Qt 5.9 引入。
另請參閱 setFlags (), flags (),和 type ().
Sets the window's surface format .
The format determines properties such as color depth, alpha, depth and stencil buffer size, etc. For example, to give a window a transparent background (provided that the window system supports compositing, and provided that other content in the window does not make it opaque again):
QSurfaceFormat format; format.setAlphaBufferSize(8); window.setFormat(format);
The surface format will be resolved in the create () function. Calling this function after create () has been called will not re-resolve the surface format of the native surface.
When the format is not explicitly set via this function, the format returned by QSurfaceFormat::defaultFormat () will be used. This means that when having multiple windows, individual calls to this function can be replaced by one single call to QSurfaceFormat::setDefaultFormat () before creating the first window.
另請參閱 format (), create (), destroy (),和 QSurfaceFormat::setDefaultFormat ().
Sets the upper left position of the window ( point ) including its window frame.
位置與其屏幕的 virtualGeometry() 有關。
另請參閱 framePosition (), setGeometry (),和 frameGeometry ().
將窗口幾何體 (不包括窗口框架) 設為矩形構造自 posx , posy , w and h .
幾何體與其屏幕 virtualGeometry() 相關。
另請參閱 geometry ().
將窗口幾何體 (不包括窗口框架) 設為 rect .
幾何體與其屏幕 virtualGeometry() 相關。
另請參閱 geometry ().
設置窗口 icon in the windowing system
The window icon might be used by the windowing system for example to decorate the window, and/or in the task switcher.
另請參閱 icon ().
Sets whether keyboard grab should be enabled or not ( grab ).
If the return value is true, the window receives all key events until setKeyboardGrabEnabled(false) is called; other windows get no key events at all. Mouse events are not affected. Use setMouseGrabEnabled () 若想要抓取這。
另請參閱 setMouseGrabEnabled ().
Sets the mask of the window.
The mask is a hint to the windowing system that the application does not want to receive mouse or touch input outside the given region .
The window manager may or may not choose to display any areas of the window not included in the mask, thus it is the application's responsibility to clear to transparent the areas that are not part of the mask.
Setting the mask before the window has been created has no effect.
另請參閱 mask ().
Sets the maximum size of the window.
This is a hint to the window manager to prevent resizing above the specified size .
另請參閱 setMinimumSize () 和 maximumSize ().
Sets the minimum size of the window.
This is a hint to the window manager to prevent resizing below the specified size .
另請參閱 setMaximumSize () 和 minimumSize ().
Sets whether mouse grab should be enabled or not ( grab ).
If the return value is true, the window receives all mouse events until setMouseGrabEnabled(false) is called; other windows get no mouse events at all. Keyboard events are not affected. Use setKeyboardGrabEnabled () 若想要抓取這。
另請參閱 setKeyboardGrabEnabled ().
設置 parent 窗口。這將導緻窗口係統管理窗口的裁剪,因此,它將被裁剪到 parent 窗口。
設置 parent 為 0 將使窗口變為頂層窗口。
若 parent 是窗口創建通過 fromWinId (),那麼當前窗口將被嵌入在 parent ,若平颱支持它。
另請參閱 parent ().
把窗口在桌麵上的位置,設為 pt
位置與其屏幕的 virtualGeometry() 有關。
另請參閱 position ().
把窗口在桌麵上的位置,設為 posx , posy
位置與其屏幕的 virtualGeometry() 有關。
另請參閱 position ().
Sets the screen on which the window should be shown.
If the window has been created, it will be recreated on the newScreen .
注意: 若屏幕是多屏幕虛擬桌麵的一部分,窗口不會自動移至 newScreen . To place the window relative to the screen, use the screen's topLeft () position.
This function only works for top level windows.
另請參閱 screen () 和 QScreen::virtualSiblings ().
設置尺寸增量 ( size ) 為窗口。
When the user resizes the window, the size will move in steps of sizeIncrement (). width () pixels horizontally and sizeIncrement (). height () 像素垂直,采用 baseSize () as the basis.
默認情況下,此特性包含 0 大小寬度和高度。
窗口係統可能不支持大小增量。
另請參閱 sizeIncrement (), setBaseSize (), setMinimumSize (),和 setMaximumSize ().
設置 surfaceType 為窗口。
指定窗口為光柵渲染采用 QBackingStore ,或 OpenGL 渲染采用 QOpenGLContext .
The surfaceType will be used when the native surface is created in the create () function. Calling this function after the native surface has been created requires calling destroy () 和 create () to release the old native surface and create a new one.
另請參閱 surfaceType (), QBackingStore , QOpenGLContext , create (),和 destroy ().
設置瞬時 parent
這是代錶給定窗口的對話框 (或彈齣窗口) 的窗口管理器提示。
為促使窗口默認情況下位於其瞬時父級之上的中心,從屬窗口管理器,可能還有必要調用
setFlags
() 采用閤適
Qt::WindowType
(譬如
Qt::Dialog
).
另請參閱 transientParent () 和 parent ().
設置窗口的屏幕占用狀態
窗口 state represents whether the window appears in the windowing system as maximized, minimized, fullscreen, or normal.
枚舉值 Qt::WindowActive 不是可接受參數。
另請參閱 windowState (), showNormal (), showFullScreen (), showMinimized (),和 showMaximized ().
[slot]
void
QWindow::
show
()
展示窗口。
這相當於調用 showFullScreen (), showMaximized (),或 showNormal (), depending on the platform's default behavior for the window type and flags.
另請參閱 showFullScreen (), showMaximized (), showNormal (), hide (), QStyleHints::showIsFullScreen (),和 flags ().
[virtual protected]
void
QWindow::
showEvent
(
QShowEvent
*
ev
)
覆寫此以處理展示事件 ( ev ).
調用函數,當窗口請求變為可見時。
If the window is successfully shown by the windowing system, this will be followed by a resize and an expose event.
[slot]
void
QWindow::
showFullScreen
()
以全屏方式展示窗口。
相當於調用 setWindowState ( Qt::WindowFullScreen ) 然後 setVisible (true)。
另請參閱 setWindowState () 和 setVisible ().
[slot]
void
QWindow::
showMaximized
()
按最大化方式展示窗口。
相當於調用 setWindowState ( Qt::WindowMaximized ) 然後 setVisible (true)。
另請參閱 setWindowState () 和 setVisible ().
[slot]
void
QWindow::
showMinimized
()
按最小化方式展示窗口。
相當於調用 setWindowState ( Qt::WindowMinimized ) 然後 setVisible (true)。
另請參閱 setWindowState () 和 setVisible ().
[slot]
void
QWindow::
showNormal
()
按正常方式 (即:最大化、最小化、或全屏) 展示窗口。
相當於調用 setWindowState ( Qt::WindowNoState ) 然後 setVisible (true)。
另請參閱 setWindowState () 和 setVisible ().
[虛擬]
QSize
QWindow::
size
() const
重實現自 QSurface::size ().
返迴不包括任何窗口框架的窗口大小
另請參閱 resize ().
返迴窗口的大小增量。
另請參閱 setSizeIncrement ().
[虛擬]
SurfaceType
QWindow::
surfaceType
() const
重實現自 QSurface::surfaceType ().
返迴窗口的錶麵類型。
另請參閱 setSurfaceType ().
[virtual protected]
void
QWindow::
tabletEvent
(
QTabletEvent
*
ev
)
覆寫此以處理數位闆按下、移動、及釋放事件 ( ev ).
接近進入和離開事件不會發送給窗口,它們會被交付給應用程序實例。
[virtual protected]
void
QWindow::
touchEvent
(
QTouchEvent
*
ev
)
覆寫此以處理觸摸事件 ( ev ).
返迴窗口的瞬時父級。
另請參閱 setTransientParent () 和 parent ().
返迴窗口的類型。
這返迴錶示窗口是否為對話框、工具提示、彈齣窗口、常規窗口、等的窗口標誌部分。
還原用於此窗口的默認箭頭光標。
[virtual protected]
void
QWindow::
wheelEvent
(
QWheelEvent
*
ev
)
覆寫此以處理鼠標滾輪或其它滾輪事件 ( ev ).
返迴窗口的平颱 ID。
對於此 ID 可能有用的平颱,返迴值將錶示相應屏幕內的唯一窗口。
另請參閱 screen ().
窗口的屏幕占用狀態
另請參閱 setWindowState ().
[signal]
void
QWindow::
windowStateChanged
(
Qt::WindowState
windowState
)
此信號被發射當 windowState 改變,通過明確設置采用 setWindowState (),或自動當用戶點擊標題欄按鈕之一或通過其它方式。