- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Friends

# QSizePolicy Class Reference

Search for all occurrences

## Detailed Description

Definition at line 55 of file qsizepolicy.h.

`#include <qsizepolicy.h>`

List of all members.

## Public Types
enum | PolicyFlag { GrowFlag = 1, ExpandFlag = 2, ShrinkFlag = 4, IgnoreFlag = 8 }
enum | Policy { Fixed = 0, Minimum = GrowFlag, Maximum = ShrinkFlag, Preferred = GrowFlag | ShrinkFlag, MinimumExpanding = GrowFlag | ExpandFlag, Expanding = GrowFlag | ShrinkFlag | ExpandFlag, Ignored = ShrinkFlag | GrowFlag | IgnoreFlag }
enum | ControlType { DefaultType = 0x00000001, ButtonBox = 0x00000002, CheckBox = 0x00000004, ComboBox = 0x00000008, Frame = 0x00000010, GroupBox = 0x00000020, Label = 0x00000040, Line = 0x00000080, LineEdit = 0x00000100, PushButton = 0x00000200, RadioButton = 0x00000400, Slider = 0x00000800, SpinBox = 0x00001000, TabWidget = 0x00002000, ToolButton = 0x00004000 }
## Public Member Functions
| QSizePolicy ()
| QSizePolicy (Policy horizontal, Policy vertical)
| QSizePolicy (Policy horizontal, Policy vertical, ControlType type)
Policy | horizontalPolicy () const
Policy | verticalPolicy () const
ControlType | controlType () const
void | setHorizontalPolicy (Policy d)
void | setVerticalPolicy (Policy d)
void | setControlType (ControlType type)
Qt::Orientations | expandingDirections () const
void | setHeightForWidth (bool b)
bool | hasHeightForWidth () const
bool | operator== (const QSizePolicy &s) const
bool | operator!= (const QSizePolicy &s) const
| operator QVariant () const
int | horizontalStretch () const
int | verticalStretch () const
void | setHorizontalStretch (uchar stretchFactor)
void | setVerticalStretch (uchar stretchFactor)
void | transpose ()
## Friends
Q_GUI_EXPORT QDataStream & | operator<< (QDataStream &, const QSizePolicy &)
Q_GUI_EXPORT QDataStream & | operator>> (QDataStream &, QSizePolicy &)

## Member Enumeration Documentation

enum PolicyFlag

Search for all occurrences

Enumerator:

  GrowFlag | Search for all occurrences
  ExpandFlag | Search for all occurrences
  ShrinkFlag | Search for all occurrences
  IgnoreFlag | Search for all occurrences

Definition at line 74 of file qsizepolicy.h.

                        {
            GrowFlag = 1,
            ExpandFlag = 2,
            ShrinkFlag = 4,
            IgnoreFlag = 8
        };

enum Policy

Search for all occurrences

Enumerator:

  Fixed | Search for all occurrences
  Minimum | Search for all occurrences
  Maximum | Search for all occurrences
  Preferred | Search for all occurrences
  MinimumExpanding | Search for all occurrences
  Expanding | Search for all occurrences
  Ignored | Search for all occurrences

Definition at line 81 of file qsizepolicy.h.

                    {
            Fixed = 0,
            Minimum = GrowFlag,
            Maximum = ShrinkFlag,
            Preferred = GrowFlag | ShrinkFlag,
            MinimumExpanding = GrowFlag | ExpandFlag,
            Expanding = GrowFlag | ShrinkFlag | ExpandFlag,
            Ignored = ShrinkFlag | GrowFlag | IgnoreFlag
        };

enum ControlType

Search for all occurrences

Enumerator:

  DefaultType | Search for all occurrences
  ButtonBox | Search for all occurrences
  CheckBox | Search for all occurrences
  ComboBox | Search for all occurrences
  Frame | Search for all occurrences
  GroupBox | Search for all occurrences
  Label | Search for all occurrences
  Line | Search for all occurrences
  LineEdit | Search for all occurrences
  PushButton | Search for all occurrences
  RadioButton | Search for all occurrences
  Slider | Search for all occurrences
  SpinBox | Search for all occurrences
  TabWidget | Search for all occurrences
  ToolButton | Search for all occurrences

Definition at line 91 of file qsizepolicy.h.

                         {
            DefaultType      = 0x00000001,
            ButtonBox        = 0x00000002,
            CheckBox         = 0x00000004,
            ComboBox         = 0x00000008,
            Frame            = 0x00000010,
            GroupBox         = 0x00000020,
            Label            = 0x00000040,
            Line             = 0x00000080,
            LineEdit         = 0x00000100,
            PushButton       = 0x00000200,
            RadioButton      = 0x00000400,
            Slider           = 0x00000800,
            SpinBox          = 0x00001000,
            TabWidget        = 0x00002000,
            ToolButton       = 0x00004000
        };

## Constructor & Destructor Documentation

QSizePolicy | ( |  | ) | `[inline]`

Definition at line 110 of file qsizepolicy.h.

    : data(0) { }

QSizePolicy | ( | Policy | horizontal,
|  | Policy | vertical
| ) |  | `[inline]`

Definition at line 113 of file qsizepolicy.h.

            : data(horizontal | (vertical << HSize)) { }

QSizePolicy | ( | Policy | horizontal,
|  | Policy | vertical,
|  | ControlType | type
| ) |  | `[inline]`

Definition at line 115 of file qsizepolicy.h.

            : data(horizontal | (vertical << HSize)) { setControlType(type); }

## Member Function Documentation

Policy horizontalPolicy | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 118 of file qsizepolicy.h.

    { return static_cast<Policy>(data & HMask); }

Policy verticalPolicy | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 119 of file qsizepolicy.h.

    { return static_cast<Policy>((data & VMask) >> HSize); }

ControlType controlType | ( |  | ) | const

Search for all occurrences

void setHorizontalPolicy | ( | Policy | d | ) | `[inline]`

Search for all occurrences

Definition at line 122 of file qsizepolicy.h.

    { data = (data & ~HMask) | d; }

void setVerticalPolicy | ( | Policy | d | ) | `[inline]`

Search for all occurrences

Definition at line 123 of file qsizepolicy.h.

    { data = (data & ~(HMask << HSize)) | (d << HSize); }

void setControlType | ( | ControlType | type | ) |

Search for all occurrences

Qt::Orientations expandingDirections | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 126 of file qsizepolicy.h.

                                                   {
            Qt::Orientations result;
            if (verticalPolicy() & ExpandFlag)
                result |= Qt::Vertical;
            if (horizontalPolicy() & ExpandFlag)
                result |= Qt::Horizontal;
            return result;
        }

void setHeightForWidth | ( | bool | b | ) | `[inline]`

Search for all occurrences

Definition at line 135 of file qsizepolicy.h.

    { data = b ? (data | (1 << 2*HSize)) : (data & ~(1 << 2*HSize));  }

bool hasHeightForWidth | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 136 of file qsizepolicy.h.

    { return data & (1 << 2*HSize); }

bool operator== | ( | const QSizePolicy & | s | ) | const `[inline]`

Definition at line 138 of file qsizepolicy.h.

    { return data == s.data; }

bool operator!= | ( | const QSizePolicy & | s | ) | const `[inline]`

Definition at line 139 of file qsizepolicy.h.

    { return data != s.data; }

operator QVariant | ( |  | ) | const

int horizontalStretch | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 142 of file qsizepolicy.h.

    { return data >> 24; }

int verticalStretch | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 143 of file qsizepolicy.h.

    { return (data >> 16) & 0xff; }

void setHorizontalStretch | ( | uchar | stretchFactor | ) | `[inline]`

Search for all occurrences

Definition at line 144 of file qsizepolicy.h.

    { data = (data&0x00ffffff) | (uint(stretchFactor)<<24); }

void setVerticalStretch | ( | uchar | stretchFactor | ) | `[inline]`

Search for all occurrences

Definition at line 145 of file qsizepolicy.h.

    { data = (data&0xff00ffff) | (uint(stretchFactor)<<16); }

void transpose | ( |  | ) | `[inline]`

Search for all occurrences

Definition at line 224 of file qsizepolicy.h.

                                       {
        Policy hData = horizontalPolicy();
        Policy vData = verticalPolicy();
        uchar hStretch = uchar(horizontalStretch());
        uchar vStretch = uchar(verticalStretch());
        setHorizontalPolicy(vData);
        setVerticalPolicy(hData);
        setHorizontalStretch(vStretch);
        setVerticalStretch(hStretch);
    }

## Friends And Related Function Documentation

Q_GUI_EXPORT QDataStream& operator<< | ( | QDataStream & | ,
|  | const QSizePolicy & |
| ) |  | `[friend]`

Q_GUI_EXPORT QDataStream& operator>> | ( | QDataStream & | ,
|  | QSizePolicy & |
| ) |  | `[friend]`

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

- QtGui/qsizepolicy.h

QSizePolicy QSizePolicy QSizePolicy QSizePolicy QSizePolicy QSizePolicy QSizePolicy QSizePolicy QSizePolicy QSizePolicy
QSizePolicy QSizePolicy QSizePolicy QSizePolicy QSizePolicy QSizePolicy QSizePolicy QSizePolicy QSizePolicy QSizePolicy