Qt Namespace

  • Header: Qt

  • CMake:

    find_package(Qt6 REQUIRED COMPONENTS Core)

    target_link_libraries(mytarget PRIVATE Qt6::Core)

  • qmake: QT += core

Detailed Description

 

Namespaces

 

namespace Qt::Literals

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

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

28

Actions with the Shortcut property won't be shown in any shortcut menus unless specifically set by the QAction::shortcutVisibleInContextMenu property. This value was added in Qt 5.10, and is by default based on the value reported by QStyleHints::showShortcutsInContextMenus(). To override the default behavior, set the style hint before QCoreApplication has been instantiated, or set this attribute after QCoreApplication has been instantiated.

Qt::AA_NativeWindows

3

Ensures that widgets have native windows.

Qt::AA_DontCreateNativeWidgetSiblings

4

Ensures that siblings of native widgets stay non-native unless specifically set by the Qt::WA_NativeWindow attribute.

Qt::AA_PluginApplication

5

Indicates that Qt is used to author a plugin. Depending on the operating system, it suppresses specific initializations that do not necessarily make sense in the plugin case. For example on macOS, this includes avoiding loading our nib for the main menu and not taking possession of the native menu bar. Setting this attribute to true will also set the AA_DontUseNativeMenuBar attribute to true. It also disables native event filters. This attribute must be set before QGuiApplication constructed. This value was added in Qt 5.7.

Qt::AA_DontUseNativeMenuBar

6

All menubars created while this attribute is set to true won't be used as a native menubar (e.g, the menubar at the top of the main screen on macOS).

Qt::AA_MacDontSwapCtrlAndMeta

7

Keyboard shortcuts on Apple platforms are typically based on the Command (or Cmd) keyboard modifier, represented by the ⌘ symbol. For example, the 'Copy' action is Command+C (⌘+C). To ease cross platform development Qt will by default remap Command to the Qt::ControlModifier, to align with other platforms. This allows creating keyboard shortcuts such as "Ctrl+J", which on macOS will then map to Command+J, as expected by macOS users. The actual Control (or Ctrl) modifier on Apple platforms, represented by ⌃, is mapped to Qt::MetaModifier.

When this attribute is true Qt will not do the remapping, and pressing the Command modifier will result in Qt::MetaModifier, while pressing the Control modifier will result in Qt::ControlModifier.

Note that the QKeySequence::StandardKey sequences will always be based on the same modifier (i.e., QKeySequence::Copy will be Command+C regardless of the value set), but what is output for QKeySequence::toString() will be different.

Constant

Value

Description

Qt::AA_Use96Dpi

8

Assume the screen has a resolution of 96 DPI rather than using the OS-provided resolution. This will cause font rendering to be consistent in pixels-per-point across devices rather than defining 1 point as 1/72 inch.

Qt::AA_SynthesizeTouchForUnhandledMouseEvents

11

All mouse events that are not accepted by the application will be translated to touch events instead.

Qt::AA_SynthesizeMouseForUnhandledTouchEvents

12

All touch events that are not accepted by the application will be translated to left button mouse events instead. This attribute is enabled by default.

Qt::AA_ForceRasterWidgets

14

Make top-level widgets use pure raster surfaces, and do not support non-native GL-based child widgets.

Qt::AA_UseDesktopOpenGL

15

Forces the usage of desktop OpenGL (for example, opengl32.dll or libGL.so) on platforms that use dynamic loading of the OpenGL implementation. This attribute must be set before QGuiApplication is constructed. This value was added in Qt 5.3.

Qt::AA_UseOpenGLES

16

Forces the usage of OpenGL ES 2.0 or higher on platforms that use dynamic loading of the OpenGL implementation. This attribute must be set before QGuiApplication is constructed. This value was added in Qt 5.3.

Qt::AA_UseSoftwareOpenGL

17

Forces the usage of a software based OpenGL implementation on platforms that use dynamic loading of the OpenGL implementation. This will typically be a patched build of Mesa llvmpipe, providing OpenGL 2.1. The value may have no effect if no such OpenGL implementation is available. The default name of this library is opengl32sw.dll and can be overridden by setting the environment variable QT_OPENGL_DLL. See the platform-specific pages, for instance Qt for Windows, for more information. This attribute must be set before QGuiApplication is constructed. This value was added in Qt 5.4.

Qt::AA_ShareOpenGLContexts

18

Enables resource sharing between the OpenGL contexts used by classes like QOpenGLWidget and QQuickWidget. This allows sharing OpenGL resources, like textures, between QOpenGLWidget instances that belong to different top-level windows. This attribute must be set before QGuiApplication is constructed. This value was added in Qt 5.4.

Qt::AA_SetPalette

19

Indicates whether a palette was explicitly set on the QGuiApplication. This value was added in Qt 5.5.

Qt::AA_UseStyleSheetPropagationInWidgetStyles

22

By default, Qt Style Sheets disable regular QWidget palette and font propagation. When this flag is enabled, font and palette changes propagate as though the user had manually called the corresponding QWidget methods. See The Style Sheet Syntax - Inheritance for more details. This value was added in Qt 5.7.

Qt::AA_DontUseNativeDialogs

23

All dialogs created while this attribute is set to true won't use the native dialogs provided by the platform. This value was added in Qt 5.7.

Qt::AA_SynthesizeMouseForUnhandledTabletEvents

24

All tablet events that are not accepted by the application will be translated to mouse events instead. This attribute is enabled by default. This value was added in Qt 5.7.

Qt::AA_CompressHighFrequencyEvents

25

Enables compression of certain frequent events. On the X11 windowing system, the default value is true, which means that QEvent::MouseMove, QEvent::TouchUpdate, and changes in window size and position will be combined whenever they occur more frequently than the application handles them, so that they don't accumulate and overwhelm the application later. On Windows 8 and above the default value is also true, but it only applies to touch events. Mouse and window events remain unaffected by this flag. On other platforms, the default is false. (In the future, the compression feature may be implemented across platforms.) You can test the attribute to see whether compression is enabled. If your application needs to handle all events with no compression, you can unset this attribute. Notice that input events from tablet devices will not be compressed. See AA_CompressTabletEvents if you want these to be compressed as well. This value was added in Qt 5.7.

Qt::AA_CompressTabletEvents

29

Enables compression of input events from tablet devices. Notice that AA_CompressHighFrequencyEvents must be true for events compression to be enabled, and that this flag extends the former to tablet events. Currently supported on the X11 windowing system, Windows 8 and above. The default value is false. This value was added in Qt 5.10.

Qt::AA_DontCheckOpenGLContextThreadAffinity

26

When making a context current using QOpenGLContext, do not check that the QObject thread affinity of the QOpenGLContext object is the same thread calling makeCurrent(). This value was added in Qt 5.8.

Qt::AA_DisableShaderDiskCache

27

Disables caching of shader program binaries on disk. By default Qt Quick, QPainter's OpenGL backend, and any application using QOpenGLShaderProgram with one of its addCacheableShaderFromSource overloads will employ a disk-based program binary cache in either the shared or per-process cache storage location, on systems that support glProgramBinary(). In the unlikely event of this being problematic, set this attribute to disable all disk-based caching of shaders.

Qt::AA_DisableSessionManager

31

Disables the QSessionManager. By default Qt will connect to a running session manager for a GUI application on supported platforms, use of a session manager may be redundant for system services. This attribute must be set before QGuiApplication is constructed. This value was added in 5.14

Qt::AA_DisableNativeVirtualKeyboard

9

When this attribute is set, the native on-screen virtual keyboard will not be shown automatically when a text input widget gains focus on a system without a physical keyboard. Currently supported on the Windows platform only. This value was added in 5.15

enum Qt::ApplicationState

flags Qt::ApplicationStates

This enum type is used to specify the current state of the application.

The states are

Constant

Value

Description

Qt::ApplicationSuspended

0x00000000

The application is about to suspend. When entering this state, the application should save its state, cease all activities, and be prepared for code execution to stop. While suspended, the application can be killed at any time without further warnings (e.g. when low memory forces the OS to purge suspended applications).

Qt::ApplicationHidden

0x00000001

The application is hidden and runs in the background. This is the normal state for applications that need to do background processing, like playing music, while the user interacts with other applications. The application should free up all graphical resources when entering this state.

Qt::ApplicationInactive

0x00000002

The application is visible, but not selected to be in front. On desktop platforms, this typically means that the user activated another application. On mobile platforms, it is more common to enter this state when the OS is interrupting the user with e.g. incoming calls or SMS-messages. While in this state, consider reducing CPU-intensive tasks.

Qt::ApplicationActive

0x00000004

The application is visible and selected to be in front.

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

enum Qt::ArrowType

Constant

Qt::NoArrow

0

Qt::UpArrow

1

Qt::DownArrow

2

Qt::LeftArrow

3

Qt::RightArrow

4

enum Qt::AspectRatioMode

This enum type defines what happens to the aspect ratio when scaling an rectangle.

Image non disponible

Constant

Value

Description

Qt::IgnoreAspectRatio

0

The size is scaled freely. The aspect ratio is not preserved.

Qt::KeepAspectRatio

1

The size is scaled to a rectangle as large as possible inside a given rectangle, preserving the aspect ratio.

Qt::KeepAspectRatioByExpanding

2

The size is scaled to a rectangle as small as possible outside a given rectangle, preserving the aspect ratio.

See Also

enum Qt::Axis

This enum type defines three values to represent the three axes in the cartesian coordinate system.

Constant

Value

Description

Qt::XAxis

0

The X axis.

Qt::YAxis

1

The Y axis.

Qt::ZAxis

2

The Z axis.

See Also

enum Qt::BGMode

Background mode:

Constant

Qt::TransparentMode

0

Qt::OpaqueMode

1

enum Qt::BrushStyle

This enum type defines the brush styles supported by Qt, i.e. the fill pattern of shapes drawn using QPainter.

Brush Styles

Constant

Value

Description

Qt::NoBrush

0

No brush pattern.

Qt::SolidPattern

1

Uniform color.

Qt::Dense1Pattern

2

Extremely dense brush pattern.

Qt::Dense2Pattern

3

Very dense brush pattern.

Qt::Dense3Pattern

4

Somewhat dense brush pattern.

Qt::Dense4Pattern

5

Half dense brush pattern.

Qt::Dense5Pattern

6

Somewhat sparse brush pattern.

Qt::Dense6Pattern

7

Very sparse brush pattern.

Qt::Dense7Pattern

8

Extremely sparse brush pattern.

Qt::HorPattern

9

Horizontal lines.

Qt::VerPattern

10

Vertical lines.

Qt::CrossPattern

11

Crossing horizontal and vertical lines.

Qt::BDiagPattern

12

Backward diagonal lines.

Qt::FDiagPattern

13

Forward diagonal lines.

Qt::DiagCrossPattern

14

Crossing diagonal lines.

Qt::LinearGradientPattern

15

Linear gradient (set using a dedicated QBrush constructor).

Qt::ConicalGradientPattern

17

Conical gradient (set using a dedicated QBrush constructor).

Qt::RadialGradientPattern

16

Radial gradient (set using a dedicated QBrush constructor).

Qt::TexturePattern

24

Custom pattern (see QBrush::setTexture()).

See Also

See also QBrush

enum Qt::CaseSensitivity

Constant

Qt::CaseInsensitive

0

Qt::CaseSensitive

1

enum Qt::CheckState

This enum describes the state of checkable items, controls, and widgets.

Constant

Value

Description

Qt::Unchecked

0

The item is unchecked.

Qt::PartiallyChecked

1

The item is partially checked. Items in hierarchical models may be partially checked if some, but not all, of their children are checked.

Qt::Checked

2

The item is checked.

See Also

enum Qt::ChecksumType

This enum describes the possible standards used by qChecksum().

Constant

Value

Description

Qt::ChecksumIso3309

0

Checksum calculation based on ISO 3309.

Qt::ChecksumItuV41

1

Checksum calculation based on ITU-V.41.

enum Qt::ClipOperation

Constant

Value

Description

Qt::NoClip

0

This operation turns clipping off.

Qt::ReplaceClip

1

Replaces the current clip path/rect/region with the one supplied in the function call.

Qt::IntersectClip

2

Intersects the current clip path/rect/region with the one supplied in the function call.

enum Qt::ColorScheme

Represents the appearance of an application's theme, defined by QGuiApplication::palette().

Constant

Value

Description

Qt::ColorScheme::Unknown

0

The appearance is unknown.

Qt::ColorScheme::Light

1

The background colors are lighter than the text color, i.e. the theme is light.

Qt::ColorScheme::Dark

2

The background colors are darker than the text color, i.e. the theme is dark.

enum Qt::ConnectionType

This enum describes the types of connection that can be used between signals and slots. In particular, it determines whether a particular signal is delivered to a slot immediately or queued for delivery at a later time.

Constant

Value

Description

Qt::AutoConnection

0

(Default) If the receiver lives in the thread that emits the signal, Qt::DirectConnection is used. Otherwise, Qt::QueuedConnection is used. The connection type is determined when the signal is emitted.

Qt::DirectConnection

1

The slot is invoked immediately when the signal is emitted. The slot is executed in the signalling thread.

Qt::QueuedConnection

2

The slot is invoked when control returns to the event loop of the receiver's thread. The slot is executed in the receiver's thread.

Qt::BlockingQueuedConnection

3

Same as Qt::QueuedConnection, except that the signalling thread blocks until the slot returns. This connection must not be used if the receiver lives in the signalling thread, or else the application will deadlock.

Qt::UniqueConnection

0x80

This is a flag that can be combined with any one of the above connection types, using a bitwise OR. When Qt::UniqueConnection is set, QObject::connect() will fail if the connection already exists (i.e. if the same signal is already connected to the same slot for the same pair of objects).

Qt::SingleShotConnection

0x100

This is a flag that can be combined with any one of the above connection types, using a bitwise OR. When Qt::SingleShotConnection is set, the slot is going to be called only once; the connection will be automatically broken when the signal is emitted. This flag was introduced in Qt 6.0.

With queued connections, the parameters must be of types that are known to Qt's meta-object system, because Qt needs to copy the arguments to store them in an event behind the scenes. If you try to use a queued connection and get the error message:

 
Sélectionnez
QObject::connect: Cannot queue arguments of type 'MyType'

Call qRegisterMetaType() to register the data type before you establish the connection.

When using signals and slots with multiple threads, see Signals and Slots Across Threads.

See Also

enum Qt::ContextMenuPolicy

This enum type defines the various policies a widget can have with respect to showing a context menu.

Constant

Value

Description

Qt::NoContextMenu

0

the widget does not feature a context menu, context menu handling is deferred to the widget's parent.

Qt::PreventContextMenu

4

the widget does not feature a context menu, and in contrast to NoContextMenu, the handling is not deferred to the widget's parent. This means that all right mouse button events are guaranteed to be delivered to the widget itself through QWidget::mousePressEvent(), and QWidget::mouseReleaseEvent().

Qt::DefaultContextMenu

1

the widget's QWidget::contextMenuEvent() handler is called.

Qt::ActionsContextMenu

2

the widget displays its QWidget::actions() as context menu.

Qt::CustomContextMenu

3

the widget emits the QWidget::customContextMenuRequested() signal.

enum Qt::CoordinateSystem

This enum specifies the coordinate system.

Constant

Value

Description

Qt::DeviceCoordinates

0

Coordinates are relative to the top-left corner of the object's paint device.

Qt::LogicalCoordinates

1

Coordinates are relative to the top-left corner of the object.

enum Qt::Corner

This enum type specifies a corner in a rectangle:

Constant

Value

Description

Qt::TopLeftCorner

0x00000

The top-left corner of the rectangle.

Qt::TopRightCorner

0x00001

The top-right corner of the rectangle.

Qt::BottomLeftCorner

0x00002

The bottom-left corner of the rectangle.

Qt::BottomRightCorner

0x00003

The bottom-right corner of the rectangle.

enum Qt::CursorMoveStyle

This enum describes the movement style available to text cursors. The options are:

Constant

Value

Description

Qt::LogicalMoveStyle

0

Within a left-to-right text block, decrease cursor position when pressing left arrow key, increase cursor position when pressing the right arrow key. If the text block is right-to-left, the opposite behavior applies.

Qt::VisualMoveStyle

1

Pressing the left arrow key will always cause the cursor to move left, regardless of the text's writing direction. Pressing the right arrow key will always cause the cursor to move right.

enum Qt::CursorShape

This enum type defines the various cursors that can be used.

The standard arrow cursor is the default for widgets in a normal state.

Constant

Value

Description

Qt::ArrowCursor

0

Image non disponible The standard arrow cursor.

Qt::UpArrowCursor

1

Image non disponible An arrow pointing upwards toward the top of the screen.

Qt::CrossCursor

2

Image non disponible A crosshair cursor, typically used to help the user accurately select a point on the screen.

Qt::WaitCursor

3

Image non disponible An hourglass or watch cursor, usually shown during operations that prevent the user from interacting with the application.

Qt::IBeamCursor

4

Image non disponible A caret or ibeam cursor, indicating that a widget can accept and display text input.

Qt::SizeVerCursor

5

Image non disponible A cursor used for elements that are used to vertically resize top-level windows.

Qt::SizeHorCursor

6

Image non disponible A cursor used for elements that are used to horizontally resize top-level windows.

Qt::SizeBDiagCursor

7

Image non disponible A cursor used for elements that are used to diagonally resize top-level windows at their top-right and bottom-left corners.

Qt::SizeFDiagCursor

8

Image non disponible A cursor used for elements that are used to diagonally resize top-level windows at their top-left and bottom-right corners.

Qt::SizeAllCursor

9

Image non disponible A cursor used for elements that are used to resize top-level windows in any direction.

Qt::BlankCursor

10

A blank/invisible cursor, typically used when the cursor shape needs to be hidden.

Qt::SplitVCursor

11

Image non disponible A cursor used for vertical splitters, indicating that a handle can be dragged horizontally to adjust the use of available space.

Qt::SplitHCursor

12

Image non disponible A cursor used for horizontal splitters, indicating that a handle can be dragged vertically to adjust the use of available space.

Qt::PointingHandCursor

13

Image non disponible A pointing hand cursor that is typically used for clickable elements such as hyperlinks.

Qt::ForbiddenCursor

14

Image non disponible A slashed circle cursor, typically used during drag and drop operations to indicate that dragged content cannot be dropped on particular widgets or inside certain regions.

Qt::OpenHandCursor

17

Image non disponible A cursor representing an open hand, typically used to indicate that the area under the cursor is the visible part of a canvas that the user can click and drag in order to scroll around.

Qt::ClosedHandCursor

18

Image non disponible A cursor representing a closed hand, typically used to indicate that a dragging operation is in progress that involves scrolling.

Qt::WhatsThisCursor

15

Image non disponible An arrow with a question mark, typically used to indicate the presence of What's This? help for a widget.

Qt::BusyCursor

16

Image non disponible An hourglass or watch cursor, usually shown during operations that allow the user to interact with the application while they are performed in the background.

Qt::DragMoveCursor

20

A cursor that is usually used when dragging an item.

Qt::DragCopyCursor

19

A cursor that is usually used when dragging an item to copy it.

Qt::DragLinkCursor

21

A cursor that is usually used when dragging an item to make a link to it.

Qt::BitmapCursor

24

 

enum Qt::DateFormat

Constant

Value

Description

Qt::TextDate

0

The default Qt format, which includes the day and month name, the day number in the month, and the year in full. The day and month names will be short names in English (C locale). This effectively uses, for a date, format ddd MMM d yyyy, for a time HH:mm:ss and combines these as ddd MMM d HH:mm:ss yyyy for a date-time, with an optional zone-offset suffix, where relevant. When reading from a string, a fractional part is also recognized on the seconds of a time part, as HH:mm:ss.zzz, and some minor variants on the format may be recognized, for compatibility with earlier versions of Qt and with changes to the format planned for the future. In particular, the zone-offset suffix presently uses GMT[±tzoff] with a tzoff in HH[[:]mm] format (two-digit hour and optional two-digit minutes, with optional colon separator); this shall change to use UTC in place of GMT in a future release of Qt, so the planned UTC format is recognized.

Qt::ISODateWithMs

9

ISO 8601 extended format: uses yyyy-MM-dd for dates, HH:mm:ss.zzz for times or yyyy-MM-ddTHH:mm:ss.zzz (e.g. 2017-07-24T15:46:29.739) for combined dates and times, optionally with a time-zone suffix (Z for UTC otherwise an offset as ±HH:mm) where appropriate. When parsed, a single space, ' ', may be used in place of the 'T' separator between date and time; no other spacing characters are permitted. This format also accepts HH:mm and plain HH formats for the time part, either of which may include a fractional part, HH:mm.zzz or HH.zzz, applied to the last field present (hour or minute).

Qt::ISODate

1

ISO 8601 extended format, as for ISODateWithMs, but omitting the milliseconds (.zzz) part when converting to a string. There is no difference when reading from a string: if a fractional part is present on the last time field, either format will accept it.

Qt::RFC2822Date

8

RFC 2822, RFC 850 and RFC 1036 format: when converting dates to string form, format dd MMM yyyy is used, for times the format is HH:mm:ss. For combined date and time, these are combined as dd MMM yyyy HH:mm:ss ±tzoff (omitting the optional leading day of the week from the first format recognized). When reading from a string either [ddd,] dd MMM yyyy [HH:mm[:ss]][ ±tzoff] or ddd MMM dd[ HH:mm:ss] yyyy[ ±tzoff] will be recognized for combined dates and times, where tzoff is a timezone offset in HHmm format. Arbitrary spacing may appear before or after the text and any non-empty spacing may replace the spaces in this format. For dates and times separately, the same formats are matched and the unwanted parts are ignored. In particular, note that a time is not recognized without an accompanying date.

For ISODate formats, each y, M and d represents a single digit of the year, month, and day used to specify the date. Each H, m, and s represents a single digit of the hour (up to 24), minute and second used to specify the time. An hour of 24, with zero for all other time fields, is understood as the start of the next day. A .zzz stands for a fractional part suffix on the preceding field, which may be separated from that field either by a comma ',' or the dot '.' shown. Precision beyond milliseconds is accepted but discarded, rounding to the nearest representable millisecond. The presence of a literal T character is used to separate the date and time when both are specified. For the TextDate and RFC2822Date formats, ddd stands for the first three letters of the name of the day of the week and MMM stands for the first three letters of the month name. The names of days and months are always in English (C locale) regardless of user preferences or system settings. The other format characters have the same meaning as for the ISODate format, except that 24 is not accepted as an hour. Parts of a format enclosed in square brackets [...] are optional; the square brackets do not form part of the format. The plus-or-minus character '±' here stands for either sign character, '-' for minus or '+' for plus.

Zone offsets are measured positive to the east of Greenwich, negative to the west, as is usual for UTC-based offset notations (conflicting with some GMT-based zones-names, such as Etc/GMT+3, which use the opposite convention).

See Also

enum Qt::DayOfWeek

Constant

Qt::Monday

1

Qt::Tuesday

2

Qt::Wednesday

3

Qt::Thursday

4

Qt::Friday

5

Qt::Saturday

6

Qt::Sunday

7

enum Qt::DockWidgetArea

flags Qt::DockWidgetAreas

Represents the areas a QDockWidget can be plugged to.

A floating dock widget with tabs can be docked anywhere.

Constant

Value

Description

Qt::LeftDockWidgetArea

0x1

The left dock area of a QMainWindow.

Qt::RightDockWidgetArea

0x2

The right dock area of a QMainWindow.

Qt::TopDockWidgetArea

0x4

The top dock area of a QMainWindow.

Qt::BottomDockWidgetArea

0x8

The bottom dock area of a QMainWindow.

Qt::AllDockWidgetAreas

DockWidgetArea_Mask

All dock widget areas (default).

Qt::NoDockWidgetArea

0

No dock widget areas.

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

See Also

enum Qt::DropAction

flags Qt::DropActions

Constant

Value

Description

Qt::CopyAction

0x1

Copy the data to the target.

Qt::MoveAction

0x2

Move the data from the source to the target.

Qt::LinkAction

0x4

Create a link from the source to the target.

Qt::ActionMask

0xff

 

Qt::IgnoreAction

0x0

Ignore the action (do nothing with the data).

Qt::TargetMoveAction

0x8002

On Windows, this value is used when the ownership of the D&D data should be taken over by the target application, i.e., the source application should not delete the data. On X11 this value is used to do a move. TargetMoveAction is not used on the Mac.

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

enum Qt::Edge

flags Qt::Edges

This enum type specifies an edge in a rectangle:

Constant

Value

Description

Qt::TopEdge

0x00001

The top edge of the rectangle.

Qt::LeftEdge

0x00002

The left edge of the rectangle.

Qt::RightEdge

0x00004

The right edge of the rectangle.

Qt::BottomEdge

0x00008

The bottom edge of the rectangle.

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

enum Qt::EnterKeyType

This can be used to alter the appearance of the Return key on an on-screen keyboard.

Not all of these values are supported on all platforms. For unsupported values the default key will be used instead.

Constant

Value

Description

Qt::EnterKeyDefault

0

The default Enter key. This can either be a button closing the keyboard, or a Return button causing a new line in case of a multi-line input field.

Qt::EnterKeyReturn

1

Show a Return button that inserts a new line. The keyboard will not close when this button is pressed.

Qt::EnterKeyDone

2

Show a "Done" button. The keyboard will close when this button is pressed.

Qt::EnterKeyGo

3

Show a "Go" button. Typically used in an address bar when entering a URL; the keyboard will close when this button is pressed.

Qt::EnterKeySend

4

Show a "Send" button. The keyboard will close when this button is pressed.

Qt::EnterKeySearch

5

Show a "Search" button. The keyboard will close when this button is pressed.

Qt::EnterKeyNext

6

Show a "Next" button. Typically used in a form to allow navigating to the next input field; the keyboard will not close when this button is pressed.

Qt::EnterKeyPrevious

7

Show a "Previous" button. The keyboard will not close when this button is pressed.

enum Qt::EventPriority

This enum can be used to specify event priorities.

Constant

Value

Description

Qt::HighEventPriority

1

Events with this priority are sent before events with NormalEventPriority or LowEventPriority.

Qt::NormalEventPriority

0

Events with this priority are sent after events with HighEventPriority, but before events with LowEventPriority.

Qt::LowEventPriority

-1

Events with this priority are sent after events with HighEventPriority or NormalEventPriority.

Note that these values are provided purely for convenience, since event priorities can be any value between INT_MAX and INT_MIN, inclusive. For example, you can define custom priorities as being relative to each other:

 
Sélectionnez
enum CustomEventPriority
{
    // An important event
    ImportantEventPriority = Qt::HighEventPriority,

    // A more important event
    MoreImportantEventPriority = ImportantEventPriority + 1,

    // A critical event
    CriticalEventPriority = 100 * MoreImportantEventPriority,

    // Not that important
    StatusEventPriority = Qt::LowEventPriority,

    // These are less important than Status events
    IdleProcessingDoneEventPriority = StatusEventPriority - 1
};
See Also

enum Qt::FillRule

Specifies which method should be used to fill the paths and polygons.

Constant

Value

Description

Qt::OddEvenFill

0

Specifies that the region is filled using the odd even fill rule. With this rule, we determine whether a point is inside the shape by using the following method. Draw a horizontal line from the point to a location outside the shape, and count the number of intersections. If the number of intersections is an odd number, the point is inside the shape. This mode is the default.

Qt::WindingFill

1

Specifies that the region is filled using the non zero winding rule. With this rule, we determine whether a point is inside the shape by using the following method. Draw a horizontal line from the point to a location outside the shape. Determine whether the direction of the line at each intersection point is up or down. The winding number is determined by summing the direction of each intersection. If the number is non zero, the point is inside the shape. This fill mode can also in most cases be considered as the intersection of closed shapes.

enum Qt::FindChildOption

flags Qt::FindChildOptions

Constant

Value

Description

Qt::FindDirectChildrenOnly

0x0

Looks only at the direct children of the object.

Qt::FindChildrenRecursively

0x1

Looks at all children of the object (recursive search).

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

enum Qt::FocusPolicy

This enum type defines the various policies a widget can have with respect to acquiring keyboard focus.

Constant

Value

Description

Qt::TabFocus

0x1

the widget accepts focus by tabbing.

Qt::ClickFocus

0x2

the widget accepts focus by clicking.

Qt::StrongFocus

TabFocus | ClickFocus | 0x8

the widget accepts focus by both tabbing and clicking. On macOS this will also be indicate that the widget accepts tab focus when in 'Text/List focus mode'.

Qt::WheelFocus

StrongFocus | 0x4

like Qt::StrongFocus plus the widget accepts focus by using the mouse wheel.

Qt::NoFocus

0

the widget does not accept focus.

enum Qt::FocusReason

This enum specifies why the focus changed. It will be passed through QWidget::setFocus and can be retrieved in the QFocusEvent sent to the widget upon focus change.

Constant

Value

Description

Qt::MouseFocusReason

0

A mouse action occurred.

Qt::TabFocusReason

1

The Tab key was pressed.

Qt::BacktabFocusReason

2

A Backtab occurred. The input for this may include the Shift or Control keys; e.g. Shift+Tab.

Qt::ActiveWindowFocusReason

3

The window system made this window either active or inactive.

Qt::PopupFocusReason

4

The application opened/closed a pop-up that grabbed/released the keyboard focus.

Qt::ShortcutFocusReason

5

The user typed a label's buddy shortcut

Qt::MenuBarFocusReason

6

The menu bar took focus.

Qt::OtherFocusReason

7

Another reason, usually application-specific.

See Also

enum Qt::GestureFlag

flags Qt::GestureFlags

This enum type describes additional flags that can be used when subscribing to a gesture.

Constant

Value

Description

Qt::DontStartGestureOnChildren

0x01

By default gestures can start on the widget or over any of its children. Use this flag to disable this and allow a gesture to start on the widget only.

Qt::ReceivePartialGestures

0x02

Allows any ignored gesture events to be propagated to parent widgets which have specified this hint. By default only gestures that are in the Qt::GestureStarted state are propagated and the widget always gets the full gesture sequence starting with a gesture in the Qt::GestureStarted state and ending with a gesture in the Qt::GestureFinished or Qt::GestureCanceled states.

Qt::IgnoredGesturesPropagateToParent (since Qt 4.7)

0x04

Allows fine-tuning of gesture event propagation. By setting the flag when grabbing a gesture all ignored partial gestures will propagate to their parent items.

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

See Also

enum Qt::GestureState

This enum type describes the state of a gesture.

Constant

Value

Description

Qt::NoGesture

0

No gesture has been detected.

Qt::GestureStarted

1

A continuous gesture has started.

Qt::GestureUpdated

2

A gesture continues.

Qt::GestureFinished

3

A gesture has finished.

Qt::GestureCanceled

4

A gesture was canceled.

See Also

See also QGesture

enum Qt::GestureType

This enum type describes the standard gestures.

Constant

Value

Description

Qt::TapGesture

1

A Tap gesture.

Qt::TapAndHoldGesture

2

A Tap-And-Hold (Long-Tap) gesture.

Qt::PanGesture

3

A Pan gesture.

Qt::PinchGesture

4

A Pinch gesture.

Qt::SwipeGesture

5

A Swipe gesture.

Qt::CustomGesture

0x0100

A flag that can be used to test if the gesture is a user-defined gesture ID.

User-defined gestures are registered with the QGestureRecognizer::registerRecognizer() function which generates a custom gesture ID with the Qt::CustomGesture flag set.

See Also

enum Qt::GlobalColor

Qt's predefined QColor objects:

Constant

Value

Description

Qt::white

3

White (#ffffff)

Qt::black

2

Black (#000000)

Qt::red

7

Red (#ff0000)

Qt::darkRed

13

Dark red (#800000)

Qt::green

8

Green (#00ff00)

Qt::darkGreen

14

Dark green (#008000)

Qt::blue

9

Blue (#0000ff)

Qt::darkBlue

15

Dark blue (#000080)

Qt::cyan

10

Cyan (#00ffff)

Qt::darkCyan

16

Dark cyan (#008080)

Qt::magenta

11

Magenta (#ff00ff)

Qt::darkMagenta

17

Dark magenta (#800080)

Qt::yellow

12

Yellow (#ffff00)

Qt::darkYellow

18

Dark yellow (#808000)

Qt::gray

5

Gray (#a0a0a4)

Qt::darkGray

4

Dark gray (#808080)

Qt::lightGray