QRect 類

QRect 類使用整數精度,定義平麵矩形。 更多...

頭: #include <QRect>
CMake: find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core

此類 相等可比較 .

此類 相等可比較 with QRectF .

注意: 此類的所有函數 可重入 .

公共函數

QRect ()
QRect (const QPoint & topLeft , const QPoint & bottomRight )
QRect (const QPoint & topLeft , const QSize & size )
QRect (int x , int y , int width , int height )
void adjust (int dx1 , int dy1 , int dx2 , int dy2 )
QRect adjusted (int dx1 , int dy1 , int dx2 , int dy2 ) const
int bottom () const
QPoint bottomLeft () const
QPoint bottomRight () const
QPoint center () const
bool contains (const QPoint & point , bool proper = false) const
bool contains (const QRect & rectangle , bool proper = false) const
bool contains (int x , int y ) const
bool contains (int x , int y , bool proper ) const
void getCoords (int * x1 , int * y1 , int * x2 , int * y2 ) const
void getRect (int * x , int * y , int * width , int * height ) const
int height () const
QRect intersected (const QRect & rectangle ) const
bool intersects (const QRect & rectangle ) const
bool isEmpty () const
bool isNull () const
bool isValid () const
int left () const
QRect marginsAdded (const QMargins & margins ) const
QRect marginsRemoved (const QMargins & margins ) const
void moveBottom (int y )
void moveBottomLeft (const QPoint & position )
void moveBottomRight (const QPoint & position )
void moveCenter (const QPoint & position )
void moveLeft (int x )
void moveRight (int x )
void moveTo (const QPoint & position )
void moveTo (int x , int y )
void moveTop (int y )
void moveTopLeft (const QPoint & position )
void moveTopRight (const QPoint & position )
QRect normalized () const
int right () const
void setBottom (int y )
void setBottomLeft (const QPoint & position )
void setBottomRight (const QPoint & position )
void setCoords (int x1 , int y1 , int x2 , int y2 )
void setHeight (int height )
void setLeft (int x )
void setRect (int x , int y , int width , int height )
void setRight (int x )
void setSize (const QSize & size )
void setTop (int y )
void setTopLeft (const QPoint & position )
void setTopRight (const QPoint & position )
void setWidth (int width )
void setX (int x )
void setY (int y )
QSize size () const
CGRect toCGRect () const
(從 6.4 起) QRectF toRectF () const
int top () const
QPoint topLeft () const
QPoint topRight () const
void translate (int dx , int dy )
void translate (const QPoint & offset )
QRect translated (int dx , int dy ) const
QRect translated (const QPoint & offset ) const
QRect transposed () const
QRect united (const QRect & rectangle ) const
int width () const
int x () const
int y () const
QRect operator& (const QRect & rectangle ) const
QRect & operator&= (const QRect & rectangle )
QRect & operator+= (const QMargins & margins )
QRect & operator-= (const QMargins & margins )
QRect operator| (const QRect & rectangle ) const
QRect & operator|= (const QRect & rectangle )

靜態公共成員

(從 6.0 起) QRect span (const QPoint & p1 , const QPoint & p2 )
bool operator!= (const QRect & lhs , const QRect & rhs )
QRect operator+ (const QMargins & margins , const QRect & rectangle )
QRect operator+ (const QRect & rectangle , const QMargins & margins )
QRect operator- (const QRect & lhs , const QMargins & rhs )
QDataStream & operator<< (QDataStream & stream , const QRect & rectangle )
bool operator== (const QRect & lhs , const QRect & rhs )
QDataStream & operator>> (QDataStream & stream , QRect & rectangle )

詳細描述

矩形通常以左上角和大小形式錶達。大小 (寬度和高度) 對於 QRect 始終相當於形成其渲染基礎的數學矩形。

可以按左、上、寬度及高度的一組整數構造 QRect,或從 QPoint QSize 。以下代碼創建 2 個恒等矩形。

QRect r1(100, 200, 11, 16);
QRect r2(QPoint(100, 200), QSize(11, 16));
					

存在使用左上和右下角坐標創建 QRect 的第 3 構造函數,但推薦避免使用它。其基本原理是齣於曆史原因,值返迴通過 bottom () 和 right () 函數會偏離矩形的真正右下角。

QRect 類提供瞭返迴各種矩形坐標,並使之能夠操縱這些坐標的一批函數。QRect 還提供瞭相對各種坐標移動矩形的函數。此外,存在的 moveTo () 函數能移動矩形,使其左上角留在給定坐標處。另外, translate () 函數相對當前位置將矩形移動給定偏移,和 translated () 函數返迴此矩形的翻譯副本。

The size () 函數返迴矩形的尺度按 QSize 。還可以單獨檢索尺度使用 width () 和 height () 函數。要操縱維度使用 setSize (), setWidth () 或 setHeight () 函數。另外,通過應用設置矩形坐標的函數可以改變大小,例如 setBottom () 或 setRight ().

The contains () 函數告訴給定點是否在矩形內,和 intersects () 函數返迴 true 若此矩形與給定矩形相交。QRect 類還提供 intersected () 函數返迴交集矩形,和 united () 函數返迴包圍給定矩形的矩形,如下所示:

intersected () united ()

The isEmpty () 函數返迴 true if left () > right () 或 top () > bottom ()。注意,空矩形無效: isValid () 函數返迴 true if left () <= right () and top () <= bottom ()。null 矩形 ( isNull () == true) 另一方麵,有將寬度和高度兩者設為 0。

注意,由於 QRect 和 QRectF 的定義,空 QRect 的定義方式在本質上如同 QRectF .

最後,QRect 對象可以流化及比較。

渲染

當使用 抗鋸齒 描繪器,QRect 邊界綫會對稱地渲染在數學矩形邊界綫的 2 側。但當使用彆名描繪器 (默認) 時,應用其它規則。

那麼,當按 1 像素寬鋼筆渲染時,QRect 邊界綫將渲染到數學矩形邊界綫的右側和下方。

當按 2 像素寬鋼筆渲染時,數學矩形將從中間分割邊界綫。將是這種情況每當將鋼筆設為偶數像素時,當以奇數像素鋼筆渲染時,將把備用像素渲染到數學矩形的右側和下方 (如 1 像素情況)。

邏輯錶示 1 像素寬鋼筆
2 像素寬鋼筆 3 像素寬鋼筆

坐標

QRect 類提供瞭返迴各種矩形坐標,並使之能夠操縱這些坐標的一批函數。QRect 還提供瞭相對各種坐標移動矩形的函數。

例如 left (), setLeft () 和 moveLeft () 函數範例: left () 返迴矩形左邊緣的 X 坐標, setLeft () 將矩形左邊緣設為給定 X 坐標 (可能改變寬度,但從不改變矩形的右邊緣) 和 moveLeft () 水平移動整個矩形,使矩形左邊緣留在給定 X 坐標處且其大小保持不變。

注意,由於曆史原因,值返迴通過 bottom () 和 right () 函數會偏離矩形的真正右下角: right () 函數返迴 left () + width () - 1 bottom () 函數返迴 top () + height () - 1 。相同情況是點返迴通過 bottomRight () 方便函數。此外,X 和 Y 坐標對於 topRight () 和 bottomLeft () 函數,分彆包含來自真正右邊緣和底邊緣的相同偏離。

推薦使用 x () + width () 和 y () + height () 查找真正右下角,並避免 right () 和 bottom ()。另一解決方案是使用 QRectF QRectF 類使用浮點精度坐標定義平麵矩形,和 QRectF::right () 和 QRectF::bottom () 函數 do 返迴右坐標和下坐標。

也是可能的,將偏移添加到此矩形的坐標使用 adjust () 函數,及基於原始矩形的調節檢索新矩形是使用 adjusted () 函數。若寬度和高度兩者任一為負,使用 normalized () 函數以檢索角交換矩形。

此外,QRect 提供 getCoords () 函數提取矩形左上角和右下角的位置,和 getRect () 函數提取矩形的左上角、寬度和高度。使用 setCoords () 和 setRect () 函數能一次性操縱矩形的坐標和尺度。

約束

QRect 有限製最小和最大值對於 int 類型。對 QRect 的操作潛在産生超齣此範圍的值,將導緻未定義行為。

另請參閱 QRectF and QRegion .

成員函數文檔編製

[constexpr noexcept] QRect:: QRect ()

構造 null 矩形。

另請參閱 isNull ().

[constexpr noexcept] QRect:: QRect (const QPoint & topLeft , const QPoint & bottomRight )

構造矩形采用給定 topLeft and bottomRight 角,包括兩者。

bottomRight is to higher and to the left of topLeft , the rectangle defined is instead non-inclusive of the corners.

注意: To ensure both points are included regardless of relative order, use span ().

另請參閱 setTopLeft (), setBottomRight (),和 span ().

[constexpr noexcept] QRect:: QRect (const QPoint & topLeft , const QSize & size )

構造矩形采用給定 topLeft 角和給定 size .

另請參閱 setTopLeft () 和 setSize ().

[constexpr noexcept] QRect:: QRect ( int x , int y , int width , int height )

構造矩形采用 ( x , y ) 作為其左上角和給定 width and height .

另請參閱 setRect ().

[constexpr noexcept] void QRect:: adjust ( int dx1 , int dy1 , int dx2 , int dy2 )

添加 dx1 , dy1 , dx2 and dy2 分彆到矩形的現有坐標。

另請參閱 adjusted () 和 setRect ().

[constexpr noexcept] QRect QRect:: adjusted ( int dx1 , int dy1 , int dx2 , int dy2 ) const

返迴新的矩形采用 dx1 , dy1 , dx2 and dy2 分彆添加到此矩形的現有坐標。

另請參閱 adjust ().

[constexpr noexcept] int QRect:: bottom () const

返迴矩形底部邊緣的 Y 坐標。

注意:由於曆史原因,此函數返迴 top () + height () - 1;使用 y () + height () 來檢索為 true 的 Y 坐標。

另請參閱 setBottom (), bottomLeft (),和 bottomRight ().

[constexpr noexcept] QPoint QRect:: bottomLeft () const

返迴矩形的左下角位置。注意,由於曆史原因,此函數返迴 QPoint ( left (), top () + height () - 1).

另請參閱 setBottomLeft (), bottom (),和 left ().

[constexpr noexcept] QPoint QRect:: bottomRight () const

返迴矩形右下角的位置。

注意:由於曆史原因,此函數返迴 QPoint ( left () + width () -1, top () + height () - 1).

另請參閱 setBottomRight (), bottom (),和 right ().

[constexpr noexcept] QPoint QRect:: center () const

返迴矩形的中心點。

另請參閱 moveCenter ().

[noexcept] bool QRect:: contains (const QPoint & point , bool proper = false) const

返迴 true 若給定 point 在矩形內 (或在矩形邊緣上),否則返迴 false 。若 proper 為 True,此函數纔返迴 true 若給定 point is inside 矩形 (即:不在邊緣)。

另請參閱 intersects ().

[noexcept] bool QRect:: contains (const QRect & rectangle , bool proper = false) const

返迴 true 若給定 rectangle 在此矩形內。否則返迴 false 。若 proper 為 True,此函數纔返迴 truerectangle 完全在此矩形內 (不在邊緣上)。

這是重載函數。

[noexcept] bool QRect:: contains ( int x , int y ) const

返迴 true 若點 ( x , y ) 在此矩形內,否則返迴 false .

這是重載函數。

[noexcept] bool QRect:: contains ( int x , int y , bool proper ) const

返迴 true 若點 ( x , y ) 在矩形內 (或在矩形邊緣上),否則返迴 false 。若 proper 為 True,此函數纔返迴 true 若點完全在矩形內 (不在邊緣上)。

這是重載函數。

[constexpr] void QRect:: getCoords ( int * x1 , int * y1 , int * x2 , int * y2 ) const

將矩形左上角位置提取到 * x1 和 * y1 ,和右下角位置到 * x2 和 * y2 .

另請參閱 setCoords () 和 getRect ().

[constexpr] void QRect:: getRect ( int * x , int * y , int * width , int * height ) const

將矩形左上角位置提取到 * x 和 * y ,和其尺度到 * width 和 * height .

另請參閱 setRect () 和 getCoords ().

[constexpr noexcept] int QRect:: height () const

返迴矩形的高度。

另請參閱 setHeight (), width (),和 size ().

[noexcept] QRect QRect:: intersected (const QRect & rectangle ) const

返迴交集為此矩形和給定 rectangle 。注意, r.intersected(s) 相當於 r & s .

另請參閱 intersects (), united (),和 operator&= ().

[noexcept] bool QRect:: intersects (const QRect & rectangle ) const

返迴 true 若此矩形相交給定 rectangle (即:至少有一像素在 2 矩形內),否則返迴 false .

可以檢索交集矩形使用 intersected () 函數。

另請參閱 contains ().

[constexpr noexcept] bool QRect:: isEmpty () const

返迴 true 若矩形為空,否則返迴 false .

空矩形擁有 left () > right () 或 top () > bottom ()。空矩形無效 (即 isEmpty() == ! isValid ()).

使用 normalized () 函數以檢索角交換矩形。

另請參閱 isNull (), isValid (),和 normalized ().

[constexpr noexcept] bool QRect:: isNull () const

返迴 true 若矩形是 null 矩形,否則返迴 false .

null 矩形有將寬度和高度兩者設為 0 (即 right () == left () - 1 and bottom () == top () - 1)。null 矩形也為空,因此無效。

另請參閱 isEmpty () 和 isValid ().

[constexpr noexcept] bool QRect:: isValid () const

返迴 true 若矩形有效,否則返迴 false .

有效矩形擁有 left () <= right () 和 top () <= bottom ()。注意,非通俗操作 (像交集) 對於無效矩形未定義。有效矩形不為空 (即 isValid() == ! isEmpty ()).

另請參閱 isNull (), isEmpty (),和 normalized ().

[constexpr noexcept] int QRect:: left () const

返迴矩形左邊緣的 X 坐標。相當於 x ().

另請參閱 setLeft (), topLeft (),和 bottomLeft ().

[constexpr noexcept] QRect QRect:: marginsAdded (const QMargins & margins ) const

返迴矩形增長按 margins .

另請參閱 operator+= (), marginsRemoved (),和 operator-= ().

[constexpr noexcept] QRect QRect:: marginsRemoved (const QMargins & margins ) const

移除 margins 從矩形,收縮它。

另請參閱 marginsAdded (), operator+= (),和 operator-= ().

[constexpr noexcept] void QRect:: moveBottom ( int y )

垂直移動矩形,使矩形底邊綫留在給定 y 坐標。矩形的大小保持不變。

另請參閱 bottom (), setBottom (),和 moveTop ().

[constexpr noexcept] void QRect:: moveBottomLeft (const QPoint & position )

移動矩形,使左下角留在給定 position 。矩形的大小保持不變。

另請參閱 setBottomLeft (), moveBottom (),和 moveLeft ().

[constexpr noexcept] void QRect:: moveBottomRight (const QPoint & position )

移動矩形,使右下角留在給定 position 。矩形的大小保持不變。

另請參閱 setBottomRight (), moveRight (),和 moveBottom ().

[constexpr noexcept] void QRect:: moveCenter (const QPoint & position )

移動矩形,使中心點位於給定 position 。矩形的大小保持不變。

另請參閱 center ().

[constexpr noexcept] void QRect:: moveLeft ( int x )

水平移動矩形,使矩形左邊緣留在給定 x 坐標。矩形的大小保持不變。

另請參閱 left (), setLeft (),和 moveRight ().

[constexpr noexcept] void QRect:: moveRight ( int x )

水平移動矩形,使矩形右邊緣留在給定 x 坐標。矩形的大小保持不變。

另請參閱 right (), setRight (),和 moveLeft ().

[constexpr noexcept] void QRect:: moveTo (const QPoint & position )

移動矩形,使左上角留在給定 position .

[constexpr noexcept] void QRect:: moveTo ( int x , int y )

移動矩形,使左上角留在給定位置 ( x , y )。矩形的大小保持不變。

另請參閱 translate () 和 moveTopLeft ().

[constexpr noexcept] void QRect:: moveTop ( int y )

垂直移動矩形,使矩形上邊綫留在給定 y 坐標。矩形的大小保持不變。

另請參閱 top (), setTop (),和 moveBottom ().

[constexpr noexcept] void QRect:: moveTopLeft (const QPoint & position )

移動矩形,使左上角留在給定 position 。矩形的大小保持不變。

另請參閱 setTopLeft (), moveTop (),和 moveLeft ().

[constexpr noexcept] void QRect:: moveTopRight (const QPoint & position )

移動矩形,使右上角留在給定 position 。矩形的大小保持不變。

另請參閱 setTopRight (), moveTop (),和 moveRight ().

[noexcept] QRect QRect:: normalized () const

返迴規範化矩形;即:矩形擁有非負值寬度和高度。

width () < 0 函數交換左右角,和它交換上下角若 height () < 0. The corners are at the same time changed from being non-inclusive to inclusive.

另請參閱 isValid () 和 isEmpty ().

返迴矩形右邊的 X 坐標。

注意:由於曆史原因,此函數返迴 left () + width () - 1;使用 x () + width () 以檢索真正 X 坐標。

另請參閱 setRight (), topRight (),和 bottomRight ().

[constexpr noexcept] void QRect:: setBottom ( int y )

將矩形下邊緣設為給定 y 坐標。可能改變高度,但從不會改變矩形的上邊緣。

另請參閱 bottom () 和 moveBottom ().

[constexpr noexcept] void QRect:: setBottomLeft (const QPoint & position )

將矩形左下角設為給定 position 。可能改變大小,但從不會改變矩形的右上角。

另請參閱 bottomLeft () 和 moveBottomLeft ().

[constexpr noexcept] void QRect:: setBottomRight (const QPoint & position )

將矩形右下角設為給定 position 。可能改變大小,但從不改變矩形左上角。

另請參閱 bottomRight () 和 moveBottomRight ().

[constexpr noexcept] void QRect:: setCoords ( int x1 , int y1 , int x2 , int y2 )

將矩形左上角坐標設為 ( x1 , y1 ),和它的右下角坐標到 ( x2 , y2 ).

另請參閱 getCoords () 和 setRect ().

[constexpr noexcept] void QRect:: setHeight ( int height )

將矩形高度設為給定 height 。下邊緣改變,但不改變上邊緣。

另請參閱 height () 和 setSize ().

[constexpr noexcept] void QRect:: setLeft ( int x )

將矩形左邊緣設為給定 x 坐標。可能改變寬度,但從不會改變矩形的右邊緣。

相當於 setX ().

另請參閱 left () 和 moveLeft ().

[constexpr noexcept] void QRect:: setRect ( int x , int y , int width , int height )

將矩形左上角坐標設為 ( x , y ),和它的大小到給定 width and height .

另請參閱 getRect () 和 setCoords ().

[constexpr noexcept] void QRect:: setRight ( int x )

將矩形右邊緣設為給定 x 坐標。可能改變寬度,但從不會改變矩形的左邊緣。

另請參閱 right () 和 moveRight ().

[constexpr noexcept] void QRect:: setSize (const QSize & size )

將矩形大小設為給定 size 。不移動左上角。

另請參閱 size (), setWidth (),和 setHeight ().

[constexpr noexcept] void QRect:: setTop ( int y )

將矩形上邊緣設為給定 y 坐標。可能改變高度,但從不會改變矩形的下邊緣。

相當於 setY ().

另請參閱 top () 和 moveTop ().

[constexpr noexcept] void QRect:: setTopLeft (const QPoint & position )

將矩形左上角設為給定 position 。可能改變大小,但從不改變矩形的右下角。

另請參閱 topLeft () 和 moveTopLeft ().

[constexpr noexcept] void QRect:: setTopRight (const QPoint & position )

將矩形右上角設為給定 position 。可能改變大小,但從不改變矩形的右下角。

另請參閱 topRight () 和 moveTopRight ().

[constexpr noexcept] void QRect:: setWidth ( int width )

將矩形寬度設為給定 width 。右邊緣改變,但左邊緣不改變。

另請參閱 width () 和 setSize ().

[constexpr noexcept] void QRect:: setX ( int x )

將矩形左邊緣設為給定 x 坐標。可能改變寬度,但從不會改變矩形的右邊緣。

相當於 setLeft ().

另請參閱 x (), setY (),和 setTopLeft ().

[constexpr noexcept] void QRect:: setY ( int y )

將矩形上邊緣設為給定 y 坐標。可能改變高度,但從不會改變矩形的下邊緣。

相當於 setTop ().

另請參閱 y (), setX (),和 setTopLeft ().

[constexpr noexcept] QSize QRect:: size () const

返迴矩形的大小。

另請參閱 setSize (), width (),和 height ().

[static constexpr noexcept, since 6.0] QRect QRect:: span (const QPoint & p1 , const QPoint & p2 )

Returns a rectangle spanning the two points p1 and p2 , including both and everything in between.

該函數在 Qt 6.0 引入。

[noexcept] CGRect QRect:: toCGRect () const

創建 CGRect 從 QRect .

另請參閱 QRectF::fromCGRect ().

[constexpr noexcept, since 6.4] QRectF QRect:: toRectF () const

Returns this rectangle as a rectangle with floating point accuracy.

注意: This function, like the QRectF ( QRect ) constructor, preserves the size () of the rectangle, not its bottomRight () corner.

該函數在 Qt 6.4 引入。

另請參閱 QRectF::toRect ().

[constexpr noexcept] int QRect:: top () const

返迴矩形上邊緣的 Y 坐標。相當於 y ().

另請參閱 setTop (), topLeft (),和 topRight ().

[constexpr noexcept] QPoint QRect:: topLeft () const

返迴矩形左上角的位置。

另請參閱 setTopLeft (), top (),和 left ().

[constexpr noexcept] QPoint QRect:: topRight () const

返迴矩形右上角的位置。

注意:由於曆史原因,此函數返迴 QPoint ( left () + width () -1, top ()).

另請參閱 setTopRight (), top (),和 right ().

[constexpr noexcept] void QRect:: translate ( int dx , int dy )

移動矩形 dx 沿 X 軸和 dy 沿 Y 軸,相對當前位置。正值嚮右下移動矩形。

另請參閱 moveTopLeft (), moveTo (),和 translated ().

[constexpr noexcept] void QRect:: translate (const QPoint & offset )

移動矩形 offset . x () 沿 X 軸和 offset . y () 沿 Y 軸,相對當前位置。

這是重載函數。

[constexpr noexcept] QRect QRect:: translated ( int dx , int dy ) const

返迴的矩形副本有平移 dx 沿 X 軸和 dy 沿 Y 軸,相對當前位置。正值嚮右下移動矩形。

另請參閱 translate ().

[constexpr noexcept] QRect QRect:: translated (const QPoint & offset ) const

返迴的矩形副本有平移 offset . x () 沿 X 軸和 offset . y () 沿 Y 軸,相對當前位置。

這是重載函數。

[constexpr noexcept] QRect QRect:: transposed () const

返迴交換瞭寬度和高度的矩形副本:

QRect r = {15, 51, 42, 24};
r = r.transposed(); // r == {15, 51, 24, 42}
					

另請參閱 QSize::transposed ().

[noexcept] QRect QRect:: united (const QRect & rectangle ) const

返迴邊界矩形為此矩形和給定 rectangle .

另請參閱 intersected ().

[constexpr noexcept] int QRect:: width () const

返迴矩形的寬度。

另請參閱 setWidth (), height (),和 size ().

[constexpr noexcept] int QRect:: x () const

返迴矩形左邊緣的 X 坐標。相當於 left ().

另請參閱 setX (), y (),和 topLeft ().

[constexpr noexcept] int QRect:: y () const

返迴矩形上邊緣的 Y 坐標。相當於 top ().

另請參閱 setY (), x (),和 topLeft ().

[noexcept] QRect QRect:: operator& (const QRect & rectangle ) const

返迴交集為此矩形和給定 rectangle 。返迴空矩形若沒有交集。

另請參閱 operator&= () 和 intersected ().

[noexcept] QRect &QRect:: operator&= (const QRect & rectangle )

相交此矩形與給定 rectangle .

另請參閱 intersected () 和 operator& ().

[constexpr noexcept] QRect &QRect:: operator+= (const QMargins & margins )

添加 margins 到矩形,增長它。

另請參閱 marginsAdded (), marginsRemoved (),和 operator-= ().

[constexpr noexcept] QRect &QRect:: operator-= (const QMargins & margins )

返迴矩形的收縮按 margins .

另請參閱 marginsRemoved (), operator+= (),和 marginsAdded ().

[noexcept] QRect QRect:: operator| (const QRect & rectangle ) const

返迴邊界矩形為此矩形和給定 rectangle .

另請參閱 operator|= () 和 united ().

[noexcept] QRect &QRect:: operator|= (const QRect & rectangle )

聯閤此矩形與給定 rectangle .

另請參閱 united () 和 operator| ().

相關非成員

[constexpr noexcept] bool operator!= (const QRect & lhs , const QRect & rhs )

返迴 true 若矩形 lhs and rhs 不同,否則返迴 false .

[constexpr noexcept] QRect operator+ (const QMargins & margins , const QRect & rectangle )

返迴 rectangle 增長按 margins .

這是重載函數。

[constexpr noexcept] QRect operator+ (const QRect & rectangle , const QMargins & margins )

返迴 rectangle 增長按 margins .

[constexpr noexcept] QRect operator- (const QRect & lhs , const QMargins & rhs )

返迴 lhs rectangle shrunk by the rhs 邊距。

QDataStream & operator<< ( QDataStream & stream , const QRect & rectangle )

寫入給定 rectangle 到給定 stream ,並返迴流引用。

另請參閱 序列化 Qt 數據類型 .

[constexpr noexcept] bool operator== (const QRect & lhs , const QRect & rhs )

返迴 true 若矩形 lhs and rhs 相等,否則返迴 false .

QDataStream & operator>> ( QDataStream & stream , QRect & rectangle )

讀取矩形從給定 stream 進給定 rectangle ,並返迴流引用。

另請參閱 序列化 Qt 數據類型 .