Home · All Classes · Modules

Qt Class Reference
[QtCore module]

The Qt namespace contains miscellaneous identifiers used throughout the Qt library. More...

Types

Static Methods


Detailed Description

The Qt namespace contains miscellaneous identifiers used throughout the Qt library.


Type Documentation

Qt.AlignmentFlag

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:

ConstantValueDescription
Qt.AlignLeft0x0001Aligns with the left edge.
Qt.AlignRight0x0002Aligns with the right edge.
Qt.AlignHCenter0x0004Centers horizontally in the available space.
Qt.AlignJustify0x0008Justifies the text in the available space.

The vertical flags are:

ConstantValueDescription
Qt.AlignTop0x0020Aligns with the top.
Qt.AlignBottom0x0040Aligns with the bottom.
Qt.AlignVCenter0x0080Centers vertically in the available space.

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

ConstantValueDescription
Qt.AlignCenterAlignVCenter | AlignHCenterCenters 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:

ConstantValueDescription
Qt.AlignAbsolute0x0010If 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.AlignLeadingAlignLeftSynonym for Qt.AlignLeft.
Qt.AlignTrailingAlignRightSynonym for Qt.AlignRight.

Masks:

ConstantValue
Qt.AlignHorizontal_MaskAlignLeft | AlignRight | AlignHCenter | AlignJustify | AlignAbsolute
Qt.AlignVertical_MaskAlignTop | AlignBottom | AlignVCenter

Conflicting combinations of flags have undefined meanings.

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

Qt.AnchorAttribute

An anchor has one or more of the following attributes:

ConstantValueDescription
Qt.AnchorName0the name attribute of the anchor. This attribute is used when scrolling to an anchor in the document.
Qt.AnchorHref1the href attribute of the anchor. This attribute is used when a link is clicked to determine what content to load.

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().

ConstantValueDescription
Qt.AA_ImmediateWidgetCreation0Ensures that widgets are created as soon as they are constructed. By default, resources for widgets are allocated on demand to improve efficiency and minimize resource usage. Setting or clearing this attribute affects widgets constructed after the change. Setting it tells Qt to create toplevel windows immediately. Therefore, if it is important to minimize resource consumption, do not set this attribute.
Qt.AA_MSWindowsUseDirect3DByDefault1Is a Windows specific attribute, that will make the Direct3D paint engine the default Qt widget paint engine. Note that you can toggle usage of the Direct3D engine on individual QWidgets by setting/clearing the WA_MSWindowsUseDirect3D attribute on a specific widget. This functionality is experimental.
Qt.AA_DontShowIconsInMenus2Actions 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 Mac OS X menubar MAY NOT pick up a change in this attribute. Changes in the QAction.iconVisibleInMenu property will always be picked up.

ConstantValueDescription
Qt.AA_NativeWindows3Ensures that widgets have native windows.
Qt.AA_DontCreateNativeWidgetSiblings4Ensures that siblings of native widgets stay non-native unless specifically set by the Qt.WA_NativeWindow attribute.

Qt.ArrowType

ConstantValue
Qt.NoArrow0
Qt.UpArrow1
Qt.DownArrow2
Qt.LeftArrow3
Qt.RightArrow4

Qt.AspectRatioMode

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

ConstantValueDescription
Qt.IgnoreAspectRatio0The size is scaled freely. The aspect ratio is not preserved.
Qt.KeepAspectRatio1The size is scaled to a rectangle as large as possible inside a given rectangle, preserving the aspect ratio.
Qt.KeepAspectRatioByExpanding2The size is scaled to a rectangle as small as possible outside a given rectangle, preserving the aspect ratio.

See also QSize.scale() and QImage.scaled().

Qt.Axis

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

ConstantValueDescription
Qt.XAxis0The X axis.
Qt.YAxis1The Y axis.
Qt.ZAxis2The Z axis.

See also QTransform.rotate() and QTransform.rotateRadians().

Qt.BGMode

Background mode:

ConstantValue
Qt.TransparentMode0
Qt.OpaqueMode1

Qt.BrushStyle

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

Brush Styles

ConstantValueDescription
Qt.NoBrush0No brush pattern.
Qt.SolidPattern1Uniform color.
Qt.Dense1Pattern2Extremely dense brush pattern.
Qt.Dense2Pattern3Very dense brush pattern.
Qt.Dense3Pattern4Somewhat dense brush pattern.
Qt.Dense4Pattern5Half dense brush pattern.
Qt.Dense5Pattern6Somewhat sparse brush pattern.
Qt.Dense6Pattern7Very sparse brush pattern.
Qt.Dense7Pattern8Extremely sparse brush pattern.
Qt.HorPattern9Horizontal lines.
Qt.VerPattern10Vertical lines.
Qt.CrossPattern11Crossing horizontal and vertical lines.
Qt.BDiagPattern12Backward diagonal lines.
Qt.FDiagPattern13Forward diagonal lines.
Qt.DiagCrossPattern14Crossing diagonal lines.
Qt.LinearGradientPattern15Linear gradient (set using a dedicated QBrush constructor).
Qt.ConicalGradientPattern17Conical gradient (set using a dedicated QBrush constructor).
Qt.RadialGradientPattern16Radial gradient (set using a dedicated QBrush constructor).
Qt.TexturePattern24Custom pattern (see QBrush.setTexture()).

See also QBrush.

Qt.CaseSensitivity

ConstantValue
Qt.CaseInsensitive0
Qt.CaseSensitive1

Qt.CheckState

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

ConstantValueDescription
Qt.Unchecked0The item is unchecked.
Qt.PartiallyChecked1The item is partially checked. Items in hierarchical models may be partially checked if some, but not all, of their children are checked.
Qt.Checked2The item is checked.

See also QCheckBox, Qt.ItemFlags, and Qt.ItemDataRole.

Qt.ClipOperation

ConstantValueDescription
Qt.NoClip0This operation turns clipping off.
Qt.ReplaceClip1Replaces the current clip path/rect/region with the one supplied in the function call.
Qt.IntersectClip2Intersects the current clip path/rect/region with the one supplied in the function call.
Qt.UniteClip3Unites the current clip path/rect/region with the one supplied in the function call.

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.

ConstantValueDescription
Qt.DirectConnection1When emitted, the signal is immediately delivered to the slot.
Qt.QueuedConnection2When emitted, the signal is queued until the event loop is able to deliver it to the slot.
Qt.BlockingQueuedConnection4Same as QueuedConnection, except that the current thread blocks until the slot has been delivered. This connection type should only be used for receivers in a different thread. Note that misuse of this type can lead to dead locks in your application.
Qt.AutoConnection0If the signal is emitted from the thread in which the receiving object lives, the slot is invoked directly, as with Qt.DirectConnection; otherwise the signal is queued, as with Qt.QueuedConnection.

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

         QObject.connect: Cannot queue arguments of type 'MyType'

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

See also Thread Support in Qt, QObject.connect(), and qRegisterMetaType().

Qt.ContextMenuPolicy

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

ConstantValueDescription
Qt.NoContextMenu0the widget does not feature a context menu, context menu handling is deferred to the widget's parent.
Qt.PreventContextMenu4the 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 mousePressEvent(), and mouseReleaseEvent().
Qt.DefaultContextMenu1the widget's QWidget.contextMenuEvent() handler is called.
Qt.ActionsContextMenu2the widget displays its QWidget.actions() as context menu.
Qt.CustomContextMenu3the widget emits the QWidget.customContextMenuRequested() signal.

Qt.Corner

This enum type specifies a corner in a rectangle:

ConstantValueDescription
Qt.TopLeftCorner0x00000The top-left corner of the rectangle.
Qt.TopRightCorner0x00001The top-right corner of the rectangle.
Qt.BottomLeftCorner0x00002The bottom-left corner of the rectangle.
Qt.BottomRightCorner0x00003The bottom-right corner of the rectangle.

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.

ConstantValueDescription
Qt.ArrowCursor0 The standard arrow cursor.
Qt.UpArrowCursor1 An arrow pointing upwards toward the top of the screen.
Qt.CrossCursor2 A crosshair cursor, typically used to help the user accurately select a point on the screen.
Qt.WaitCursor3 An hourglass or watch cursor, usually shown during operations that prevent the user from interacting with the application.
Qt.IBeamCursor4 A caret or ibeam cursor, indicating that a widget can accept and display text input.
Qt.SizeVerCursor5 A cursor used for elements that are used to vertically resize top-level windows.
Qt.SizeHorCursor6 A cursor used for elements that are used to horizontally resize top-level windows.
Qt.SizeBDiagCursor7 A cursor used for elements that are used to diagonally resize top-level windows at their top-right and bottom-left corners.
Qt.SizeFDiagCursor8 A cursor used for elements that are used to diagonally resize top-level windows at their top-left and bottom-right corners.
Qt.SizeAllCursor9 A cursor used for elements that are used to resize top-level windows in any direction.
Qt.BlankCursor10A blank/invisible cursor, typically used when the cursor shape needs to be hidden.
Qt.SplitVCursor11 A cursor used for vertical splitters, indicating that a handle can be dragged horizontally to adjust the use of available space.
Qt.SplitHCursor12 A cursor used for horizontal splitters, indicating that a handle can be dragged vertically to adjust the use of available space.
Qt.PointingHandCursor13 A pointing hand cursor that is typically used for clickable elements such as hyperlinks.
Qt.ForbiddenCursor14 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.OpenHandCursor17 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.ClosedHandCursor18 A cursor representing a closed hand, typically used to indicate that a dragging operation is in progress that involves scrolling.
Qt.WhatsThisCursor15 An arrow with a question mark, typically used
Qt.BusyCursor16 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.BitmapCursor24 

Qt.DateFormat

ConstantValueDescription
Qt.TextDate0The default Qt format.
Qt.ISODate1ISO 8601 extended format: either YYYY-MM-DD for dates or YYYY-MM-DDTHH:MM:SS for combined dates and times.
Qt.SystemLocaleShortDate?The short format used by the operating system.
Qt.SystemLocaleLongDate?The long format used by the operating system.
Qt.DefaultLocaleShortDate?The short format specified by the application's locale.
Qt.DefaultLocaleLongDate?The long format used by the application's locale.
Qt.SystemLocaleDate2This enum value is deprecated. Use Qt.SystemLocaleShortDate instead (or Qt.SystemLocaleLongDate if you want long dates).
Qt.LocaleDate?This enum value is deprecated. Use Qt.DefaultLocaleShortDate instead (or Qt.DefaultLocaleLongDate if you want long dates).
Qt.LocalDateSystemLocaleDateThis enum value is deprecated. Use Qt.SystemLocaleShortDate instead (or Qt.SystemLocaleLongDate if you want long dates).

Note: 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, minute and second used to specify the time. The presence of a literal T character is used to separate the date and time when both are specified.

Qt.DayOfWeek

ConstantValue
Qt.Monday1
Qt.Tuesday2
Qt.Wednesday3
Qt.Thursday4
Qt.Friday5
Qt.Saturday6
Qt.Sunday7

Qt.DockWidgetArea

ConstantValue
Qt.LeftDockWidgetArea0x1
Qt.RightDockWidgetArea0x2
Qt.TopDockWidgetArea0x4
Qt.BottomDockWidgetArea0x8
Qt.AllDockWidgetAreasDockWidgetArea_Mask
Qt.NoDockWidgetArea0

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

Qt.DropAction

ConstantValueDescription
Qt.CopyAction0x1Copy the data to the target.
Qt.MoveAction0x2Move the data from the source to the target.
Qt.LinkAction0x4Create a link from the source to the target.
Qt.ActionMask0xff 
Qt.IgnoreAction0x0Ignore the action (do nothing with the data).

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

Qt.EventPriority

This enum can be used to specify event priorities.

ConstantValueDescription
Qt.HighEventPriority1Events with this priority are sent before events with NormalEventPriority or LowEventPriority.
Qt.NormalEventPriority0Events with this priority are sent after events with HighEventPriority, but before events with LowEventPriority.
Qt.LowEventPriority-1Events 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:

     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 QCoreApplication.postEvent().

Qt.FillRule

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

ConstantValueDescription
Qt.OddEvenFill0Specifies 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.WindingFill1Specifies 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.

Qt.FocusPolicy

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

ConstantValueDescription
Qt.TabFocus0x1the widget accepts focus by tabbing.
Qt.ClickFocus0x2the widget accepts focus by clicking.
Qt.StrongFocusTabFocus | ClickFocus | 0x8the widget accepts focus by both tabbing and clicking. On Mac OS X this will also be indicate that the widget accepts tab focus when in 'Text/List focus mode'.
Qt.WheelFocusStrongFocus | 0x4like Qt.StrongFocus plus the widget accepts focus by using the mouse wheel.
Qt.NoFocus0the widget does not accept focus.

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.

ConstantValueDescription
Qt.MouseFocusReason0A mouse action occurred.
Qt.TabFocusReason1The Tab key was pressed.
Qt.BacktabFocusReason2A Backtab occurred. The input for this may include the Shift or Control keys; e.g. Shift+Tab.
Qt.ActiveWindowFocusReason3The window system made this window either active or inactive.
Qt.PopupFocusReason4The application opened/closed a pop-up that grabbed/released the keyboard focus.
Qt.ShortcutFocusReason5The user typed a label's buddy shortcut
Qt.MenuBarFocusReason6The menu bar took focus.
Qt.OtherFocusReason7Another reason, usually application-specific.

See also Keyboard Focus.

Qt.GlobalColor

Qt's predefined QColor objects:

ConstantValueDescription
Qt.white3 White (#ffffff)
Qt.black2 Black (#000000)
Qt.red7 Red (#ff0000)
Qt.darkRed13 Dark red (#800000)
Qt.green8 Green (#00ff00)
Qt.darkGreen14 Dark green (#008000)
Qt.blue9 Blue (#0000ff)
Qt.darkBlue15 Dark blue (#000080)
Qt.cyan10 Cyan (#00ffff)
Qt.darkCyan16 Dark cyan (#008080)
Qt.magenta11 Magenta (#ff00ff)
Qt.darkMagenta17 Dark magenta (#800080)
Qt.yellow12 Yellow (#ffff00)
Qt.darkYellow18 Dark yellow (#808000)
Qt.gray5 Gray (#a0a0a4)
Qt.darkGray4 Dark gray (#808080)
Qt.lightGray6 Light gray (#c0c0c0)
Qt.transparent19a transparent black value (i.e., QColor(0, 0, 0, 0))
Qt.color000 pixel value (for bitmaps)
Qt.color111 pixel value (for bitmaps)

See also QColor.

Qt.HitTestAccuracy

This type is only available if the QtGui module is imported.

This enum contains the types of accuracy that can be used by the QTextDocument class when testing for mouse clicks on text documents.

ConstantValueDescription
Qt.ExactHit0The point at which input occurred must coincide exactly with input-sensitive parts of the document.
Qt.FuzzyHit1The point at which input occurred can lie close to input-sensitive parts of the document.

This enum is defined in the <QTextDocument> header file.

Qt.ImageConversionFlag

The options marked "(default)" are set if no other values from the list are included (since the defaults are zero):

Color/Mono preference (ignored for QBitmap):

ConstantValueDescription
Qt.AutoColor0x00000000(default) - If the image has depth 1 and contains only black and white pixels, the pixmap becomes monochrome.
Qt.ColorOnly0x00000003The pixmap is dithered/converted to the native display depth.
Qt.MonoOnly0x00000002The pixmap becomes monochrome. If necessary, it is dithered using the chosen dithering algorithm.

Dithering mode preference for RGB channels:

ConstantValueDescription
Qt.DiffuseDither0x00000000(default) - A high-quality dither.
Qt.OrderedDither0x00000010A faster, more ordered dither.
Qt.ThresholdDither0x00000020No dithering; closest color is used.

Dithering mode preference for alpha channel:

ConstantValueDescription
Qt.ThresholdAlphaDither0x00000000(default) - No dithering.
Qt.OrderedAlphaDither0x00000004A faster, more ordered dither.
Qt.DiffuseAlphaDither0x00000008A high-quality dither.

Color matching versus dithering preference:

ConstantValueDescription
Qt.PreferDither0x00000040(default when converting to a pixmap) - Always dither 32-bit images when the image is converted to 8 bits.
Qt.AvoidDither0x00000080(default when converting for the purpose of saving to file) - Dither 32-bit images only if the image has more than 256 colors and it is being converted to 8 bits.

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

Qt.InputMethodQuery

ConstantValueDescription
Qt.ImMicroFocus0The rectangle covering the area of the input cursor in widget coordinates.
Qt.ImFont1The currently used font for text input.
Qt.ImCursorPosition2The logical position of the cursor within the text surrounding the input area (see ImSurroundingText).
Qt.ImSurroundingText3The plain text around the input area, for example the current paragraph.
Qt.ImCurrentSelection4The currently selected text.

Qt.ItemDataRole

Each item in the model has a set of data elements associated with it, each with its own role. The roles are used by the view to indicate to the model which type of data it needs.

The general purpose roles are:

ConstantValueDescription
Qt.DisplayRole0The key data to be rendered (usually text).
Qt.DecorationRole1The data to be rendered as a decoration (usually an icon).
Qt.EditRole2The data in a form suitable for editing in an editor.
Qt.ToolTipRole3The data displayed in the item's tooltip.
Qt.StatusTipRole4The data displayed in the status bar.
Qt.WhatsThisRole5The data displayed for the item in "What's This?" mode.
Qt.SizeHintRole13The size hint for the item that will be supplied to views.

Roles describing appearance and meta data:

ConstantValueDescription
Qt.FontRole6The font used for items rendered with the default delegate.
Qt.TextAlignmentRole7The alignment of the text for items rendered with the default delegate.
Qt.BackgroundRole8The background brush used for items rendered with the default delegate.
Qt.BackgroundColorRole8This role is obsolete. Use BackgroundRole instead.
Qt.ForegroundRole9The foreground brush (text color, typically) used for items rendered with the default delegate.
Qt.TextColorRole9This role is obsolete. Use ForegroundRole instead.
Qt.CheckStateRole10This role is used to obtain the checked state of an item (see Qt.CheckState).

Accessibility roles:

ConstantValueDescription
Qt.AccessibleTextRole11The text to be used by accessibility extensions and plugins, such as screen readers.
Qt.AccessibleDescriptionRole12A description of the item for accessibility purposes.

User roles:

ConstantValueDescription
Qt.UserRole32The first role that can be used for application-specific purposes.

Qt.ItemFlag

This enum describes the properties of an item:

ConstantValueDescription
Qt.NoItemFlags0It does not have any properties set.
Qt.ItemIsSelectable1It can be selected.
Qt.ItemIsEditable2It can be edited.
Qt.ItemIsDragEnabled4It can be dragged.
Qt.ItemIsDropEnabled8It can be used as a drop target.
Qt.ItemIsUserCheckable16It can be checked or unchecked by the user.
Qt.ItemIsEnabled32The user can interact with the item.
Qt.ItemIsTristate64The item is checkable with three separate states.

Note that checkable items need to be given both a suitable set of flags and an initial state, indicating whether the item is checked or not. This is handled automatically for model/view components, but needs to be explicitly set for instances of QListWidgetItem, QTableWidgetItem, and QTreeWidgetItem.

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

See also QAbstractItemModel.

Qt.ItemSelectionMode

This enum is used in QGraphicsItem, QGraphicsScene and QGraphicsView to specify how items are selected, or how to determine if a shapes and items collide.

ConstantValueDescription
Qt.ContainsItemShape0x0The output list contains only items whose shape is fully contained inside the selection area. Items that intersect with the area's outline are not included.
Qt.IntersectsItemShape0x1The output list contains both items whose shape is fully contained inside the selection area, and items that intersect with the area's outline. This is a common mode for rubber band selection.
Qt.ContainsItemBoundingRect0x2The output list contains only items whose bounding rectangle is fully contained inside the selection area. Items that intersect with the area's outline are not included.
Qt.IntersectsItemBoundingRect0x3The output list contains both items whose bounding rectangle is fully contained inside the selection area, and items that intersect with the area's outline. This method is commonly used for determining areas that need redrawing.

See also QGraphicsScene.items(), QGraphicsScene.collidingItems(), QGraphicsView.items(), QGraphicsItem.collidesWithItem(), and QGraphicsItem.collidesWithPath().

Qt.Key

The key names used by Qt.

ConstantValueDescription
Qt.Key_Escape0x01000000 
Qt.Key_Tab0x01000001 
Qt.Key_Backtab0x01000002 
Qt.Key_Backspace0x01000003 
Qt.Key_Return0x01000004 
Qt.Key_Enter0x01000005Typically located on the keypad.
Qt.Key_Insert0x01000006 
Qt.Key_Delete0x01000007 
Qt.Key_Pause0x01000008 
Qt.Key_Print0x01000009 
Qt.Key_SysReq0x0100000a 
Qt.Key_Clear0x0100000b 
Qt.Key_Home0x01000010 
Qt.Key_End0x01000011 
Qt.Key_Left0x01000012 
Qt.Key_Up0x01000013 
Qt.Key_Right0x01000014 
Qt.Key_Down0x01000015 
Qt.Key_PageUp0x01000016 
Qt.Key_PageDown0x01000017 
Qt.Key_Shift0x01000020 
Qt.Key_Control0x01000021On Mac OS X, this corresponds to the Command keys.
Qt.Key_Meta0x01000022On Mac OS X, this corresponds to the Control keys. On Windows keyboards, this key is mapped to the Windows key.
Qt.Key_Alt0x01000023 
Qt.Key_AltGr0x01001103On Windows, when the KeyDown event for this key is sent, the Ctrl+Alt modifiers are also set.
Qt.Key_CapsLock0x01000024 
Qt.Key_NumLock0x01000025 
Qt.Key_ScrollLock0x01000026 
Qt.Key_F10x01000030 
Qt.Key_F20x01000031 
Qt.Key_F30x01000032 
Qt.Key_F40x01000033 
Qt.Key_F50x01000034 
Qt.Key_F60x01000035 
Qt.Key_F70x01000036 
Qt.Key_F80x01000037 
Qt.Key_F90x01000038 
Qt.Key_F100x01000039 
Qt.Key_F110x0100003a 
Qt.Key_F120x0100003b 
Qt.Key_F130x0100003c 
Qt.Key_F140x0100003d 
Qt.Key_F150x0100003e 
Qt.Key_F160x0100003f 
Qt.Key_F170x01000040 
Qt.Key_F180x01000041 
Qt.Key_F190x01000042 
Qt.Key_F200x01000043 
Qt.Key_F210x01000044 
Qt.Key_F220x01000045 
Qt.Key_F230x01000046 
Qt.Key_F240x01000047 
Qt.Key_F250x01000048 
Qt.Key_F260x01000049 
Qt.Key_F270x0100004a 
Qt.Key_F280x0100004b 
Qt.Key_F290x0100004c 
Qt.Key_F300x0100004d 
Qt.Key_F310x0100004e 
Qt.Key_F320x0100004f 
Qt.Key_F330x01000050 
Qt.Key_F340x01000051 
Qt.Key_F350x01000052 
Qt.Key_Super_L0x01000053 
Qt.Key_Super_R0x01000054 
Qt.Key_Menu0x01000055 
Qt.Key_Hyper_L0x01000056 
Qt.Key_Hyper_R0x01000057 
Qt.Key_Help0x01000058 
Qt.Key_Direction_L0x01000059 
Qt.Key_Direction_R0x01000060 
Qt.Key_Space0x20 
Qt.Key_AnyKey_Space 
Qt.Key_Exclam0x21 
Qt.Key_QuoteDbl0x22 
Qt.Key_NumberSign0x23 
Qt.Key_Dollar0x24 
Qt.Key_Percent0x25 
Qt.Key_Ampersand0x26 
Qt.Key_Apostrophe0x27 
Qt.Key_ParenLeft0x28 
Qt.Key_ParenRight0x29 
Qt.Key_Asterisk0x2a 
Qt.Key_Plus0x2b 
Qt.Key_Comma0x2c 
Qt.Key_Minus0x2d 
Qt.Key_Period0x2e 
Qt.Key_Slash0x2f 
Qt.Key_00x30 
Qt.Key_10x31 
Qt.Key_20x32 
Qt.Key_30x33 
Qt.Key_40x34 
Qt.Key_50x35 
Qt.Key_60x36 
Qt.Key_70x37 
Qt.Key_80x38 
Qt.Key_90x39 
Qt.Key_Colon0x3a 
Qt.Key_Semicolon0x3b 
Qt.Key_Less0x3c 
Qt.Key_Equal0x3d 
Qt.Key_Greater0x3e 
Qt.Key_Question0x3f 
Qt.Key_At0x40 
Qt.Key_A0x41 
Qt.Key_B0x42 
Qt.Key_C0x43 
Qt.Key_D0x44 
Qt.Key_E0x45 
Qt.Key_F0x46 
Qt.Key_G0x47 
Qt.Key_H0x48 
Qt.Key_I0x49 
Qt.Key_J0x4a 
Qt.Key_K0x4b 
Qt.Key_L0x4c 
Qt.Key_M0x4d 
Qt.Key_N0x4e 
Qt.Key_O0x4f 
Qt.Key_P0x50 
Qt.Key_Q0x51 
Qt.Key_R0x52 
Qt.Key_S0x53 
Qt.Key_T0x54 
Qt.Key_U0x55 
Qt.Key_V0x56 
Qt.Key_W0x57 
Qt.Key_X0x58 
Qt.Key_Y0x59 
Qt.Key_Z0x5a 
Qt.Key_BracketLeft0x5b 
Qt.Key_Backslash0x5c 
Qt.Key_BracketRight0x5d 
Qt.Key_AsciiCircum0x5e 
Qt.Key_Underscore0x5f 
Qt.Key_QuoteLeft0x60 
Qt.Key_BraceLeft0x7b 
Qt.Key_Bar0x7c 
Qt.Key_BraceRight0x7d 
Qt.Key_AsciiTilde0x7e 
Qt.Key_nobreakspace0x0a0 
Qt.Key_exclamdown0x0a1 
Qt.Key_cent0x0a2 
Qt.Key_sterling0x0a3 
Qt.Key_currency0x0a4 
Qt.Key_yen0x0a5 
Qt.Key_brokenbar0x0a6 
Qt.Key_section0x0a7 
Qt.Key_diaeresis0x0a8 
Qt.Key_copyright0x0a9 
Qt.Key_ordfeminine0x0aa 
Qt.Key_guillemotleft0x0ab 
Qt.Key_notsign0x0ac 
Qt.Key_hyphen0x0ad 
Qt.Key_registered0x0ae 
Qt.Key_macron0x0af 
Qt.Key_degree0x0b0 
Qt.Key_plusminus0x0b1 
Qt.Key_twosuperior0x0b2 
Qt.Key_threesuperior0x0b3 
Qt.Key_acute0x0b4 
Qt.Key_mu0x0b5 
Qt.Key_paragraph0x0b6 
Qt.Key_periodcentered0x0b7 
Qt.Key_cedilla0x0b8 
Qt.Key_onesuperior0x0b9 
Qt.Key_masculine0x0ba 
Qt.Key_guillemotright0x0bb 
Qt.Key_onequarter0x0bc 
Qt.Key_onehalf0x0bd 
Qt.Key_threequarters0x0be 
Qt.Key_questiondown0x0bf 
Qt.Key_Agrave0x0c0 
Qt.Key_Aacute0x0c1 
Qt.Key_Acircumflex0x0c2 
Qt.Key_Atilde0x0c3 
Qt.Key_Adiaeresis0x0c4 
Qt.Key_Aring0x0c5 
Qt.Key_AE0x0c6 
Qt.Key_Ccedilla0x0c7 
Qt.Key_Egrave0x0c8 
Qt.Key_Eacute0x0c9 
Qt.Key_Ecircumflex0x0ca 
Qt.Key_Ediaeresis0x0cb 
Qt.Key_Igrave0x0cc 
Qt.Key_Iacute0x0cd 
Qt.Key_Icircumflex0x0ce 
Qt.Key_Idiaeresis0x0cf 
Qt.Key_ETH0x0d0 
Qt.Key_Ntilde0x0d1 
Qt.Key_Ograve0x0d2 
Qt.Key_Oacute0x0d3 
Qt.Key_Ocircumflex0x0d4 
Qt.Key_Otilde0x0d5 
Qt.Key_Odiaeresis0x0d6 
Qt.Key_multiply0x0d7 
Qt.Key_Ooblique0x0d8 
Qt.Key_Ugrave0x0d9 
Qt.Key_Uacute0x0da 
Qt.Key_Ucircumflex0x0db 
Qt.Key_Udiaeresis0x0dc 
Qt.Key_Yacute0x0dd 
Qt.Key_THORN0x0de 
Qt.Key_ssharp0x0df 
Qt.Key_division0x0f7 
Qt.Key_ydiaeresis0x0ff 
Qt.Key_Multi_key0x01001120 
Qt.Key_Codeinput0x01001137 
Qt.Key_SingleCandidate0x0100113c 
Qt.Key_MultipleCandidate0x0100113d 
Qt.Key_PreviousCandidate0x0100113e 
Qt.Key_Mode_switch0x0100117e 
Qt.Key_Kanji0x01001121 
Qt.Key_Muhenkan0x01001122 
Qt.Key_Henkan0x01001123 
Qt.Key_Romaji0x01001124 
Qt.Key_Hiragana0x01001125 
Qt.Key_Katakana0x01001126 
Qt.Key_Hiragana_Katakana0x01001127 
Qt.Key_Zenkaku0x01001128 
Qt.Key_Hankaku0x01001129 
Qt.Key_Zenkaku_Hankaku0x0100112a 
Qt.Key_Touroku0x0100112b 
Qt.Key_Massyo0x0100112c 
Qt.Key_Kana_Lock0x0100112d 
Qt.Key_Kana_Shift0x0100112e 
Qt.Key_Eisu_Shift0x0100112f 
Qt.Key_Eisu_toggle0x01001130 
Qt.Key_Hangul0x01001131 
Qt.Key_Hangul_Start0x01001132 
Qt.Key_Hangul_End0x01001133 
Qt.Key_Hangul_Hanja0x01001134 
Qt.Key_Hangul_Jamo0x01001135 
Qt.Key_Hangul_Romaja0x01001136 
Qt.Key_Hangul_Jeonja0x01001138 
Qt.Key_Hangul_Banja0x01001139 
Qt.Key_Hangul_PreHanja0x0100113a 
Qt.Key_Hangul_PostHanja0x0100113b 
Qt.Key_Hangul_Special0x0100113f 
Qt.Key_Dead_Grave0x01001250 
Qt.Key_Dead_Acute0x01001251 
Qt.Key_Dead_Circumflex0x01001252 
Qt.Key_Dead_Tilde0x01001253 
Qt.Key_Dead_Macron0x01001254 
Qt.Key_Dead_Breve0x01001255 
Qt.Key_Dead_Abovedot0x01001256 
Qt.Key_Dead_Diaeresis0x01001257 
Qt.Key_Dead_Abovering0x01001258 
Qt.Key_Dead_Doubleacute0x01001259 
Qt.Key_Dead_Caron0x0100125a 
Qt.Key_Dead_Cedilla0x0100125b 
Qt.Key_Dead_Ogonek0x0100125c 
Qt.Key_Dead_Iota0x0100125d 
Qt.Key_Dead_Voiced_Sound0x0100125e 
Qt.Key_Dead_Semivoiced_Sound0x0100125f 
Qt.Key_Dead_Belowdot0x01001260 
Qt.Key_Dead_Hook0x01001261 
Qt.Key_Dead_Horn0x01001262 
Qt.Key_Back0x01000061 
Qt.Key_Forward0x01000062 
Qt.Key_Stop0x01000063 
Qt.Key_Refresh0x01000064 
Qt.Key_VolumeDown0x01000070 
Qt.Key_VolumeMute0x01000071 
Qt.Key_VolumeUp0x01000072 
Qt.Key_BassBoost0x01000073 
Qt.Key_BassUp0x01000074 
Qt.Key_BassDown0x01000075 
Qt.Key_TrebleUp0x01000076 
Qt.Key_TrebleDown0x01000077 
Qt.Key_MediaPlay0x01000080 
Qt.Key_MediaStop0x01000081 
Qt.Key_MediaPrevious0x01000082 
Qt.Key_MediaNext0x01000083 
Qt.Key_MediaRecord0x01000084 
Qt.Key_HomePage0x01000090 
Qt.Key_Favorites0x01000091 
Qt.Key_Search0x01000092 
Qt.Key_Standby0x01000093 
Qt.Key_OpenUrl0x01000094 
Qt.Key_LaunchMail0x010000a0 
Qt.Key_LaunchMedia0x010000a1 
Qt.Key_Launch00x010000a2 
Qt.Key_Launch10x010000a3 
Qt.Key_Launch20x010000a4 
Qt.Key_Launch30x010000a5 
Qt.Key_Launch40x010000a6 
Qt.Key_Launch50x010000a7 
Qt.Key_Launch60x010000a8 
Qt.Key_Launch70x010000a9 
Qt.Key_Launch80x010000aa 
Qt.Key_Launch90x010000ab 
Qt.Key_LaunchA0x010000ac 
Qt.Key_LaunchB0x010000ad 
Qt.Key_LaunchC0x010000ae 
Qt.Key_LaunchD0x010000af 
Qt.Key_LaunchE0x010000b0 
Qt.Key_LaunchF0x010000b1 
Qt.Key_MediaLast0x0100ffff 
Qt.Key_unknown0x01ffffff 
Qt.Key_Call0x01100004 
Qt.Key_Context10x01100000 
Qt.Key_Context20x01100001 
Qt.Key_Context30x01100002 
Qt.Key_Context40x01100003 
Qt.Key_Flip0x01100006 
Qt.Key_Hangup0x01100005 
Qt.Key_No0x01010002 
Qt.Key_Select0x01010000 
Qt.Key_Yes0x01010001 
Qt.Key_Execute0x01020003 
Qt.Key_Printer0x01020002 
Qt.Key_Play0x01020005 
Qt.Key_Sleep0x01020004 
Qt.Key_Zoom0x01020006 
Qt.Key_Cancel0x01020001 

See also QKeyEvent.key().

Qt.KeyboardModifier

This enum describes the modifier keys.

ConstantValueDescription
Qt.NoModifier0x00000000No modifier key is pressed.
Qt.ShiftModifier0x02000000A Shift key on the keyboard is pressed.
Qt.ControlModifier0x04000000A Ctrl key on the keyboard is pressed.
Qt.AltModifier0x08000000An Alt key on the keyboard is pressed.
Qt.MetaModifier0x10000000A Meta key on the keyboard is pressed.
Qt.KeypadModifier0x20000000A keypad button is pressed.
Qt.GroupSwitchModifier0x40000000X11 only. A Mode_switch key on the keyboard is pressed.

Note: On Mac OS X, the ControlModifier value corresponds to the Command keys on the Macintosh keyboard, and the MetaModifier value corresponds to the Control keys. The KeypadModifier value will also be set when an arrow key is pressed as the arrow keys are considered part of the keypad.

Note: On Windows Keyboards, Qt.MetaModifier and Qt.Key_Meta are mapped to the Windows key.

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

See also MouseButton and Modifier.

Qt.LayoutDirection

Specifies the direction of Qt's layouts:

ConstantValueDescription
Qt.LeftToRight0Left-to-right layout.
Qt.RightToLeft1Right-to-left layout.

Right-to-left layouts are necessary for certain languages, notably Arabic and Hebrew.

See also QApplication.setLayoutDirection() and QWidget.setLayoutDirection().

Qt.MaskMode

This enum specifies the behavior of the QPixmap.createMaskFromColor() and QImage.createMaskFromColor() functions.

ConstantValueDescription
Qt.MaskInColor0Creates a mask where all pixels matching the given color are opaque.
Qt.MaskOutColor1Creates a mask where all pixels matching the given color are transparent.

Qt.MatchFlag

This enum describes the type of matches that can be used when searching for items in a model.

ConstantValueDescription
Qt.MatchExactly0Performs QVariant-based matching.
Qt.MatchFixedString8Performs string-based matching. String-based comparisons are case-insensitive unless the MatchCaseSensitive flag is also specified.
Qt.MatchContains1The search term is contained in the item.
Qt.MatchStartsWith2The search term matches the start of the item.
Qt.MatchEndsWith3The search term matches the end of the item.
Qt.MatchCaseSensitive16The search is case sensitive.
Qt.MatchRegExp4Performs string-based matching using a regular expression as the search term.
Qt.MatchWildcard5Performs string-based matching using a string with wildcards as the search term.
Qt.MatchWrap32Perform a search that wraps around, so that when the search reaches the last item in the model, it begins again at the first item and continues until all items have been examined.
Qt.MatchRecursive64Searches the entire hierarchy.

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

See also QString.compare() and QRegExp.

Qt.Modifier

This enum provides shorter names for the keyboard modifier keys supported by Qt.

Note: On Mac OS X, the CTRL value corresponds to the Command keys on the Macintosh keyboard, and the META value corresponds to the Control keys.

ConstantValueDescription
Qt.SHIFTQt.ShiftModifierThe Shift keys provided on all standard keyboards.
Qt.METAQt.MetaModifierThe Meta keys.
Qt.CTRLQt.ControlModifierThe Ctrl keys.
Qt.ALTQt.AltModifierThe normal Alt keys, but not keys like AltGr.
Qt.UNICODE_ACCEL0x00000000The shortcut is specified as a Unicode code point, not as a Qt Key.

See also KeyboardModifier and MouseButton.

Qt.MouseButton

This enum type describes the different mouse buttons.

ConstantValueDescription
Qt.NoButton0x00000000The button state does not refer to any button (see QMouseEvent.button()).
Qt.LeftButton0x00000001The left button is pressed, or an event refers to the left button. (The left button may be the right button on left-handed mice.)
Qt.RightButton0x00000002The right button.
Qt.MidButton0x00000004The middle button.
Qt.XButton10x00000008The first X button.
Qt.XButton20x00000010The second X button.

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

See also KeyboardModifier and Modifier.

Qt.Orientation

This type is used to signify an object's orientation.

ConstantValue
Qt.Horizontal0x1
Qt.Vertical0x2

Orientation is used with QScrollBar for example.

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

Qt.PenCapStyle

This enum type defines the pen cap styles supported by Qt, i.e. the line end caps that can be drawn using QPainter.

Qt.SquareCapQt.FlatCapQt.RoundCap

ConstantValueDescription
Qt.FlatCap0x00a square line end that does not cover the end point of the line.
Qt.SquareCap0x10a square line end that covers the end point and extends beyond it by half the line width.
Qt.RoundCap0x20a rounded line end.

See also QPen.

Qt.PenJoinStyle

This enum type defines the pen join styles supported by Qt, i.e. which joins between two connected lines can be drawn using QPainter.

Qt.BevelJoinQt.MiterJoinQt.RoundJoin

ConstantValueDescription
Qt.MiterJoin0x00The outer edges of the lines are extended to meet at an angle, and this area is filled.
Qt.BevelJoin0x40The triangular notch between the two lines is filled.
Qt.RoundJoin0x80A circular arc between the two lines is filled.
Qt.SvgMiterJoin0x100A miter join corresponding to the definition of a miter join in the SVG 1.2 Tiny specification.

See also QPen.

Qt.PenStyle

This enum type defines the pen styles that can be drawn using QPainter. The styles are:

Qt.SolidLineQt.DashLineQt.DotLine
Qt.DashDotLineQt.DashDotDotLineQt.CustomDashLine

ConstantValueDescription
Qt.NoPen0no line at all. For example, QPainter.drawRect() fills but does not draw any boundary line.
Qt.Soli