Qt Namespace

  • Header: Qt

  • CMake:

    find_package(Qt6 REQUIRED COMPONENTS Core)

    target_link_libraries(mytarget PRIVATE Qt6::Core)

  • qmake: QT += core

Detailed Description

 

Type Documentation

 

enum Qt::AlignmentFlag

flags Qt::Alignment

This enum type is used to describe alignment. It contains horizontal and vertical flags that can be combined to produce the required effect.

The TextElideMode enum can also be used in many situations to fine-tune the appearance of aligned text.

The horizontal flags are:

Constant

Value

Description

Qt::AlignLeft

0x0001

Aligns with the left edge.

Qt::AlignRight

0x0002

Aligns with the right edge.

Qt::AlignHCenter

0x0004

Centers horizontally in the available space.

Qt::AlignJustify

0x0008

Justifies the text in the available space.

The vertical flags are:

Constant

Value

Description

Qt::AlignTop

0x0020

Aligns with the top.

Qt::AlignBottom

0x0040

Aligns with the bottom.

Qt::AlignVCenter

0x0080

Centers vertically in the available space.

Qt::AlignBaseline

0x0100

Aligns with the baseline.

You can use only one of the horizontal flags at a time. There is one two-dimensional flag:

Constant

Value

Description

Qt::AlignCenter

AlignVCenter | AlignHCenter

Centers in both dimensions.

You can use at most one horizontal and one vertical flag at a time. Qt::AlignCenter counts as both horizontal and vertical.

Three enum values are useful in applications that can be run in right-to-left mode:

Constant

Value

Description

Qt::AlignAbsolute

0x0010

If the widget's layout direction is Qt::RightToLeft (instead of Qt::LeftToRight, the default), Qt::AlignLeft refers to the right edge and Qt::AlignRight to the left edge. This is normally the desired behavior. If you want Qt::AlignLeft to always mean "left" and Qt::AlignRight to always mean "right", combine the flag with Qt::AlignAbsolute.

Qt::AlignLeading

AlignLeft

Synonym for Qt::AlignLeft.

Qt::AlignTrailing

AlignRight

Synonym for Qt::AlignRight.

Masks:

Constant

Qt::AlignHorizontal_Mask

AlignLeft | AlignRight | AlignHCenter | AlignJustify | AlignAbsolute

Qt::AlignVertical_Mask

AlignTop | AlignBottom | AlignVCenter | AlignBaseline

Conflicting combinations of flags have undefined meanings.

The Alignment type is a typedef for QFlags<AlignmentFlag>. It stores an OR combination of AlignmentFlag values.

enum Qt::AnchorPoint

Specifies a side of a layout item that can be anchored. This is used by QGraphicsAnchorLayout.

Constant

Value

Description

Qt::AnchorLeft

0

The left side of a layout item.

Qt::AnchorHorizontalCenter

1

A "virtual" side that is centered between the left and the right side of a layout item.

Qt::AnchorRight

2

The right side of a layout item.

Qt::AnchorTop

3

The top side of a layout item.

Qt::AnchorVerticalCenter

4

A "virtual" side that is centered between the top and the bottom side of a layout item.

Qt::AnchorBottom

5

The bottom side of a layout item.

See Also

See also QGraphicsAnchorLayout

enum Qt::ApplicationAttribute

This enum describes attributes that change the behavior of application-wide features. These are enabled and disabled using QCoreApplication::setAttribute(), and can be tested for with QCoreApplication::testAttribute().

Constant

Value

Description

Qt::AA_DontShowIconsInMenus

2

Actions with the Icon property won't be shown in any menus unless specifically set by the QAction::iconVisibleInMenu property. Menus that are currently open or menus already created in the native macOS menubar may not pick up a change in this attribute. Changes in the QAction::iconVisibleInMenu property will always be picked up.

Qt::AA_DontShowShortcutsInContextMenus