KanoopCommonQt 2.1.1
Kanoop foundational Qt utility library
Loading...
Searching...
No Matches
Size Class Reference

Extends QSizeF with convenient grow/shrink operations and Rectangle conversion. More...

#include <size.h>

+ Inheritance diagram for Size:
+ Collaboration diagram for Size:

Public Member Functions

 Size ()
 Default constructor — creates a null (0x0) size.
 
 Size (const QSizeF &other)
 Construct from a QSizeF.
 
 Size (const QSize &other)
 Construct from a QSize (integer dimensions).
 
 Size (double w, double h)
 Construct from explicit width and height.
 
Rectangle toRectangle () const
 Convert this size to a Rectangle positioned at the origin.
 
void grow (double amount)
 Grow both dimensions by the given amount.
 
void shrink (double amount)
 Shrink both dimensions by the given amount.
 
QString toString () const
 Format this size as "w, h".
 

Static Public Member Functions

static Size fromString (const QString &value)
 Parse a Size from a string produced by toString().
 

Detailed Description

Extends QSizeF with convenient grow/shrink operations and Rectangle conversion.

Definition at line 14 of file size.h.

Constructor & Destructor Documentation

◆ Size() [1/4]

Size::Size ( )
inline

Default constructor — creates a null (0x0) size.

Definition at line 18 of file size.h.

◆ Size() [2/4]

Size::Size ( const QSizeF &  other)
inline

Construct from a QSizeF.

Parameters
otherSource QSizeF

Definition at line 21 of file size.h.

◆ Size() [3/4]

Size::Size ( const QSize &  other)
inline

Construct from a QSize (integer dimensions).

Parameters
otherSource QSize

Definition at line 24 of file size.h.

◆ Size() [4/4]

Size::Size ( double  w,
double  h 
)
inline

Construct from explicit width and height.

Parameters
wWidth
hHeight

Definition at line 30 of file size.h.

Member Function Documentation

◆ fromString()

static Size Size::fromString ( const QString &  value)
static

Parse a Size from a string produced by toString().

Parameters
valueString of the form "w, h"
Returns
Parsed Size

◆ grow()

void Size::grow ( double  amount)

Grow both dimensions by the given amount.

Parameters
amountAmount to add to width and height

◆ shrink()

void Size::shrink ( double  amount)

Shrink both dimensions by the given amount.

Parameters
amountAmount to subtract from width and height

◆ toRectangle()

Rectangle Size::toRectangle ( ) const

Convert this size to a Rectangle positioned at the origin.

Returns
Rectangle(0, 0, width, height)

◆ toString()

QString Size::toString ( ) const
inline

Format this size as "w, h".

Returns
String representation

Definition at line 54 of file size.h.


The documentation for this class was generated from the following file: