Qt Namespace
Qt命名空间包含所有Qt库中通用标识符. 更多...
头文件: | #include <Qt> |
qmake: | QT += core |
Types
flags | Alignment |
enum | AlignmentFlag { AlignLeft, AlignRight, AlignHCenter, AlignJustify, ..., AlignVertical_Mask } |
enum | AnchorPoint { AnchorLeft, AnchorHorizontalCenter, AnchorRight, AnchorTop, AnchorVerticalCenter, AnchorBottom } |
enum | ApplicationAttribute { AA_DontShowIconsInMenus, AA_NativeWindows, AA_DontCreateNativeWidgetSiblings, AA_PluginApplication, ..., AA_MSWindowsUseDirect3DByDefault } |
enum | ApplicationState { ApplicationSuspended, ApplicationHidden, ApplicationInactive, ApplicationActive } |
flags | ApplicationStates |
enum | ArrowType { NoArrow, UpArrow, DownArrow, LeftArrow, RightArrow } |
enum | AspectRatioMode { IgnoreAspectRatio, KeepAspectRatio, KeepAspectRatioByExpanding } |
enum | Axis { XAxis, YAxis, ZAxis } |
enum | BGMode { TransparentMode, OpaqueMode } |
enum | BrushStyle { NoBrush, SolidPattern, Dense1Pattern, Dense2Pattern, ..., TexturePattern } |
enum | CaseSensitivity { CaseInsensitive, CaseSensitive } |
enum | CheckState { Unchecked, PartiallyChecked, Checked } |
enum | ChecksumType { ChecksumIso3309, ChecksumItuV41 } |
enum | ClipOperation { NoClip, ReplaceClip, IntersectClip } |
enum | ConnectionType { AutoConnection, DirectConnection, QueuedConnection, BlockingQueuedConnection, UniqueConnection } |
enum | ContextMenuPolicy { NoContextMenu, PreventContextMenu, DefaultContextMenu, ActionsContextMenu, CustomContextMenu } |
enum | CoordinateSystem { DeviceCoordinates, LogicalCoordinates } |
enum | Corner { TopLeftCorner, TopRightCorner, BottomLeftCorner, BottomRightCorner } |
enum | CursorMoveStyle { LogicalMoveStyle, VisualMoveStyle } |
enum | CursorShape { ArrowCursor, UpArrowCursor, CrossCursor, WaitCursor, ..., BitmapCursor } |
enum | DateFormat { TextDate, ISODate, ISODateWithMs, SystemLocaleShortDate, ..., RFC2822Date } |
enum | DayOfWeek { Monday, Tuesday, Wednesday, Thursday, ..., Sunday } |
enum | DockWidgetArea { LeftDockWidgetArea, RightDockWidgetArea, TopDockWidgetArea, BottomDockWidgetArea, AllDockWidgetAreas, NoDockWidgetArea } |
flags | DockWidgetAreas |
enum | DropAction { CopyAction, MoveAction, LinkAction, ActionMask, IgnoreAction, TargetMoveAction } |
flags | DropActions |
enum | Edge { TopEdge, LeftEdge, RightEdge, BottomEdge } |
flags | Edges |
enum | EnterKeyType { EnterKeyDefault, EnterKeyReturn, EnterKeyDone, EnterKeyGo, ..., EnterKeyPrevious } |
enum | EventPriority { HighEventPriority, NormalEventPriority, LowEventPriority } |
enum | FillRule { OddEvenFill, WindingFill } |
enum | FindChildOption { FindDirectChildrenOnly, FindChildrenRecursively } |
flags | FindChildOptions |
enum | FocusPolicy { TabFocus, ClickFocus, StrongFocus, WheelFocus, NoFocus } |
enum | FocusReason { MouseFocusReason, TabFocusReason, BacktabFocusReason, ActiveWindowFocusReason, ..., OtherFocusReason } |
enum | GestureFlag { DontStartGestureOnChildren, ReceivePartialGestures, IgnoredGesturesPropagateToParent } |
flags | GestureFlags |
enum | GestureState { NoGesture, GestureStarted, GestureUpdated, GestureFinished, GestureCanceled } |
enum | GestureType { TapGesture, TapAndHoldGesture, PanGesture, PinchGesture, SwipeGesture, CustomGesture } |
enum | GlobalColor { white, black, red, darkRed, ..., color1 } |
typedef | HANDLE |
enum | HitTestAccuracy { ExactHit, FuzzyHit } |
enum | ImageConversionFlag { AutoColor, ColorOnly, MonoOnly, DiffuseDither, ..., NoFormatConversion } |
flags | ImageConversionFlags |
enum | InputMethodHint { ImhNone, ImhHiddenText, ImhSensitiveData, ImhNoAutoUppercase, ..., ImhExclusiveInputMask } |
flags | InputMethodHints |
flags | InputMethodQueries |
enum | InputMethodQuery { ImEnabled, ImMicroFocus, ImCursorRectangle, ImFont, ..., ImQueryAll } |
enum | ItemDataRole { DisplayRole, DecorationRole, EditRole, ToolTipRole, ..., UserRole } |
enum | ItemFlag { NoItemFlags, ItemIsSelectable, ItemIsEditable, ItemIsDragEnabled, ..., ItemIsUserTristate } |
flags | ItemFlags |
enum | ItemSelectionMode { ContainsItemShape, IntersectsItemShape, ContainsItemBoundingRect, IntersectsItemBoundingRect } |
enum | ItemSelectionOperation { ReplaceSelection, AddToSelection } |
enum | Key { Key_Escape, Key_Tab, Key_Backtab, Key_Backspace, ..., Key_Cancel } |
enum | KeyboardModifier { NoModifier, ShiftModifier, ControlModifier, AltModifier, ..., GroupSwitchModifier } |
flags | KeyboardModifiers |
enum | LayoutDirection { LeftToRight, RightToLeft, LayoutDirectionAuto } |
enum | MaskMode { MaskInColor, MaskOutColor } |
enum | MatchFlag { MatchExactly, MatchFixedString, MatchContains, MatchStartsWith, ..., MatchRecursive } |
flags | MatchFlags |
enum | Modifier { SHIFT, META, CTRL, ALT, UNICODE_ACCEL } |
enum | MouseButton { NoButton, AllButtons, LeftButton, RightButton, ..., ExtraButton24 } |
flags | MouseButtons |
enum | MouseEventFlag { MouseEventCreatedDoubleClick } |
flags | MouseEventFlags |
enum | MouseEventSource { MouseEventNotSynthesized, MouseEventSynthesizedBySystem, MouseEventSynthesizedByQt, MouseEventSynthesizedByApplication } |
enum | NativeGestureType { BeginNativeGesture, EndNativeGesture, PanNativeGesture, ZoomNativeGesture, ..., SwipeNativeGesture } |
enum | NavigationMode { NavigationModeNone, NavigationModeKeypadTabOrder, NavigationModeKeypadDirectional, NavigationModeCursorAuto, NavigationModeCursorForceVisible } |
enum | Orientation { Horizontal, Vertical } |
flags | Orientations |
enum | PenCapStyle { FlatCap, SquareCap, RoundCap } |
enum | PenJoinStyle { MiterJoin, BevelJoin, RoundJoin, SvgMiterJoin } |
enum | PenStyle { NoPen, SolidLine, DashLine, DotLine, ..., CustomDashLine } |
enum | ScreenOrientation { PrimaryOrientation, LandscapeOrientation, PortraitOrientation, InvertedLandscapeOrientation, InvertedPortraitOrientation } |
flags | ScreenOrientations |
enum | ScrollBarPolicy { ScrollBarAsNeeded, ScrollBarAlwaysOff, ScrollBarAlwaysOn } |
enum | ScrollPhase { NoScrollPhase, ScrollBegin, ScrollUpdate, ScrollEnd } |
enum | ShortcutContext { WidgetShortcut, WidgetWithChildrenShortcut, WindowShortcut, ApplicationShortcut } |
enum | SizeHint { MinimumSize, PreferredSize, MaximumSize, MinimumDescent } |
enum | SizeMode { AbsoluteSize, RelativeSize } |
enum | SortOrder { AscendingOrder, DescendingOrder } |
enum | TabFocusBehavior { NoTabFocus, TabFocusTextControls, TabFocusListControls, TabFocusAllControls } |
enum | TextElideMode { ElideLeft, ElideRight, ElideMiddle, ElideNone } |
enum | TextFlag { TextSingleLine, TextDontClip, TextExpandTabs, TextShowMnemonic, ..., TextJustificationForced } |
enum | TextFormat { PlainText, RichText, AutoText } |
enum | TextInteractionFlag { NoTextInteraction, TextSelectableByMouse, TextSelectableByKeyboard, LinksAccessibleByMouse, ..., TextBrowserInteraction } |
flags | TextInteractionFlags |
enum | TileRule { StretchTile, RepeatTile, RoundTile } |
enum | TimeSpec { LocalTime, UTC, OffsetFromUTC, TimeZone } |
enum | TimerType { PreciseTimer, CoarseTimer, VeryCoarseTimer } |
enum | ToolBarArea { LeftToolBarArea, RightToolBarArea, TopToolBarArea, BottomToolBarArea, AllToolBarAreas, NoToolBarArea } |
flags | ToolBarAreas |
enum | ToolButtonStyle { ToolButtonIconOnly, ToolButtonTextOnly, ToolButtonTextBesideIcon, ToolButtonTextUnderIcon, ToolButtonFollowStyle } |
enum | TouchPointState { TouchPointPressed, TouchPointMoved, TouchPointStationary, TouchPointReleased } |
flags | TouchPointStates |
enum | TransformationMode { FastTransformation, SmoothTransformation } |
enum | UIEffect { UI_AnimateMenu, UI_FadeMenu, UI_AnimateCombo, UI_AnimateTooltip, UI_FadeTooltip, UI_AnimateToolBox } |
enum | WhiteSpaceMode { WhiteSpaceNormal, WhiteSpacePre, WhiteSpaceNoWrap } |
enum | WidgetAttribute { WA_AcceptDrops, WA_AlwaysShowToolTips, WA_ContentsPropagated, WA_CustomWhatsThis, ..., WA_AlwaysStackOnTop } |
flags | WindowFlags |
enum | WindowFrameSection { NoSection, LeftSection, TopLeftSection, TopSection, ..., TitleBarArea } |
enum | WindowModality { NonModal, WindowModal, ApplicationModal } |
enum | WindowState { WindowNoState, WindowMinimized, WindowMaximized, WindowFullScreen, WindowActive } |
flags | WindowStates |
enum | WindowType { Widget, Window, Dialog, Sheet, ..., WindowType_Mask } |
Functions
convertFromPlainText(const QString &plain, WhiteSpaceMode mode) | |
mightBeRichText(const QString &text) |
详细描述
Qt命名空间包含所有Qt库中通用标识符.
类型
enum Qt::AlignmentFlag
flags Qt::Alignment
描述对齐方式. 包含可以组合的水平和垂直标识.
在许多情况下, TextElideMode 也可以微调对齐文本的外观.
The horizontal flags are:
Constant | Value | Description |
---|---|---|
Qt::AlignLeft | 0x0001 | 左边对齐. |
Qt::AlignRight | 0x0002 | 右边对齐. |
Qt::AlignHCenter | 0x0004 | 水平居中对齐. |
Qt::AlignJustify | 0x0008 | 对齐文本. |
The vertical flags are:
Constant | Value | Description |
---|---|---|
Qt::AlignTop | 0x0020 | 顶部对齐. |
Qt::AlignBottom | 0x0040 | 底部对齐. |
Qt::AlignVCenter | 0x0080 | 垂直居中对齐. |
Qt::AlignBaseline | 0x0100 | 基线对齐. |
水平标识一次只能使用一个. 如下有个二维标识:
Constant | Value | Description |
---|---|---|
Qt::AlignCenter | AlignVCenter | AlignHCenter | 水平垂直居中. |
水平和垂直标识一次只能使用一个. Qt::AlignCenter 包含水平和垂直标识.
如下三种标识, 在从右到左模式的应用程序中, 非常有用:
Constant | Value | Description |
---|---|---|
Qt::AlignAbsolute | 0x0010 | 如果widget的布局方向是Qt::RightToLeft(替换默认的Qt::LeftToRight), Qt::AlignLeft表示右边, Qt::AlignRight表示左边. 这通常是想要的结果. 但是, 如果你总是希望Qt::AlignLeft表示"左边", Qt::AlignRight表示"右边". 那么, 你可以组合Qt::AlignAbsolute标识. |
Qt::AlignLeading | AlignLeft | 等价于 Qt::AlignLeft. |
Qt::AlignTrailing | AlignRight | 等价于 Qt::AlignRight. |
Masks:
Constant | Value |
---|---|
Qt::AlignHorizontal_Mask | AlignLeft | AlignRight | AlignHCenter | AlignJustify | AlignAbsolute |
Qt::AlignVertical_Mask | AlignTop | AlignBottom | AlignVCenter | AlignBaseline |
冲突的标识组合的行为未定义.
The Alignment type is a typedef for QFlags<AlignmentFlag>. It stores an OR combination of AlignmentFlag values.
enum Qt::AnchorPoint
指定布局的停靠关系. 用于 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. |
enum Qt::ApplicationAttribute
描述应用程序级别的行为特性. 调用 QCoreApplication::setAttribute()开启或禁用特定行为, 调用 QCoreApplication::testAttribute()检测特定行为是否开启.
Constant | Value | Description |
---|---|---|
Qt::AA_DontShowIconsInMenus | 2 | 除非设置 QAction::iconVisibleInMenu, 任何菜单不会显示图标. 如果菜单已经打开, 或者已在 macOS 系统的菜单栏创建, 不会改变这个属性. QAction::iconVisibleInMenu 总是生效. |
Qt::AA_DontShowShortcutsInContextMenus | 28 | 除非设置QAction::shortcutVisibleInContextMenu, 任何菜单不会显示快捷键. |
Qt::AA_NativeWindows | 3 | widget有系统原生窗口. |
Qt::AA_DontCreateNativeWidgetSiblings | 4 | 除非设置 Qt::WA_NativeWindow 属性, 具有原生窗口的widget的同级widget不具备原生窗口. |
Qt::AA_PluginApplication | 5 | 表明Qt用于编写插件. 根据操作系统的不同, 插件不会进行无意义的初始化. 例如, 在mac系统上, 插件不会加载主菜单的笔尖, 不占用本地菜单栏. 若设置标识为true, Qt会自动设置AA_DontUseNativeMenuBr为true. 它也会禁用系统事件过滤器. 这个属性必须在构造QGuiApplication前设置. |
Qt::AA_MacPluginApplication | AA_PluginApplication | This attribute has been deprecated. Use AA_PluginApplication instead. |
Qt::AA_DontUseNativeMenuBar | 6 | 这个属性设为true时, 创建的菜单项不会用作系统菜单栏(如, macOS系统的主屏幕顶部菜单栏). |
Qt::AA_MacDontSwapCtrlAndMeta | 7 | 默认情况下, macOS系统会交换Control和Meta键(即, 按下Control时, Qt发送Meta; 按下Meta时, Qt发送Control). 这个属性是true时, Qt不会执行交换. QKeySequence::StandardKey也将交换(即, 无论设置何值, QKeySequence::Copy是Command+C, QKeySequence::toString()输出会有所不同). |
Qt::AA_Use96Dpi | 8 | 设置屏幕分辨率是96 DPI, 不使用系统提供的分辨率. 这会导致字体在设备上的每个像素点是一致的, 而不是将1个点定义为1/72英寸. |
Qt::AA_X11InitThreads | 10 | This value is obsolete and has no effect. |
Qt::AA_SynthesizeTouchForUnhandledMouseEvents | 11 | 鼠标事件转为触控事件. |
Qt::AA_SynthesizeMouseForUnhandledTouchEvents | 12 | 触控事件转为鼠标左键事件, 默认开启. |
Qt::AA_UseHighDpiPixmaps | 13 | QIcon::pixmap()会生成高dpi的像素图, 这个像素图可以大于请求大小. 这种情况下, 像素映射会将devicePixelRatio()()设置为大于1的值. 在计算几何图形的布局时, 应用程序应除以devicePixelRatio(), 获取与设备无关的几何图形. |
Qt::AA_ForceRasterWidgets | 14 | 顶级widget使用纯光栅化界面, 且不支持非原生的, 基于GL的子widget. |
Qt::AA_UseDesktopOpenGL | 15 | 在使用OpenGL实现动态加载的平台上, 强制使用桌面OpenGL(例如, opengl32.dll或libGL.so). 在构造QGuiApplication之前, 必须设置此属性. |
Qt::AA_UseOpenGLES | 16 | 在使用OpenGL实现动态加载的平台上, 强制使用桌面OpenGL ES 2.0或更高版本. 在构造QGuiApplication之前, 必须设置此属性. |
Qt::AA_UseSoftwareOpenGL | 17 | 在使用OpenGL实现动态加载的平台上, 强制使用基于软件的OpenGL实现. 这通常是Mesa llvmpipe的补丁版本, 提供OpenGL 2.1. 如果没有可用的OpenGL实现, 则这个值可能没有任何效果. 这个库的默认名称为opengl32sw.dll , 设置环境变量QT_OPENGL_dll重定义默认名称.详见系统平台信息, 例如Qt for Windows. 在构造Q(Gui)Application之前, 必须设置此属性. |
Qt::AA_ShareOpenGLContexts | 18 | 启用OpenGL上下文的资源共享, 如QOpenGLWidget和QQuickWidget. 这允许在属于不同顶级窗口的QOpenGLWidget实例之间共享OpenGL资源, 如纹理. 在构造Q(Gui)Application之前, 必须设置此属性. |
Qt::AA_SetPalette | 19 | 在QApplication/QGuiApplication上显式设置Palette |
Qt::AA_EnableHighDpiScaling | 20 | 在支持的平台上, 启用Qt的高DPI缩放(参见High DPI Displays). 支持的平台有X11, Windows, Android. 启用后, Qt会根据操作系统提供的显示比例因子缩放主坐标系(设备无关). 启用这个属性, 等价于设置环境变量QT_AUTO_SCREN_SCALE_FACTOR为1. 在构造QGuiApplication之前, 必须设置此属性. |
Qt::AA_DisableHighDpiScaling | 21 | 禁用Qt的高DPI缩放, 使用窗口系统左边. 注意, 窗口系统可能会自己进行缩放, 因此这并不能保证QPaintDevice::devicePixelRatio()等于1. 此外, 由QT_scale_FACTOR设置的比例因子也不会受到影响. 等价于设置环境变量QT_AUTO_SCREN_SCALE_FACTOR为0. 在构造Q(Gui)Application之前, 必须设置此属性. |
Qt::AA_UseStyleSheetPropagationInWidgetStyles | 22 | 默认情况下, Qt样式表禁用标准的QWidget palette和font传播. 启用此标志时, 字体和palette的更改会传播, 好像用户手动调用了相应的QWidget方法. 详见The Style Sheet Syntax - Inheritance |
Qt::AA_DontUseNativeDialogs | 23 | 启动这个属性, 所有的对话框创建时, 不使用系统原生的对话框 |
Qt::AA_SynthesizeMouseForUnhandledTabletEvents | 24 | tablet事件转为鼠标事件. 默认开启. |
Qt::AA_CompressHighFrequencyEvents | 25 | 压缩高频率事件. 在X11窗口系统上, 默认值为true, 这意味着每当QEvent::MouseMove, QEvent::TouchUpdate以及窗口大小和位置的更改发生得比应用程序处理它们的频率更频繁时, 它们都会被组合在一起, 这样它们就不会累积并在以后淹没应用程序. 在Windows 8及以上版本中, 默认值也是true, 但它仅适用于触摸事件. 鼠标和窗口事件不受此标志的影响. 在其他平台上, 默认值为false.(将来,压缩功能可能会跨平台实现.) 你可以测试属性, 查看是否启用了压缩. 如果应用程序需要在不压缩的情况下处理所有事件, 则可以取消设置此属性. 请注意, 来自平板电脑设备的输入事件将不会被压缩. 如果你希望这些内容也被压缩, 参见AA_CompressTabletEvents |
Qt::AA_DontCheckOpenGLContextThreadAffinity | 26 | 使用QOpenGLContext时, 不要检查QObject thread affinity, 是否与makeCurrent()在同一线程 |
Qt::AA_DisableShaderDiskCache | 27 | 禁用在磁盘上缓存着色器程序二进制文件. 默认情况下, Qt Quick, QPainter的OpenGL后端, 以及任何使用QOpenGLShaderProgram及其addCacheableShaderFromSource重载的应用程序, 都将在支持glProgramBinary()的系统上, 在共享或按进程缓存存储位置使用基于磁盘的程序二进制缓存. 如果出现问题, 请设置该属性以禁用着色器的所有基于磁盘的缓存. |
The following values are obsolete:
Constant | Value | Description |
---|---|---|
Qt::AA_ImmediateWidgetCreation | 0 | This attribute is no longer fully supported in Qt 5. It ensures 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_MSWindowsUseDirect3DByDefault | 1 | This value is obsolete and has no effect. |
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. |
This enum was introduced or modified in Qt 5.1.
The ApplicationStates type is a typedef for QFlags<ApplicationState>. It stores an OR combination of ApplicationState values.
enum Qt::ArrowType
Constant | Value |
---|---|
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.
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. |
参见 QSize::scale() and QImage::scaled().
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. |
参见 QTransform::rotate() and QTransform::rotateRadians().
enum Qt::BGMode
Background mode:
Constant | Value |
---|---|
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.
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()). |
参见 QBrush.
enum Qt::CaseSensitivity
Constant | Value |
---|---|
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. |
参见 QCheckBox, Qt::ItemFlags, and Qt::ItemDataRole.
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. |
This enum was introduced or modified in Qt 5.9.
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::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). This flag was introduced in Qt 4.6. |
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.
When using signals and slots with multiple threads, see Signals and Slots Across Threads.
参见 Thread Support in Qt, QObject::connect(), qRegisterMetaType(), and Q_DECLARE_METATYPE().
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 upper-left corner of the object's paint device. |
Qt::LogicalCoordinates | 1 | Coordinates are relative to the upper-left corner of the object. |
This enum was introduced or modified in Qt 4.6.
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 | ![]() |
Qt::UpArrowCursor | 1 | ![]() |
Qt::CrossCursor | 2 | ![]() |
Qt::WaitCursor | 3 | ![]() |
Qt::IBeamCursor | 4 | ![]() |
Qt::SizeVerCursor | 5 | ![]() |
Qt::SizeHorCursor | 6 | ![]() |
Qt::SizeBDiagCursor | 7 | ![]() |
Qt::SizeFDiagCursor | 8 | ![]() |
Qt::SizeAllCursor | 9 | ![]() |
Qt::BlankCursor | 10 | A blank/invisible cursor, typically used when the cursor shape needs to be hidden. |
Qt::SplitVCursor | 11 | ![]() |
Qt::SplitHCursor | 12 | ![]() |
Qt::PointingHandCursor | 13 | ![]() |
Qt::ForbiddenCursor | 14 | ![]() |
Qt::OpenHandCursor | 17 | ![]() |
Qt::ClosedHandCursor | 18 | ![]() |
Qt::WhatsThisCursor | 15 | ![]() |
Qt::BusyCursor | 16 | ![]() |
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, localized names. This is basically equivalent to using the date format string, "ddd MMM d yyyy". See QDate::toString() for more information. |
Qt::ISODate | 1 | ISO 8601 extended format: either YYYY-MM-DD for dates or YYYY-MM-DDTHH:mm:ss , YYYY-MM-DDTHH:mm:ssTZD (e.g., 1997-07-16T19:20:30+01:00) for combined dates and times. |
Qt::ISODateWithMs | ? | ISO 8601 extended format, including milliseconds if applicable. |
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::SystemLocaleDate | 2 | This 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::LocalDate | SystemLocaleDate | This enum value is deprecated. Use Qt::SystemLocaleShortDate instead (or Qt::SystemLocaleLongDate if you want long dates). |
Qt::RFC2822Date | ? | RFC 2822, RFC 850 and RFC 1036 format: either [ddd,] dd MMM yyyy hh:mm[:ss] +/-TZ or ddd MMM dd yyyy hh:mm[:ss] +/-TZ for combined dates and times. |
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.
enum Qt::DayOfWeek
Constant | Value |
---|---|
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
Constant | Value |
---|---|
Qt::LeftDockWidgetArea | 0x1 |
Qt::RightDockWidgetArea | 0x2 |
Qt::TopDockWidgetArea | 0x4 |
Qt::BottomDockWidgetArea | 0x8 |
Qt::AllDockWidgetAreas | DockWidgetArea_Mask |
Qt::NoDockWidgetArea | 0 |
The DockWidgetAreas type is a typedef for QFlags<DockWidgetArea>. It stores an OR combination of DockWidgetArea values.
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. |
This enum was introduced or modified in Qt 5.1.
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.
Note: 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. |
This enum was introduced or modified in Qt 5.6.
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:
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 };
参见 QCoreApplication::postEvent().
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. |
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 | 0x04 | Since Qt 4.7, this flag allows you to fine-tune gesture event propagation. By setting the flag when grabbing a gesture all ignored partial gestures will propagate to their parent items. |
This enum was introduced or modified in Qt 4.6.
The GestureFlags type is a typedef for QFlags<GestureFlag>. It stores an OR combination of GestureFlag values.
参见 QWidget::grabGesture() and QGraphicsObject::grabGesture().
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. |
This enum was introduced or modified in Qt 4.6.
参见 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.
This enum was introduced or modified in Qt 4.6.
参见 QGesture, QWidget::grabGesture(), and QGraphicsObject::grabGesture().
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 | 6 | Light gray (#c0c0c0) |
Qt::transparent | 19 | a transparent black value (i.e., QColor(0, 0, 0, 0)) |
Qt::color0 | 0 | 0 pixel value (for bitmaps) |
Qt::color1 | 1 | 1 pixel value (for bitmaps) |
参见 QColor.
typedef Qt::HANDLE
A handle type for system objects, defined as void *
on all platforms.
enum Qt::HitTestAccuracy
This enum contains the types of accuracy that can be used by the QTextDocument class when testing for mouse clicks on text documents.
Constant | Value | Description |
---|---|---|
Qt::ExactHit | 0 | The point at which input occurred must coincide exactly with input-sensitive parts of the document. |
Qt::FuzzyHit | 1 | The point at which input occurred can lie close to input-sensitive parts of the document. |
enum Qt::ImageConversionFlag
flags Qt::ImageConversionFlags
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):
Constant | Value | Description |
---|---|---|
Qt::AutoColor | 0x00000000 | (default) - If the image has depth 1 and contains only black and white pixels, the pixmap becomes monochrome. |
Qt::ColorOnly | 0x00000003 | The pixmap is dithered/converted to the native display depth. |
Qt::MonoOnly | 0x00000002 | The pixmap becomes monochrome. If necessary, it is dithered using the chosen dithering algorithm. |
Dithering mode preference:
Constant | Value | Description |
---|---|---|
Qt::DiffuseDither | 0x00000000 | (default) - A high-quality dither using error diffusion. |
Qt::OrderedDither | 0x00000010 | A faster, ordered dither. |
Qt::ThresholdDither | 0x00000020 | No dithering; closest color is used. |
Dithering mode preference for 1-bit alpha masks:
Constant | Value | Description |
---|---|---|
Qt::ThresholdAlphaDither | 0x00000000 | (default) - No dithering. |
Qt::OrderedAlphaDither | 0x00000004 | A faster, ordered dither. |
Qt::DiffuseAlphaDither | 0x00000008 | A high-quality dither using error diffusion. |
Color matching versus dithering preference:
Constant | Value | Description |
---|---|---|
Qt::PreferDither | 0x00000040 | Always dither images when converting to smaller color-spaces. |
Qt::AvoidDither | 0x00000080 | Only dither to indexed formats if the source image uses more different colors than the size of the color table of the destination format. |
Qt::AutoDither | 0x00000000 | (default) - Only dither when down-converting to 1 or 8-bit indexed formats. |
Qt::NoOpaqueDetection | 0x00000100 | Do not check whether the image contains non-opaque pixels. Use this if you know that the image is semi-transparent and you want to avoid the overhead of checking the pixels in the image until a non-opaque pixel is found, or if you want the pixmap to retain an alpha channel for some other reason. If the image has no alpha channel this flag has no effect. |
Qt::NoFormatConversion | 0x00000200 | Don't do any format conversions on the image. Can be useful when converting a QImage to a QPixmap for a one-time rendering operation for example. Note that a QPixmap not in the preferred format will be much slower as a paint device. |
The ImageConversionFlags type is a typedef for QFlags<ImageConversionFlag>. It stores an OR combination of ImageConversionFlag values.
enum Qt::InputMethodHint
flags Qt::InputMethodHints
Constant | Value | Description |
---|---|---|
Qt::ImhNone | 0x0 | No hints. |
Flags that alter the behavior:
Constant | Value | Description |
---|---|---|
Qt::ImhHiddenText | 0x1 | The input method should not show the characters while typing. This is automatically set when setting QLineEdit::echoMode to Password . Note that setting ImhHiddenText does not change the echo mode. |
Qt::ImhSensitiveData | 0x2 | Typed text should not be stored by the active input method in any persistent storage like predictive user dictionary. |
Qt::ImhNoAutoUppercase | 0x4 | The input method should not try to automatically switch to upper case when a sentence ends. |
Qt::ImhPreferNumbers | 0x8 | Numbers are preferred (but not required). |
Qt::ImhPreferUppercase | 0x10 | Upper case letters are preferred (but not required). |
Qt::ImhPreferLowercase | 0x20 | Lower case letters are preferred (but not required). |
Qt::ImhNoPredictiveText | 0x40 | Do not use predictive text (i.e. dictionary lookup) while typing. |
Qt::ImhDate | 0x80 | The text editor functions as a date field. |
Qt::ImhTime | 0x100 | The text editor functions as a time field. |
Qt::ImhPreferLatin | 0x200 | Latin characters are preferred (but not required). |
Qt::ImhMultiLine | 0x400 | Multiple lines can be entered into the text field. |
Flags that restrict input (exclusive flags):
Constant | Value | Description |
---|---|---|
Qt::ImhDigitsOnly | 0x10000 | Only digits are allowed. |
Qt::ImhFormattedNumbersOnly | 0x20000 | Only number input is allowed. This includes decimal point and minus sign. |
Qt::ImhUppercaseOnly | 0x40000 | Only upper case letter input is allowed. |
Qt::ImhLowercaseOnly | 0x80000 | Only lower case letter input is allowed. |
Qt::ImhDialableCharactersOnly | 0x100000 | Only characters suitable for phone dialing are allowed. |
Qt::ImhEmailCharactersOnly | 0x200000 | Only characters suitable for email addresses are allowed. |
Qt::ImhUrlCharactersOnly | 0x400000 | Only characters suitable for URLs are allowed. |
Qt::ImhLatinOnly | 0x800000 | Only latin based input is allowed. |
Masks:
Constant | Value | Description |
---|---|---|
Qt::ImhExclusiveInputMask | 0xffff0000 | This mask yields nonzero if any of the exclusive flags are used. |
Note: If several exclusive flags are OR-ed together, the resulting character set will consist of the union of the specified sets. For instance specifying ImhNumbersOnly
and ImhUppercaseOnly
would yield a set consisting of numbers and uppercase letters.
The InputMethodHints type is a typedef for QFlags<InputMethodHint>. It stores an OR combination of InputMethodHint values.
参见 QGraphicsItem::inputMethodHints().
enum Qt::InputMethodQuery
flags Qt::InputMethodQueries
Constant | Value | Description |
---|---|---|
Qt::ImEnabled | 0x1 | The widget accepts input method input. |
Qt::ImMicroFocus | 0x2 | This query is obsolete. Use ImCursorRectangle instead. |
Qt::ImCursorRectangle | 0x2 | The rectangle covering the area of the input cursor in widget coordinates. |
Qt::ImFont | 0x4 | The currently used font for text input. |
Qt::ImCursorPosition | 0x8 | The logical position of the cursor within the text surrounding the input area (see ImSurroundingText ). |
Qt::ImSurroundingText | 0x10 | The plain text around the input area, for example the current paragraph. |
Qt::ImCurrentSelection | 0x20 | The currently selected text. |
Qt::ImMaximumTextLength | 0x40 | The maximum number of characters that the widget can hold. If there is no limit, QVariant::QVariant() is returned. |
Qt::ImAnchorPosition | 0x80 | The position of the selection anchor. This may be less or greater than ImCursorPosition , depending on which side of selection the cursor is. If there is no selection, it returns the same as ImCursorPosition . |
Qt::ImHints | 0x100 | The hints for input method on expected input. (See Qt::InputMethodHints) |
Qt::ImPreferredLanguage | 0x200 | The preferred input language. |
Qt::ImPlatformData | 0x80000000 | Platform specific data for input method. |
Qt::ImAbsolutePosition | 0x400 | The logical position of the cursor within the entire document. |
Qt::ImTextBeforeCursor | 0x800 | The plain text before the cursor. The widget can decide how much text to return, but must not return an empty string unless the cursor is at the start of the document. |
Qt::ImTextAfterCursor | 0x1000 | The plain text after the cursor. The widget can decide how much text to return, but must not return an empty string unless the cursor is at the end of the document. |
Qt::ImEnterKeyType | 0x2000 | The Enter key type. |
Qt::ImAnchorRectangle | 0x4000 | The bounding rectangle of the selection anchor. This value has been added in Qt 5.7. |
Qt::ImInputItemClipRectangle | 0x8000 | The actual exposed input item rectangle. Parts of the input item might be clipped. This value will take clipping into consideration and return the actual painted item rectangle. The rectangle is in widget coordinates. |
Masks:
Constant | Value | Description |
---|---|---|
Qt::ImQueryInput | ImCursorRectangle | ImCursorPosition | ImSurroundingText | ImCurrentSelection | ImAnchorRectangle | ImAnchorPosition | Commonly changed properties on input. |
Qt::ImQueryAll | 0xffffffff | Query for all input method properties. |
The InputMethodQueries type is a typedef for QFlags<InputMethodQuery>. It stores an OR combination of InputMethodQuery values.
enum 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. Custom models should return data in these types.
The general purpose roles (and the associated types) are:
Constant | Value | Description |
---|---|---|
Qt::DisplayRole | 0 | The key data to be rendered in the form of text. (QString) |
Qt::DecorationRole | 1 | The data to be rendered as a decoration in the form of an icon. (QColor, QIcon or QPixmap) |
Qt::EditRole | 2 | The data in a form suitable for editing in an editor. (QString) |
Qt::ToolTipRole | 3 | The data displayed in the item's tooltip. (QString) |
Qt::StatusTipRole | 4 | The data displayed in the status bar. (QString) |
Qt::WhatsThisRole | 5 | The data displayed for the item in "What's This?" mode. (QString) |
Qt::SizeHintRole | 13 | The size hint for the item that will be supplied to views. (QSize) |
Roles describing appearance and meta data (with associated types):
Constant | Value | Description |
---|---|---|
Qt::FontRole | 6 | The font used for items rendered with the default delegate. (QFont) |
Qt::TextAlignmentRole | 7 | The alignment of the text for items rendered with the default delegate. (Qt::Alignment) |
Qt::BackgroundRole | 8 | The background brush used for items rendered with the default delegate. (QBrush) |
Qt::BackgroundColorRole | 8 | This role is obsolete. Use BackgroundRole instead. |
Qt::ForegroundRole | 9 | The foreground brush (text color, typically) used for items rendered with the default delegate. (QBrush) |
Qt::TextColorRole | 9 | This role is obsolete. Use ForegroundRole instead. |
Qt::CheckStateRole | 10 | This role is used to obtain the checked state of an item. (Qt::CheckState) |
Qt::InitialSortOrderRole | 14 | This role is used to obtain the initial sort order of a header view section. (Qt::SortOrder). This role was introduced in Qt 4.8. |
Accessibility roles (with associated types):
Constant | Value | Description |
---|---|---|
Qt::AccessibleTextRole | 11 | The text to be used by accessibility extensions and plugins, such as screen readers. (QString) |
Qt::AccessibleDescriptionRole | 12 | A description of the item for accessibility purposes. (QString) |
User roles:
Constant | Value | Description |
---|---|---|
Qt::UserRole | 0x0100 | The first role that can be used for application-specific purposes. |
For user roles, it is up to the developer to decide which types to use and ensure that components use the correct types when accessing and setting data.
enum Qt::ItemFlag
flags Qt::ItemFlags
This enum describes the properties of an item:
Constant | Value | Description |
---|---|---|
Qt::NoItemFlags | 0 | It does not have any properties set. |
Qt::ItemIsSelectable | 1 | It can be selected. |
Qt::ItemIsEditable | 2 | It can be edited. |
Qt::ItemIsDragEnabled | 4 | It can be dragged. |
Qt::ItemIsDropEnabled | 8 | It can be used as a drop target. |
Qt::ItemIsUserCheckable | 16 | It can be checked or unchecked by the user. |
Qt::ItemIsEnabled | 32 | The user can interact with the item. |
Qt::ItemIsAutoTristate | 64 | The item's state depends on the state of its children. This enables automatic management of the state of parent items in QTreeWidget (checked if all children are checked, unchecked if all children are unchecked, or partially checked if only some children are checked). |
Qt::ItemIsTristate | ItemIsAutoTristate | This enum value is deprecated. Use Qt::ItemIsAutoTristate instead. |
Qt::ItemNeverHasChildren | 128 | The item never has child items. This is used for optimization purposes only. |
Qt::ItemIsUserTristate | 256 | The user can cycle through three separate states. This value has been added in Qt 5.5. |
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.
Note that it is undefined behavior to reimplement QAbstractItemModel::hasChildren to return true for an index if that index has the Qt::ItemNeverHasChildren flag set.
The ItemFlags type is a typedef for QFlags<ItemFlag>. It stores an OR combination of ItemFlag values.
enum Qt::ItemSelectionMode
This enum is used in QGraphicsItem, QGraphicsScene and QGraphicsView to specify how items are selected, or how to determine if shapes and items collide.
Constant | Value | Description |
---|---|---|
Qt::ContainsItemShape | 0x0 | The 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::IntersectsItemShape | 0x1 | The 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::ContainsItemBoundingRect | 0x2 | The 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::IntersectsItemBoundingRect | 0x3 | The 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. |
参见 QGraphicsScene::items(), QGraphicsScene::collidingItems(), QGraphicsView::items(), QGraphicsItem::collidesWithItem(), and QGraphicsItem::collidesWithPath().
enum Qt::ItemSelectionOperation
This enum is used in QGraphicsScene to specify what to do with currently selected items when setting a selection area.
Constant | Value | Description |
---|---|---|
Qt::ReplaceSelection | 0 | The currently selected items are replaced by items in the selection area. |
Qt::AddToSelection | 1 | The items in the selection area are added to the currently selected items. |
参见 QGraphicsScene::setSelectionArea().
enum Qt::Key
The key names used by Qt.
Constant | Value | Description |
---|---|---|
Qt::Key_Escape | 0x01000000 | |
Qt::Key_Tab | 0x01000001 | |
Qt::Key_Backtab | 0x01000002 | |
Qt::Key_Backspace | 0x01000003 | |
Qt::Key_Return | 0x01000004 | |
Qt::Key_Enter | 0x01000005 | Typically located on the keypad. |
Qt::Key_Insert | 0x01000006 | |
Qt::Key_Delete | 0x01000007 | |
Qt::Key_Pause | 0x01000008 | The Pause/Break key (Note: Not related to pausing media) |
Qt::Key_Print | 0x01000009 | |
Qt::Key_SysReq | 0x0100000a | |
Qt::Key_Clear | 0x0100000b | |
Qt::Key_Home | 0x01000010 | |
Qt::Key_End | 0x01000011 | |
Qt::Key_Left | 0x01000012 | |
Qt::Key_Up | 0x01000013 | |
Qt::Key_Right | 0x01000014 | |
Qt::Key_Down | 0x01000015 | |
Qt::Key_PageUp | 0x01000016 | |
Qt::Key_PageDown | 0x01000017 | |
Qt::Key_Shift | 0x01000020 | |
Qt::Key_Control | 0x01000021 | On macOS, this corresponds to the Command keys. |
Qt::Key_Meta | 0x01000022 | On macOS, this corresponds to the Control keys. On Windows keyboards, this key is mapped to the Windows key. |
Qt::Key_Alt | 0x01000023 | |
Qt::Key_AltGr | 0x01001103 | On Windows, when the KeyDown event for this key is sent, the Ctrl+Alt modifiers are also set. |
Qt::Key_CapsLock | 0x01000024 | |
Qt::Key_NumLock | 0x01000025 | |
Qt::Key_ScrollLock | 0x01000026 | |
Qt::Key_F1 | 0x01000030 | |
Qt::Key_F2 | 0x01000031 | |
Qt::Key_F3 | 0x01000032 | |
Qt::Key_F4 | 0x01000033 | |
Qt::Key_F5 | 0x01000034 | |
Qt::Key_F6 | 0x01000035 | |
Qt::Key_F7 | 0x01000036 | |
Qt::Key_F8 | 0x01000037 | |
Qt::Key_F9 | 0x01000038 | |
Qt::Key_F10 | 0x01000039 | |
Qt::Key_F11 | 0x0100003a | |
Qt::Key_F12 | 0x0100003b | |
Qt::Key_F13 | 0x0100003c | |
Qt::Key_F14 | 0x0100003d | |
Qt::Key_F15 | 0x0100003e | |
Qt::Key_F16 | 0x0100003f | |
Qt::Key_F17 | 0x01000040 | |
Qt::Key_F18 | 0x01000041 | |
Qt::Key_F19 | 0x01000042 | |
Qt::Key_F20 | 0x01000043 | |
Qt::Key_F21 | 0x01000044 | |
Qt::Key_F22 | 0x01000045 | |
Qt::Key_F23 | 0x01000046 | |
Qt::Key_F24 | 0x01000047 | |
Qt::Key_F25 | 0x01000048 | |
Qt::Key_F26 | 0x01000049 | |
Qt::Key_F27 | 0x0100004a | |
Qt::Key_F28 | 0x0100004b | |
Qt::Key_F29 | 0x0100004c | |
Qt::Key_F30 | 0x0100004d | |
Qt::Key_F31 | 0x0100004e | |
Qt::Key_F32 | 0x0100004f | |
Qt::Key_F33 | 0x01000050 | |
Qt::Key_F34 | 0x01000051 | |
Qt::Key_F35 | 0x01000052 | |
Qt::Key_Super_L | 0x01000053 | |
Qt::Key_Super_R | 0x01000054 | |
Qt::Key_Menu | 0x01000055 | |
Qt::Key_Hyper_L | 0x01000056 | |
Qt::Key_Hyper_R | 0x01000057 | |
Qt::Key_Help | 0x01000058 | |
Qt::Key_Direction_L | 0x01000059 | |
Qt::Key_Direction_R | 0x01000060 | |
Qt::Key_Space | 0x20 | |
Qt::Key_Any | Key_Space | |
Qt::Key_Exclam | 0x21 | |
Qt::Key_QuoteDbl | 0x22 | |
Qt::Key_NumberSign | 0x23 | |
Qt::Key_Dollar | 0x24 | |
Qt::Key_Percent | 0x25 | |
Qt::Key_Ampersand | 0x26 | |
Qt::Key_Apostrophe | 0x27 | |
Qt::Key_ParenLeft | 0x28 | |
Qt::Key_ParenRight | 0x29 | |
Qt::Key_Asterisk | 0x2a | |
Qt::Key_Plus | 0x2b | |
Qt::Key_Comma | 0x2c | |
Qt::Key_Minus | 0x2d | |
Qt::Key_Period | 0x2e | |
Qt::Key_Slash | 0x2f | |
Qt::Key_0 | 0x30 | |
Qt::Key_1 | 0x31 | |
Qt::Key_2 | 0x32 | |
Qt::Key_3 | 0x33 | |
Qt::Key_4 | 0x34 | |
Qt::Key_5 | 0x35 | |
Qt::Key_6 | 0x36 | |
Qt::Key_7 | 0x37 | |
Qt::Key_8 | 0x38 | |
Qt::Key_9 | 0x39 | |
Qt::Key_Colon | 0x3a | |
Qt::Key_Semicolon | 0x3b | |
Qt::Key_Less | 0x3c | |
Qt::Key_Equal | 0x3d | |
Qt::Key_Greater | 0x3e | |
Qt::Key_Question | 0x3f | |
Qt::Key_At | 0x40 | |
Qt::Key_A | 0x41 | |
Qt::Key_B | 0x42 | |
Qt::Key_C | 0x43 | |
Qt::Key_D | 0x44 | |
Qt::Key_E | 0x45 | |
Qt::Key_F | 0x46 | |
Qt::Key_G | 0x47 | |
Qt::Key_H | 0x48 | |
Qt::Key_I | 0x49 | |
Qt::Key_J | 0x4a | |
Qt::Key_K | 0x4b | |
Qt::Key_L | 0x4c | |
Qt::Key_M | 0x4d | |
Qt::Key_N | 0x4e | |
Qt::Key_O | 0x4f | |
Qt::Key_P | 0x50 | |
Qt::Key_Q | 0x51 | |
Qt::Key_R | 0x52 | |
Qt::Key_S | 0x53 | |
Qt::Key_T | 0x54 | |
Qt::Key_U | 0x55 | |
Qt::Key_V | 0x56 | |
Qt::Key_W | 0x57 | |
Qt::Key_X | 0x58 | |
Qt::Key_Y | 0x59 | |
Qt::Key_Z | 0x5a | |
Qt::Key_BracketLeft | 0x5b | |
Qt::Key_Backslash | 0x5c | |
Qt::Key_BracketRight | 0x5d | |
Qt::Key_AsciiCircum | 0x5e | |
Qt::Key_Underscore | 0x5f | |
Qt::Key_QuoteLeft | 0x60 | |
Qt::Key_BraceLeft | 0x7b | |
Qt::Key_Bar | 0x7c | |
Qt::Key_BraceRight | 0x7d | |
Qt::Key_AsciiTilde | 0x7e | |
Qt::Key_nobreakspace | 0x0a0 | |
Qt::Key_exclamdown | 0x0a1 | |
Qt::Key_cent | 0x0a2 | |
Qt::Key_sterling | 0x0a3 | |
Qt::Key_currency | 0x0a4 | |
Qt::Key_yen | 0x0a5 | |
Qt::Key_brokenbar | 0x0a6 | |
Qt::Key_section | 0x0a7 | |
Qt::Key_diaeresis | 0x0a8 | |
Qt::Key_copyright | 0x0a9 | |
Qt::Key_ordfeminine | 0x0aa | |
Qt::Key_guillemotleft | 0x0ab | |
Qt::Key_notsign | 0x0ac | |
Qt::Key_hyphen | 0x0ad | |
Qt::Key_registered | 0x0ae | |
Qt::Key_macron | 0x0af | |
Qt::Key_degree | 0x0b0 | |
Qt::Key_plusminus | 0x0b1 | |
Qt::Key_twosuperior | 0x0b2 | |
Qt::Key_threesuperior | 0x0b3 | |
Qt::Key_acute | 0x0b4 | |
Qt::Key_mu | 0x0b5 | |
Qt::Key_paragraph | 0x0b6 | |
Qt::Key_periodcentered | 0x0b7 | |
Qt::Key_cedilla | 0x0b8 | |
Qt::Key_onesuperior | 0x0b9 | |
Qt::Key_masculine | 0x0ba | |
Qt::Key_guillemotright | 0x0bb | |
Qt::Key_onequarter | 0x0bc | |
Qt::Key_onehalf | 0x0bd | |
Qt::Key_threequarters | 0x0be | |
Qt::Key_questiondown | 0x0bf | |
Qt::Key_Agrave | 0x0c0 | |
Qt::Key_Aacute | 0x0c1 | |
Qt::Key_Acircumflex | 0x0c2 | |
Qt::Key_Atilde | 0x0c3 | |
Qt::Key_Adiaeresis | 0x0c4 | |
Qt::Key_Aring | 0x0c5 | |
Qt::Key_AE | 0x0c6 | |
Qt::Key_Ccedilla | 0x0c7 | |
Qt::Key_Egrave | 0x0c8 | |
Qt::Key_Eacute | 0x0c9 | |
Qt::Key_Ecircumflex | 0x0ca | |
Qt::Key_Ediaeresis | 0x0cb | |
Qt::Key_Igrave | 0x0cc | |
Qt::Key_Iacute | 0x0cd | |
Qt::Key_Icircumflex | 0x0ce | |
Qt::Key_Idiaeresis | 0x0cf | |
Qt::Key_ETH | 0x0d0 | |
Qt::Key_Ntilde | 0x0d1 | |
Qt::Key_Ograve | 0x0d2 | |
Qt::Key_Oacute | 0x0d3 | |
Qt::Key_Ocircumflex | 0x0d4 | |
Qt::Key_Otilde | 0x0d5 | |
Qt::Key_Odiaeresis | 0x0d6 | |
Qt::Key_multiply | 0x0d7 | |
Qt::Key_Ooblique | 0x0d8 | |
Qt::Key_Ugrave | 0x0d9 | |
Qt::Key_Uacute | 0x0da | |
Qt::Key_Ucircumflex | 0x0db | |
Qt::Key_Udiaeresis | 0x0dc | |
Qt::Key_Yacute | 0x0dd | |
Qt::Key_THORN | 0x0de | |
Qt::Key_ssharp | 0x0df | |
Qt::Key_division | 0x0f7 | |
Qt::Key_ydiaeresis | 0x0ff | |
Qt::Key_Multi_key | 0x01001120 | |
Qt::Key_Codeinput | 0x01001137 | |
Qt::Key_SingleCandidate | 0x0100113c | |
Qt::Key_MultipleCandidate | 0x0100113d | |
Qt::Key_PreviousCandidate | 0x0100113e | |
Qt::Key_Mode_switch | 0x0100117e | |
Qt::Key_Kanji | 0x01001121 | |
Qt::Key_Muhenkan | 0x01001122 | |
Qt::Key_Henkan | 0x01001123 | |
Qt::Key_Romaji | 0x01001124 | |
Qt::Key_Hiragana | 0x01001125 | |
Qt::Key_Katakana | 0x01001126 | |
Qt::Key_Hiragana_Katakana | 0x01001127 | |
Qt::Key_Zenkaku | 0x01001128 | |
Qt::Key_Hankaku | 0x01001129 | |
Qt::Key_Zenkaku_Hankaku | 0x0100112a | |
Qt::Key_Touroku | 0x0100112b | |
Qt::Key_Massyo | 0x0100112c | |
Qt::Key_Kana_Lock | 0x0100112d | |
Qt::Key_Kana_Shift | 0x0100112e | |
Qt::Key_Eisu_Shift | 0x0100112f | |
Qt::Key_Eisu_toggle | 0x01001130 | |
Qt::Key_Hangul | 0x01001131 | |
Qt::Key_Hangul_Start | 0x01001132 | |
Qt::Key_Hangul_End | 0x01001133 | |
Qt::Key_Hangul_Hanja | 0x01001134 | |
Qt::Key_Hangul_Jamo | 0x01001135 | |
Qt::Key_Hangul_Romaja | 0x01001136 | |
Qt::Key_Hangul_Jeonja | 0x01001138 | |
Qt::Key_Hangul_Banja | 0x01001139 | |
Qt::Key_Hangul_PreHanja | 0x0100113a | |
Qt::Key_Hangul_PostHanja | 0x0100113b | |
Qt::Key_Hangul_Special | 0x0100113f | |
Qt::Key_Dead_Grave | 0x01001250 | |
Qt::Key_Dead_Acute | 0x01001251 | |
Qt::Key_Dead_Circumflex | 0x01001252 | |
Qt::Key_Dead_Tilde | 0x01001253 | |
Qt::Key_Dead_Macron | 0x01001254 | |
Qt::Key_Dead_Breve | 0x01001255 | |
Qt::Key_Dead_Abovedot | 0x01001256 | |
Qt::Key_Dead_Diaeresis | 0x01001257 | |
Qt::Key_Dead_Abovering | 0x01001258 | |
Qt::Key_Dead_Doubleacute | 0x01001259 | |
Qt::Key_Dead_Caron | 0x0100125a | |
Qt::Key_Dead_Cedilla | 0x0100125b | |
Qt::Key_Dead_Ogonek | 0x0100125c | |
Qt::Key_Dead_Iota | 0x0100125d | |
Qt::Key_Dead_Voiced_Sound | 0x0100125e | |
Qt::Key_Dead_Semivoiced_Sound | 0x0100125f | |
Qt::Key_Dead_Belowdot | 0x01001260 | |
Qt::Key_Dead_Hook | 0x01001261 | |
Qt::Key_Dead_Horn | 0x01001262 | |
Qt::Key_Back | 0x01000061 | |
Qt::Key_Forward | 0x01000062 | |
Qt::Key_Stop | 0x01000063 | |
Qt::Key_Refresh | 0x01000064 | |
Qt::Key_VolumeDown | 0x01000070 | |
Qt::Key_VolumeMute | 0x01000071 | |
Qt::Key_VolumeUp | 0x01000072 | |
Qt::Key_BassBoost | 0x01000073 | |
Qt::Key_BassUp | 0x01000074 | |
Qt::Key_BassDown | 0x01000075 | |
Qt::Key_TrebleUp | 0x01000076 | |
Qt::Key_TrebleDown | 0x01000077 | |
Qt::Key_MediaPlay | 0x01000080 | A key setting the state of the media player to play |
Qt::Key_MediaStop | 0x01000081 | A key setting the state of the media player to stop |
Qt::Key_MediaPrevious | 0x01000082 | |
Qt::Key_MediaNext | 0x01000083 | |
Qt::Key_MediaRecord | 0x01000084 | |
Qt::Key_MediaPause | 0x1000085 | A key setting the state of the media player to pause (Note: not the pause/break key) |
Qt::Key_MediaTogglePlayPause | 0x1000086 | A key to toggle the play/pause state in the media player (rather than setting an absolute state) |
Qt::Key_HomePage | 0x01000090 | |
Qt::Key_Favorites | 0x01000091 | |
Qt::Key_Search | 0x01000092 | |
Qt::Key_Standby | 0x01000093 | |
Qt::Key_OpenUrl | 0x01000094 | |
Qt::Key_LaunchMail | 0x010000a0 | |
Qt::Key_LaunchMedia | 0x010000a1 | |
Qt::Key_Launch0 | 0x010000a2 | On X11 this key is mapped to "My Computer" (XF86XK_MyComputer) key for legacy reasons. |
Qt::Key_Launch1 | 0x010000a3 | On X11 this key is mapped to "Calculator" (XF86XK_Calculator) key for legacy reasons. |
Qt::Key_Launch2 | 0x010000a4 | On X11 this key is mapped to XF86XK_Launch0 key for legacy reasons. |
Qt::Key_Launch3 | 0x010000a5 | On X11 this key is mapped to XF86XK_Launch1 key for legacy reasons. |
Qt::Key_Launch4 | 0x010000a6 | On X11 this key is mapped to XF86XK_Launch2 key for legacy reasons. |
Qt::Key_Launch5 | 0x010000a7 | On X11 this key is mapped to XF86XK_Launch3 key for legacy reasons. |
Qt::Key_Launch6 | 0x010000a8 | On X11 this key is mapped to XF86XK_Launch4 key for legacy reasons. |
Qt::Key_Launch7 | 0x010000a9 | On X11 this key is mapped to XF86XK_Launch5 key for legacy reasons. |
Qt::Key_Launch8 | 0x010000aa | On X11 this key is mapped to XF86XK_Launch6 key for legacy reasons. |
Qt::Key_Launch9 | 0x010000ab | On X11 this key is mapped to XF86XK_Launch7 key for legacy reasons. |
Qt::Key_LaunchA | 0x010000ac | On X11 this key is mapped to XF86XK_Launch8 key for legacy reasons. |
Qt::Key_LaunchB | 0x010000ad | On X11 this key is mapped to XF86XK_Launch9 key for legacy reasons. |
Qt::Key_LaunchC | 0x010000ae | On X11 this key is mapped to XF86XK_LaunchA key for legacy reasons. |
Qt::Key_LaunchD | 0x010000af | On X11 this key is mapped to XF86XK_LaunchB key for legacy reasons. |
Qt::Key_LaunchE | 0x010000b0 | On X11 this key is mapped to XF86XK_LaunchC key for legacy reasons. |
Qt::Key_LaunchF | 0x010000b1 | On X11 this key is mapped to XF86XK_LaunchD key for legacy reasons. |
Qt::Key_LaunchG | 0x0100010e | On X11 this key is mapped to XF86XK_LaunchE key for legacy reasons. |
Qt::Key_LaunchH | 0x0100010f | On X11 this key is mapped to XF86XK_LaunchF key for legacy reasons. |
Qt::Key_MonBrightnessUp | 0x010000b2 | |
Qt::Key_MonBrightnessDown | 0x010000b3 | |
Qt::Key_KeyboardLightOnOff | 0x010000b4 | |
Qt::Key_KeyboardBrightnessUp | 0x010000b5 | |
Qt::Key_KeyboardBrightnessDown | 0x010000b6 | |
Qt::Key_PowerOff | 0x010000b7 | |
Qt::Key_WakeUp | 0x010000b8 | |
Qt::Key_Eject | 0x010000b9 | |
Qt::Key_ScreenSaver | 0x010000ba | |
Qt::Key_WWW | 0x010000bb | |
Qt::Key_Memo | 0x010000bc | |
Qt::Key_LightBulb | 0x010000bd | |
Qt::Key_Shop | 0x010000be | |
Qt::Key_History | 0x010000bf | |
Qt::Key_AddFavorite | 0x010000c0 | |
Qt::Key_HotLinks | 0x010000c1 | |
Qt::Key_BrightnessAdjust | 0x010000c2 | |
Qt::Key_Finance | 0x010000c3 | |
Qt::Key_Community | 0x010000c4 | |
Qt::Key_AudioRewind | 0x010000c5 | |
Qt::Key_BackForward | 0x010000c6 | |
Qt::Key_ApplicationLeft | 0x010000c7 | |
Qt::Key_ApplicationRight | 0x010000c8 | |
Qt::Key_Book | 0x010000c9 | |
Qt::Key_CD | 0x010000ca | |
Qt::Key_Calculator | 0x010000cb | On X11 this key is not mapped for legacy reasons. Use Qt::Key_Launch1 instead. |
Qt::Key_ToDoList | 0x010000cc | |
Qt::Key_ClearGrab | 0x010000cd | |
Qt::Key_Close | 0x010000ce | |
Qt::Key_Copy | 0x010000cf | |
Qt::Key_Cut | 0x010000d0 | |
Qt::Key_Display | 0x010000d1 | |
Qt::Key_DOS | 0x010000d2 | |
Qt::Key_Documents | 0x010000d3 | |
Qt::Key_Excel | 0x010000d4 | |
Qt::Key_Explorer | 0x010000d5 | |
Qt::Key_Game | 0x010000d6 | |
Qt::Key_Go | 0x010000d7 | |
Qt::Key_iTouch | 0x010000d8 | |
Qt::Key_LogOff | 0x010000d9 | |
Qt::Key_Market | 0x010000da | |
Qt::Key_Meeting | 0x010000db | |
Qt::Key_MenuKB | 0x010000dc | |
Qt::Key_MenuPB | 0x010000dd | |
Qt::Key_MySites | 0x010000de | |
Qt::Key_News | 0x010000df | |
Qt::Key_OfficeHome | 0x010000e0 | |
Qt::Key_Option | 0x010000e1 | |
Qt::Key_Paste | 0x010000e2 | |
Qt::Key_Phone | 0x010000e3 | |
Qt::Key_Calendar | 0x010000e4 | |
Qt::Key_Reply | 0x010000e5 | |
Qt::Key_Reload | 0x010000e6 | |
Qt::Key_RotateWindows | 0x010000e7 | |
Qt::Key_RotationPB | 0x010000e8 | |
Qt::Key_RotationKB | 0x010000e9 | |
Qt::Key_Save | 0x010000ea | |
Qt::Key_Send | 0x010000eb | |
Qt::Key_Spell | 0x010000ec | |
Qt::Key_SplitScreen | 0x010000ed | |
Qt::Key_Support | 0x010000ee | |
Qt::Key_TaskPane | 0x010000ef | |
Qt::Key_Terminal | 0x010000f0 | |
Qt::Key_Tools | 0x010000f1 | |
Qt::Key_Travel | 0x010000f2 | |
Qt::Key_Video | 0x010000f3 | |
Qt::Key_Word | 0x010000f4 | |
Qt::Key_Xfer | 0x010000f5 | |
Qt::Key_ZoomIn | 0x010000f6 | |
Qt::Key_ZoomOut | 0x010000f7 | |
Qt::Key_Away | 0x010000f8 | |
Qt::Key_Messenger | 0x010000f9 | |
Qt::Key_WebCam | 0x010000fa | |
Qt::Key_MailForward | 0x010000fb | |
Qt::Key_Pictures | 0x010000fc | |
Qt::Key_Music | 0x010000fd | |
Qt::Key_Battery | 0x010000fe | |
Qt::Key_Bluetooth | 0x010000ff | |
Qt::Key_WLAN | 0x01000100 | |
Qt::Key_UWB | 0x01000101 | |
Qt::Key_AudioForward | 0x01000102 | |
Qt::Key_AudioRepeat | 0x01000103 | |
Qt::Key_AudioRandomPlay | 0x01000104 | |
Qt::Key_Subtitle | 0x01000105 | |
Qt::Key_AudioCycleTrack | 0x01000106 | |
Qt::Key_Time | 0x01000107 | |
Qt::Key_Hibernate | 0x01000108 | |
Qt::Key_View | 0x01000109 | |
Qt::Key_TopMenu | 0x0100010a | |
Qt::Key_PowerDown | 0x0100010b | |
Qt::Key_Suspend | 0x0100010c | |
Qt::Key_ContrastAdjust | 0x0100010d | |
Qt::Key_TouchpadToggle | 0x01000110 | |
Qt::Key_TouchpadOn | 0x01000111 | |
Qt::Key_TouchpadOff | 0x01000112 | |
Qt::Key_MicMute | 0x01000113 | |
Qt::Key_Red | 0x01000114 | |
Qt::Key_Green | 0x01000115 | |
Qt::Key_Yellow | 0x01000116 | |
Qt::Key_Blue | 0x01000117 | |
Qt::Key_ChannelUp | 0x01000118 | |
Qt::Key_ChannelDown | 0x01000119 | |
Qt::Key_Guide | 0x0100011a | |
Qt::Key_Info | 0x0100011b | |
Qt::Key_Settings | 0x0100011c | |
Qt::Key_MicVolumeUp | 0x0100011d | |
Qt::Key_MicVolumeDown | 0x0100011e | |
Qt::Key_New | 0x01000120 | |
Qt::Key_Open | 0x01000121 | |
Qt::Key_Find | 0x01000122 | |
Qt::Key_Undo | 0x01000123 | |
Qt::Key_Redo | 0x01000124 | |
Qt::Key_MediaLast | 0x0100ffff | |
Qt::Key_unknown | 0x01ffffff | |
Qt::Key_Call | 0x01100004 | A key to answer or initiate a call (see Qt::Key_ToggleCallHangup for a key to toggle current call state) |
Qt::Key_Camera | 0x01100020 | A key to activate the camera shutter. On Windows Runtime, the environment variable QT_QPA_ENABLE_CAMERA_KEYS must be set to receive the event. |
Qt::Key_CameraFocus | 0x01100021 | A key to focus the camera. On Windows Runtime, the environment variable QT_QPA_ENABLE_CAMERA_KEYS must be set to receive the event. |
Qt::Key_Context1 | 0x01100000 | |
Qt::Key_Context2 | 0x01100001 | |
Qt::Key_Context3 | 0x01100002 | |
Qt::Key_Context4 | 0x01100003 | |
Qt::Key_Flip | 0x01100006 | |
Qt::Key_Hangup | 0x01100005 | A key to end an ongoing call (see Qt::Key_ToggleCallHangup for a key to toggle current call state) |
Qt::Key_No | 0x01010002 | |
Qt::Key_Select | 0x01010000 | |
Qt::Key_Yes | 0x01010001 | |
Qt::Key_ToggleCallHangup | 0x01100007 | A key to toggle the current call state (ie. either answer, or hangup) depending on current call state |
Qt::Key_VoiceDial | 0x01100008 | |
Qt::Key_LastNumberRedial | 0x01100009 | |
Qt::Key_Execute | 0x01020003 | |
Qt::Key_Printer | 0x01020002 | |
Qt::Key_Play | 0x01020005 | |
Qt::Key_Sleep | 0x01020004 | |
Qt::Key_Zoom | 0x01020006 | |
Qt::Key_Exit | 0x0102000a | |
Qt::Key_Cancel | 0x01020001 |
参见 QKeyEvent::key().
enum Qt::KeyboardModifier
flags Qt::KeyboardModifiers
This enum describes the modifier keys.
Constant | Value | Description |
---|---|---|
Qt::NoModifier | 0x00000000 | No modifier key is pressed. |
Qt::ShiftModifier | 0x02000000 | A Shift key on the keyboard is pressed. |
Qt::ControlModifier | 0x04000000 | A Ctrl key on the keyboard is pressed. |
Qt::AltModifier | 0x08000000 | An Alt key on the keyboard is pressed. |
Qt::MetaModifier | 0x10000000 | A Meta key on the keyboard is pressed. |
Qt::KeypadModifier | 0x20000000 | A keypad button is pressed. |
Qt::GroupSwitchModifier | 0x40000000 | X11 only. A Mode_switch key on the keyboard is pressed. |
Note: On macOS, 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.
参见 MouseButton and Modifier.
enum Qt::LayoutDirection
Specifies the direction of Qt's layouts and text handling.
Constant | Value | Description |
---|---|---|
Qt::LeftToRight | 0 | Left-to-right layout. |
Qt::RightToLeft | 1 | Right-to-left layout. |
Qt::LayoutDirectionAuto | 2 | Automatic layout. |
Right-to-left layouts are necessary for certain languages, notably Arabic and Hebrew.
LayoutDirectionAuto serves two purposes. When used in conjunction with widgets and layouts, it will imply to use the layout direction set on the parent widget or QApplication. This has the same effect as QWidget::unsetLayoutDirection().
When LayoutDirectionAuto is used in conjunction with text layouting, it will imply that the text directionality is determined from the content of the string to be layouted.
参见 QGuiApplication::setLayoutDirection(), QWidget::setLayoutDirection(), QTextOption::setTextDirection(), and QString::isRightToLeft().
enum Qt::MaskMode
This enum specifies the behavior of the QPixmap::createMaskFromColor() and QImage::createMaskFromColor() functions.
Constant | Value | Description |
---|---|---|
Qt::MaskInColor | 0 | Creates a mask where all pixels matching the given color are opaque. |
Qt::MaskOutColor | 1 | Creates a mask where all pixels matching the given color are transparent. |
enum Qt::MatchFlag
flags Qt::MatchFlags
This enum describes the type of matches that can be used when searching for items in a model.
Constant | Value | Description |
---|---|---|
Qt::MatchExactly | 0 | Performs QVariant-based matching. |
Qt::MatchFixedString | 8 | Performs string-based matching. String-based comparisons are case-insensitive unless the MatchCaseSensitive flag is also specified. |
Qt::MatchContains | 1 | The search term is contained in the item. |
Qt::MatchStartsWith | 2 | The search term matches the start of the item. |
Qt::MatchEndsWith | 3 | The search term matches the end of the item. |
Qt::MatchCaseSensitive | 16 | The search is case sensitive. |
Qt::MatchRegExp | 4 | Performs string-based matching using a regular expression as the search term. |
Qt::MatchWildcard | 5 | Performs string-based matching using a string with wildcards as the search term. |
Qt::MatchWrap | 32 | Perform 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::MatchRecursive | 64 | Searches the entire hierarchy. |
The MatchFlags type is a typedef for QFlags<MatchFlag>. It stores an OR combination of MatchFlag values.
参见 QString::compare() and QRegExp.
enum Qt::Modifier
This enum provides shorter names for the keyboard modifier keys supported by Qt.
Note: On macOS, the CTRL
value corresponds to the Command keys on the Macintosh keyboard, and the META
value corresponds to the Control keys.
Constant | Value | Description |
---|---|---|
Qt::SHIFT | Qt::ShiftModifier | The Shift keys provided on all standard keyboards. |
Qt::META | Qt::MetaModifier | The Meta keys. |
Qt::CTRL | Qt::ControlModifier | The Ctrl keys. |
Qt::ALT | Qt::AltModifier | The normal Alt keys, but not keys like AltGr. |
Qt::UNICODE_ACCEL | 0x00000000 | The shortcut is specified as a Unicode code point, not as a Qt Key. |
参见 KeyboardModifier and MouseButton.
enum Qt::MouseButton
flags Qt::MouseButtons
This enum type describes the different mouse buttons.
Constant | Value | Description |
---|---|---|
Qt::NoButton | 0x00000000 | The button state does not refer to any button (see QMouseEvent::button()). |
Qt::AllButtons | 0x07ffffff | This value corresponds to a mask of all possible mouse buttons. Use to set the 'acceptedButtons' property of a MouseArea to accept ALL mouse buttons. |
Qt::LeftButton | 0x00000001 | The 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::RightButton | 0x00000002 | The right button. |
Qt::MidButton | 0x00000004 | The middle button. |
Qt::MiddleButton | MidButton | The middle button. |
Qt::BackButton | 0x00000008 | The 'Back' button. (Typically present on the 'thumb' side of a mouse with extra buttons. This is NOT the tilt wheel.) |
Qt::XButton1 | BackButton | The 'Back' Button. |
Qt::ExtraButton1 | XButton1 | The 'Back' Button. |
Qt::ForwardButton | 0x00000010 | The 'Forward' Button. (Typically present beside the 'Back' button, and also pressed by the thumb.) |
Qt::XButton2 | ForwardButton | The 'Forward Button. |
Qt::ExtraButton2 | ForwardButton | The 'Forward' Button. |
Qt::TaskButton | 0x00000020 | The 'Task' Button. |
Qt::ExtraButton3 | TaskButton | The 'Task' Button. |
Qt::ExtraButton4 | 0x00000040 | The 7th non-wheel Mouse Button. |
Qt::ExtraButton5 | 0x00000080 | The 8th non-wheel Mouse Button. |
Qt::ExtraButton6 | 0x00000100 | The 9th non-wheel Mouse Button. |
Qt::ExtraButton7 | 0x00000200 | The 10th non-wheel Mouse Button. |
Qt::ExtraButton8 | 0x00000400 | The 11th non-wheel Mouse Button. |
Qt::ExtraButton9 | 0x00000800 | The 12th non-wheel Mouse Button. |
Qt::ExtraButton10 | 0x00001000 | The 13th non-wheel Mouse Button. |
Qt::ExtraButton11 | 0x00002000 | The 14th non-wheel Mouse Button. |
Qt::ExtraButton12 | 0x00004000 | The 15th non-wheel Mouse Button. |
Qt::ExtraButton13 | 0x00008000 | The 16th non-wheel Mouse Button. |
Qt::ExtraButton14 | 0x00010000 | The 17th non-wheel Mouse Button. |
Qt::ExtraButton15 | 0x00020000 | The 18th non-wheel Mouse Button. |
Qt::ExtraButton16 | 0x00040000 | The 19th non-wheel Mouse Button. |
Qt::ExtraButton17 | 0x00080000 | The 20th non-wheel Mouse Button. |
Qt::ExtraButton18 | 0x00100000 | The 21st non-wheel Mouse Button. |
Qt::ExtraButton19 | 0x00200000 | The 22nd non-wheel Mouse Button. |
Qt::ExtraButton20 | 0x00400000 | The 23rd non-wheel Mouse Button. |
Qt::ExtraButton21 | 0x00800000 | The 24th non-wheel Mouse Button. |
Qt::ExtraButton22 | 0x01000000 | The 25th non-wheel Mouse Button. |
Qt::ExtraButton23 | 0x02000000 | The 26th non-wheel Mouse Button. |
Qt::ExtraButton24 | 0x04000000 | The 27th non-wheel Mouse Button. |
Note: Some models of multi-button mice are pre-configured with high-numbered Buttons emulating keyboard sequences, for use in specific games. In order for these Buttons to be seen as actual 'Mouse Buttons', the device must be re-configured (using the vendor's configuration tool).
The MouseButtons type is a typedef for QFlags<MouseButton>. It stores an OR combination of MouseButton values.
参见 KeyboardModifier and Modifier.
enum Qt::MouseEventFlag
flags Qt::MouseEventFlags
This enum provides additional information concerning a QMouseEvent.
Constant | Value | Description |
---|---|---|
Qt::MouseEventCreatedDoubleClick | 0x01 | Indicates that Qt has created a MouseButtonDblClick event from this event. The flag is set in the causing MouseButtonPress, and not in the resulting MouseButtonDblClick. |
This enum was introduced or modified in Qt 5.3.
The MouseEventFlags type is a typedef for QFlags<MouseEventFlag>. It stores an OR combination of MouseEventFlag values.
enum Qt::MouseEventSource
This enum describes the source of a mouse event and can be useful to determine if the event is an artificial mouse event originating from another device such as a touchscreen.
Constant | Value | Description |
---|---|---|
Qt::MouseEventNotSynthesized | 0 | The most common value. On platforms where such information is available this value indicates that the event was generated in response to a genuine mouse event in the system. |
Qt::MouseEventSynthesizedBySystem | 1 | Indicates that the mouse event was synthesized from a touch event by the platform. |
Qt::MouseEventSynthesizedByQt | 2 | Indicates that the mouse event was synthesized from an unhandled touch event by Qt. |
Qt::MouseEventSynthesizedByApplication | 3 | Indicates that the mouse event was synthesized by the application. This allows distinguishing application-generated mouse events from the ones that are coming from the system or are synthesized by Qt. This value was introduced in Qt 5.6 |
This enum was introduced or modified in Qt 5.3.
参见 Qt::AA_SynthesizeMouseForUnhandledTouchEvents.
enum Qt::NativeGestureType
This enum returns the gesture type.
Constant | Value | Description |
---|---|---|
Qt::BeginNativeGesture | 0 | Sent before gesture event stream. |
Qt::EndNativeGesture | 1 | Sent after gesture event stream. |
Qt::PanNativeGesture | 2 | Sent after a panning gesture. Similar to a click-and-drag mouse movement. |
Qt::ZoomNativeGesture | 3 | Specifies the magnification delta in percent. |
Qt::SmartZoomNativeGesture | 4 | Boolean magnification state. |
Qt::RotateNativeGesture | 5 | Rotation delta in degrees. |
Qt::SwipeNativeGesture | 6 | Sent after a swipe movements. |
This enum was introduced or modified in Qt 5.2.
enum Qt::NavigationMode
This enum type describes the mode for moving focus.
Constant | Value | Description |
---|---|---|
Qt::NavigationModeNone | 0 | Only the touch screen is used. |
Qt::NavigationModeKeypadTabOrder | 1 | Qt::Key_Up and Qt::Key_Down are used to change focus. |
Qt::NavigationModeKeypadDirectional | 2 | Qt::Key_Up, Qt::Key_Down, Qt::Key_Left and Qt::Key_Right are used to change focus. |
Qt::NavigationModeCursorAuto | 3 | The mouse cursor is used to change focus, it is displayed only on non touchscreen devices. The keypad is used to implement a virtual cursor, unless the device has an analog mouse type of input device (e.g. touchpad). This is the recommended setting for an application such as a web browser that needs pointer control on both touch and non-touch devices. |
Qt::NavigationModeCursorForceVisible | 4 | The mouse cursor is used to change focus, it is displayed regardless of device type. The keypad is used to implement a virtual cursor, unless the device has an analog mouse type of input device (e.g. touchpad) |
Note: In 4.6, cursor navigation is only implemented for Symbian OS. On other platforms, it behaves as NavigationModeNone.
This enum was introduced or modified in Qt 4.6.
参见 QApplication::setNavigationMode() and QApplication::navigationMode().
enum Qt::Orientation
flags Qt::Orientations
This type is used to signify an object's orientation.
Constant | Value |
---|---|
Qt::Horizontal | 0x1 |
Qt::Vertical | 0x2 |
Orientation is used with QScrollBar for example.
The Orientations type is a typedef for QFlags<Orientation>. It stores an OR combination of Orientation values.
enum 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::SquareCap | Qt::FlatCap | Qt::RoundCap |
Constant | Value | Description |
---|---|---|
Qt::FlatCap | 0x00 | a square line end that does not cover the end point of the line. |
Qt::SquareCap | 0x10 | a square line end that covers the end point and extends beyond it by half the line width. |
Qt::RoundCap | 0x20 | a rounded line end. |
参见 QPen.
enum 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::BevelJoin | Qt::MiterJoin | Qt::RoundJoin |
Constant | Value | Description |
---|---|---|
Qt::MiterJoin | 0x00 | The outer edges of the lines are extended to meet at an angle, and this area is filled. |
Qt::BevelJoin | 0x40 | The triangular notch between the two lines is filled. |
Qt::RoundJoin | 0x80 | A circular arc between the two lines is filled. |
Qt::SvgMiterJoin | 0x100 | A miter join corresponding to the definition of a miter join in the SVG 1.2 Tiny specification. |
参见 QPen.
enum Qt::PenStyle
This enum type defines the pen styles that can be drawn using QPainter. The styles are:
![]() | ![]() | ![]() |
Qt::SolidLine | Qt::DashLine | Qt::DotLine |
![]() | ![]() | ![]() |
Qt::DashDotLine | Qt::DashDotDotLine | Qt::CustomDashLine |
Constant | Value | Description |
---|---|---|
Qt::NoPen | 0 | no line at all. For example, QPainter::drawRect() fills but does not draw any boundary line. |
Qt::SolidLine | 1 | A plain line. |
Qt::DashLine | 2 | Dashes separated by a few pixels. |
Qt::DotLine | 3 | Dots separated by a few pixels. |
Qt::DashDotLine | 4 | Alternate dots and dashes. |
Qt::DashDotDotLine | 5 | One dash, two dots, one dash, two dots. |
Qt::CustomDashLine | 6 | A custom pattern defined using QPainterPathStroker::setDashPattern(). |
参见 QPen.
enum Qt::ScreenOrientation
flags Qt::ScreenOrientations
This enum type specifies the various orientations a screen might have.
Constant | Value | Description |
---|---|---|
Qt::PrimaryOrientation | 0x00000000 | The display's primary orientation. |
Qt::LandscapeOrientation | 0x00000002 | Landscape orientation, display width is greater than display height. |
Qt::PortraitOrientation | 0x00000001 | Portrait orientation, display height is greater than display width, rotated 90 degree clockwise relative to landscape. |
Qt::InvertedLandscapeOrientation | 0x00000008 | Inverted landscape orientation, rotated 180 degrees relative to landscape. |
Qt::InvertedPortraitOrientation | 0x00000004 | Inverted portrait orientation, rotated 180 degrees relative to portrait. |
The ScreenOrientations type is a typedef for QFlags<ScreenOrientation>. It stores an OR combination of ScreenOrientation values.
enum Qt::ScrollBarPolicy
This enum type describes the various modes of QAbstractScrollArea's scroll bars.
Constant | Value | Description |
---|---|---|
Qt::ScrollBarAsNeeded | 0 | QAbstractScrollArea shows a scroll bar when the content is too large to fit and not otherwise. This is the default. |
Qt::ScrollBarAlwaysOff | 1 | QAbstractScrollArea never shows a scroll bar. |
Qt::ScrollBarAlwaysOn | 2 | QAbstractScrollArea always shows a scroll bar. This property is ignored on systems with transient scroll bars (e.g., on Mac from version 10.7). |
(The modes for the horizontal and vertical scroll bars are independent.)
enum Qt::ScrollPhase
This enum describes the phase of scrolling.
Constant | Value | Description |
---|---|---|
Qt::NoScrollPhase | 0 | The input device doesn't support scroll phase. This value was introduced in Qt 5.7. |
Qt::ScrollBegin | 1 | Scrolling is about to begin, but the scrolling distance did not yet change. |
Qt::ScrollUpdate | 2 | The scrolling distance has changed (default). |
Qt::ScrollEnd | 3 | Scrolling has ended, but the scrolling distance did not change anymore. |
This enum was introduced or modified in Qt 5.2.
enum Qt::ShortcutContext
For a QEvent::Shortcut event to occur, the shortcut's key sequence must be entered by the user in a context where the shortcut is active. The possible contexts are these:
Constant | Value | Description |
---|---|---|
Qt::WidgetShortcut | 0 | The shortcut is active when its parent widget has focus. |
Qt::WidgetWithChildrenShortcut | 3 | The shortcut is active when its parent widget, or any of its children has focus. Children which are top-level widgets, except pop-ups, are not affected by this shortcut context. |
Qt::WindowShortcut | 1 | The shortcut is active when its parent widget is a logical subwidget of the active top-level window. |
Qt::ApplicationShortcut | 2 | The shortcut is active when one of the applications windows are active. |
enum Qt::SizeHint
This enum is used by QGraphicsLayoutItem::sizeHint()
Constant | Value | Description |
---|---|---|
Qt::MinimumSize | 0 | is used to specify the minimum size of a graphics layout item. |
Qt::PreferredSize | 1 | is used to specify the preferred size of a graphics layout item. |
Qt::MaximumSize | 2 | is used to specify the maximum size of a graphics layout item. |
Qt::MinimumDescent | 3 | is used to specify the minimum descent of a text string in a graphics layout item. |
This enum was introduced or modified in Qt 4.4.
参见 QGraphicsLayoutItem::sizeHint().
enum Qt::SizeMode
This enum is used by QPainter::drawRoundedRect() and QPainterPath::addRoundedRect() functions to specify the radii of rectangle corners with respect to the dimensions of the bounding rectangles specified.
Constant | Value | Description |
---|---|---|
Qt::AbsoluteSize | 0 | Specifies the size using absolute measurements. |
Qt::RelativeSize | 1 | Specifies the size relative to the bounding rectangle, typically using percentage measurements. |
This enum was introduced or modified in Qt 4.4.
enum Qt::SortOrder
This enum describes how the items in a widget are sorted.
Constant | Value | Description |
---|---|---|
Qt::AscendingOrder | 0 | The items are sorted ascending e.g. starts with 'AAA' ends with 'ZZZ' in Latin-1 locales |
Qt::DescendingOrder | 1 | The items are sorted descending e.g. starts with 'ZZZ' ends with 'AAA' in Latin-1 locales |
enum Qt::TabFocusBehavior
This enum type provides different focus behaviors for tab navigation.
Constant | Value | Description |
---|---|---|
Qt::NoTabFocus | 0x00 | iterate nothing. |
Qt::TabFocusTextControls | 0x01 | iterate text controls and widgets. |
Qt::TabFocusListControls | 0x02 | iterate list controls and widgets. |
Qt::TabFocusAllControls | 0xff | iterate all controls and widgets. |
This enum was introduced or modified in Qt 5.5.
enum Qt::TextElideMode
This enum specifies where the ellipsis should appear when displaying texts that don't fit:
Constant | Value | Description |
---|---|---|
Qt::ElideLeft | 0 | The ellipsis should appear at the beginning of the text. |
Qt::ElideRight | 1 | The ellipsis should appear at the end of the text. |
Qt::ElideMiddle | 2 | The ellipsis should appear in the middle of the text. |
Qt::ElideNone | 3 | Ellipsis should NOT appear in the text. |
Qt::ElideMiddle is normally the most appropriate choice for URLs (e.g., "http://bugreports.qt.../QTWEBSITE-13/"), whereas Qt::ElideRight is appropriate for other strings (e.g., "Deploying Applications on Ma...").
参见 QAbstractItemView::textElideMode, QFontMetrics::elidedText(), AlignmentFlag, and QTabBar::elideMode.
enum Qt::TextFlag
This enum type is used to define some modifier flags. Some of these flags only make sense in the context of printing:
Constant | Value | Description |
---|---|---|
Qt::TextSingleLine | 0x0100 | Treats all whitespace as spaces and prints just one line. |
Qt::TextDontClip | 0x0200 | If it's impossible to stay within the given bounds, it prints outside. |
Qt::TextExpandTabs | 0x0400 | Makes the U+0009 (ASCII tab) character move to the next tab stop. |
Qt::TextShowMnemonic | 0x0800 | Displays the string "&P" as P For an ampersand, use "&&". |
Qt::TextWordWrap | 0x1000 | Breaks lines at appropriate points, e.g. at word boundaries. |
Qt::TextWrapAnywhere | 0x2000 | Breaks lines anywhere, even within words. |
Qt::TextHideMnemonic | 0x8000 | Same as Qt::TextShowMnemonic but doesn't draw the underlines. |
Qt::TextDontPrint | 0x4000 | Treat this text as "hidden" and don't print it. |
Qt::TextIncludeTrailingSpaces | 0x08000000 | When this option is set, QTextLine::naturalTextWidth() and QTextLine::naturalTextRect() will return a value that includes the width of trailing spaces in the text; otherwise this width is excluded. |
Qt::TextJustificationForced | 0x10000 | Ensures that text lines are justified. |
You can use as many modifier flags as you want, except that Qt::TextSingleLine and Qt::TextWordWrap cannot be combined.
Flags that are inappropriate for a given use are generally ignored.
enum Qt::TextFormat
This enum is used in widgets that can display both plain text and rich text, for example QLabel. It is used for deciding whether a text string should be interpreted as one or the other. This is normally done by passing one of the enum values to a QTextEdit::setTextFormat() function.
Constant | Value | Description |
---|---|---|
Qt::PlainText | 0 | The text string is interpreted as a plain text string. |
Qt::RichText | 1 | The text string is interpreted as a rich text string. See Supported HTML Subset for the definition of rich text. |
Qt::AutoText | 2 | The text string is interpreted as for Qt::RichText if Qt::mightBeRichText() returns true , otherwise as Qt::PlainText. |
enum Qt::TextInteractionFlag
flags Qt::TextInteractionFlags
This enum specifies how a text displaying widget reacts to user input.
Constant | Value | Description |
---|---|---|
Qt::NoTextInteraction | 0 | No interaction with the text is possible. |
Qt::TextSelectableByMouse | 1 | Text can be selected with the mouse and copied to the clipboard using a context menu or standard keyboard shortcuts. |
Qt::TextSelectableByKeyboard | 2 | Text can be selected with the cursor keys on the keyboard. A text cursor is shown. |
Qt::LinksAccessibleByMouse | 4 | Links can be highlighted and activated with the mouse. |
Qt::LinksAccessibleByKeyboard | 8 | Links can be focused using tab and activated with enter. |
Qt::TextEditable | 16 | The text is fully editable. |
Qt::TextEditorInteraction | TextSelectableByMouse | TextSelectableByKeyboard | TextEditable | The default for a text editor. |
Qt::TextBrowserInteraction | TextSelectableByMouse | LinksAccessibleByMouse | LinksAccessibleByKeyboard | The default for QTextBrowser. |
The TextInteractionFlags type is a typedef for QFlags<TextInteractionFlag>. It stores an OR combination of TextInteractionFlag values.
enum Qt::TileRule
This enum describes how to repeat or stretch the parts of an image when drawing.
Constant | Value | Description |
---|---|---|
Qt::StretchTile | 0 | Scale the image to fit to the available area. |
Qt::RepeatTile | 1 | Repeat the image until there is no more space. May crop the last image. |
Qt::RoundTile | 2 | Similar to Repeat, but scales the image down to ensure that the last tile is not cropped. |
This enum was introduced or modified in Qt 4.6.
enum Qt::TimeSpec
Constant | Value | Description |
---|---|---|
Qt::LocalTime | 0 | Locale dependent time (Timezones and Daylight Savings Time). |
Qt::UTC | 1 | Coordinated Universal Time, replaces Greenwich Mean Time. |
Qt::OffsetFromUTC | 2 | An offset in seconds from Coordinated Universal Time. |
Qt::TimeZone | 3 | A named time zone using a specific set of Daylight Savings rules. |
enum Qt::TimerType
The timer type indicates how accurate a timer can be.
Constant | Value | Description |
---|---|---|
Qt::PreciseTimer | 0 | Precise timers try to keep millisecond accuracy |
Qt::CoarseTimer | 1 | Coarse timers try to keep accuracy within 5% of the desired interval |
Qt::VeryCoarseTimer | 2 | Very coarse timers only keep full second accuracy |
On UNIX (including Linux, macOS, and iOS), Qt will keep millisecond accuracy for Qt::PreciseTimer. For Qt::CoarseTimer, the interval will be adjusted up to 5% to align the timer with other timers that are expected to fire at or around the same time. The objective is to make most timers wake up at the same time, thereby reducing CPU wakeups and power consumption.
On Windows, Qt will use Windows's Multimedia timer facility (if available) for Qt::PreciseTimer and normal Windows timers for Qt::CoarseTimer and Qt::VeryCoarseTimer.
On all platforms, the interval for Qt::VeryCoarseTimer is rounded to the nearest full second (e.g. an interval of 23500ms will be rounded to 24000ms, and 20300ms to 20000ms).
enum Qt::ToolBarArea
flags Qt::ToolBarAreas
Constant | Value |
---|---|
Qt::LeftToolBarArea | 0x1 |
Qt::RightToolBarArea | 0x2 |
Qt::TopToolBarArea | 0x4 |
Qt::BottomToolBarArea | 0x8 |
Qt::AllToolBarAreas | ToolBarArea_Mask |
Qt::NoToolBarArea | 0 |
The ToolBarAreas type is a typedef for QFlags<ToolBarArea>. It stores an OR combination of ToolBarArea values.
enum Qt::ToolButtonStyle
The style of the tool button, describing how the button's text and icon should be displayed.
Constant | Value | Description |
---|---|---|
Qt::ToolButtonIconOnly | 0 | Only display the icon. |
Qt::ToolButtonTextOnly | 1 | Only display the text. |
Qt::ToolButtonTextBesideIcon | 2 | The text appears beside the icon. |
Qt::ToolButtonTextUnderIcon | 3 | The text appears under the icon. |
Qt::ToolButtonFollowStyle | 4 | Follow the style. |
enum Qt::TouchPointState
flags Qt::TouchPointStates
This enum represents the state of a touch point at the time a QTouchEvent occurred.
Constant | Value | Description |
---|---|---|
Qt::TouchPointPressed | 0x01 | The touch point is now pressed. |
Qt::TouchPointMoved | 0x02 | The touch point moved. |
Qt::TouchPointStationary | 0x04 | The touch point did not move. |
Qt::TouchPointReleased | 0x08 | The touch point was released. |
This enum was introduced or modified in Qt 4.6.
The TouchPointStates type is a typedef for QFlags<TouchPointState>. It stores an OR combination of TouchPointState values.
enum Qt::TransformationMode
This enum type defines whether image transformations (e.g., scaling) should be smooth or not.
Constant | Value | Description |
---|---|---|
Qt::FastTransformation | 0 | The transformation is performed quickly, with no smoothing. |
Qt::SmoothTransformation | 1 | The resulting image is transformed using bilinear filtering. |
参见 QImage::scaled().
enum Qt::UIEffect
This enum describes the available UI effects.
By default, Qt will try to use the platform specific desktop settings for each effect. Use the QApplication::setDesktopSettingsAware() function (passing false
as argument) to prevent this, and the QApplication::setEffectEnabled() to enable or disable a particular effect.
Note that all effects are disabled on screens running at less than 16-bit color depth.
Constant | Value | Description |
---|---|---|
Qt::UI_AnimateMenu | 1 | Show animated menus. |
Qt::UI_FadeMenu | 2 | Show faded menus. |
Qt::UI_AnimateCombo | 3 | Show animated comboboxes. |
Qt::UI_AnimateTooltip | 4 | Show tooltip animations. |
Qt::UI_FadeTooltip | 5 | Show tooltip fading effects. |
Qt::UI_AnimateToolBox | 6 | Reserved |
参见 QApplication::setEffectEnabled() and QGuiApplication::setDesktopSettingsAware().
enum Qt::WhiteSpaceMode
This enum describes the types of whitespace mode that are used by the QTextDocument class to meet the requirements of different kinds of textual information.
Constant | Value | Description |
---|---|---|
Qt::WhiteSpaceNormal | 0 | The whitespace mode used to display normal word wrapped text in paragraphs. |
Qt::WhiteSpacePre | 1 | A preformatted text mode in which whitespace is reproduced exactly. |
Qt::WhiteSpaceNoWrap | 2 |
enum Qt::WidgetAttribute
widget属性. QWidget::setAttribute()设置widget属性; QWidget::testAttribute()查询widget属性.
Constant | Value | Description |
---|---|---|
Qt::WA_AcceptDrops | 78 | 允许widget接收拖拽数据 (参见 QWidget::setAcceptDrops()). |
Qt::WA_AlwaysShowToolTips | 84 | 开启非激活窗口的工具提示. |
Qt::WA_ContentsPropagated | 3 | 已过时, 不再生效. 从Qt4.1开始, 所有未设置WA_PaintOnScreen标识的widget, 传递它的内容. |
Qt::WA_CustomWhatsThis | 47 | 指明widget在"What's This"模式继续正常工作, 由widget的作者设置. |
Qt::WA_DeleteOnClose | 55 | widget收到close事件时, Qt会删除widget (参见 QWidget::closeEvent()). |
Qt::WA_Disabled | 0 | 指明widget是禁用状态, 即. 它不再接收任何鼠标或键盘事件. QWidget::isEnabled()是查询函数. 这个状态被Qt内核设置/清除. |
Qt::WA_DontShowOnScreen | 103 | 指明widget隐藏, 或不属于可视桌面的一部分. |
Qt::WA_ForceDisabled | 32 | 指明widget是禁用状态, 即. 即使它的祖先设置为启用状态, 也继续保持禁用状态. 含有WA_Disabled的意思. 调用QWidget::setEnabled()和QWidget::setDisabled()设置/清除. |
Qt::WA_ForceUpdatesDisabled | 59 | 指明widget期望禁用更新. 即. 即使它的祖先设置为启用更新, 也继续保持禁用. 含有WA_UpdatesDisabled的意思. 调用QWidget::setUpdatesEnabled()设置/清除. |
Qt::WA_GroupLeader | 72 | 已弃用. 替换为 QWidget::windowModality. |
Qt::WA_Hover | 74 | 鼠标进入或离开widget时, 强制Qt生成绘制事件. 通常用于自定义样式; 详见Styles. |
Qt::WA_InputMethodEnabled | 14 | 启用亚洲语言输入法. 创建自定义文本编辑widget时, 必须设置. |
Qt::WA_KeyboardFocusChange | 77 | 设置顶级窗口在键盘(Tab, BackTab或快捷键)按下时, 更改焦点. |
Qt::WA_KeyCompression | 33 | 启用键盘事件压缩. 默认情况下, 按键压缩是关闭的. 每次按键, widget会收到一个按键事件(自动重复打开时, 更多). 如果开启, 程序无法处理按键输入时, Qt可能尝试压缩事件, 这样每个事件可以处理多个字符. 例如, 如果重新计算布局花费CPU太长时间, 则文件处理widget可能在QKeyEvent::text()中接收2个, 3个或更多字符. 如果widget支持多字符unicode输入, 则开启压缩总是安全的. Qt只对可打印字符执行关键事件压缩. Qt::Modifier键, 光标移动键, 功能键和其他动作键(如Escape, Enter, Backspace, PrintScreen)不会压缩. Mac和X11以外的平台不支持这种压缩, 在这种情况下打开它不会有任何效果. 这是由widget作者设置/清除. |
Qt::WA_LayoutOnEntireRect | 48 | 指明QLayout基于QWidget::rect()计算布局, 而不是QWidget::contentsRect(). 这是由widget作者设置/清除. |
Qt::WA_LayoutUsesWidgetRect | 92 | 指明QLayout计算widget的布局时, 忽略样式表中widget的rect. |
Qt::WA_MacNoClickThrough | 12 | 已弃用, 不会生效. |
Qt::WA_MacOpaqueSizeGrip | 85 | 指明widget的大小调节按钮是非透明的(默认状态). 这个属性仅在macOS生效. 这个属性由widget作者设置. |
Qt::WA_MacShowFocusRect | 88 | 指明widget在四周有QFocusFrame. 若widget自己绘制焦点框, 不用考虑这个属性. QWidget::focusPolicy在获取焦点方面不发挥主要作用, 仅控制是否获取焦点框. 这个属性仅适用于macOS. |
Qt::WA_MacNormalSize | 89 | 指明widget在mac系统应该有正常尺寸. 这个属性仅适用于macOS. |
Qt::WA_MacSmallSize | 90 | 指明widget在mac系统应该有小尺寸. 这个属性仅适用于macOS. |
Qt::WA_MacMiniSize | 91 | 指明widget在mac系统应该有迷你尺寸. 这个属性仅适用于macOS. |
Qt::WA_MacVariableSize | 102 | 指明在修改widget的大小时可以选择这个widget. 这个属性仅适用于macOS. |
Qt::WA_MacBrushedMetal | 46 | 已弃用, 不生效. |
Qt::WA_Mapped | 11 | 指明widget映射到屏幕. 这个属性由Qt内核设置/清除. |
Qt::WA_MouseNoMask | 71 | widget接收所有鼠标事件, 忽视QWidget::setMask()设置的掩码. 这个属性不适用于顶级窗口. |
Qt::WA_MouseTracking | 2 | 指明widget启用鼠标追踪. 参见QWidget::mouseTracking. |
Qt::WA_Moved | 43 | 指明widget有明确的位置. 由QWidget::move()和QWidget::setGeometry()设置/清除. |
Qt::WA_MSWindowsUseDirect3D | 94 | 已弃用, 不生效. |
Qt::WA_NoBackground | WA_OpaquePaintEvent | 已弃用, 使用WA_OpaquePaintEvent替代. |
Qt::WA_NoChildEventsForParent | 58 | 指明widget不想往父对象发送ChildAdded或ChildRemoved事件. 很少使用, 避免自动插入widget, 如splitter和layout. 由widget作者设置. |
Qt::WA_NoChildEventsFromChildren | 39 | 指明widget不想接收子对象的ChildAdded或ChildRemoved事件. 由widget作者设置. |
Qt::WA_NoMouseReplay | 54 | 用于弹出式widget. 关闭widget时, 不应回放最近的鼠标按下事件. 这个标识由widget作者设置. widget每次接收到新鼠标事件时, 由Qt内核清理. |
Qt::WA_NoMousePropagation | 73 | 禁止将鼠标事件传递给父widget. 默认禁用, 即传递. |
Qt::WA_TransparentForMouseEvents | 51 | 启用后, 这个属性禁止向widget及子widget传递鼠标事件. 鼠标事件传递给其他widget, 就像这个widget及子widget不在当前的层次结构; 鼠标点击和其他事件会透过它们. 默认禁用. |
Qt::WA_NoSystemBackground | 9 | 指明widget没有背景, 即. widget收到绘制事件时, 背景不自动重新绘制. 注意: 与WA_OpaquePaintEvent不同, 新暴露的区域从不填充背景(如., 窗口第一次显示后, 用户可以"透过"它, 直到应用程序处理绘制事件). 这个标识由widget作者设置或清除. |
Qt::WA_OpaquePaintEvent | 4 | 指明widget在接收到绘制事件时, 绘制所有像素. 因此, 绘制事件生成前, 更新, 调整大小, 滚动和更改焦点等不会重绘widget. WA_OpaquePaintEvent提供一种优化方式, 有助于减少不支持双缓冲系统的闪烁, 避免绘制前擦除背景所需的计算周期. 注意: 与WA_NoSystemBackground不同, WA_OpaquePaintEvent尽量避免透明的窗口背景. 这个标志由小部件的作者设置或清除. |
Qt::WA_OutsideWSRange | 49 | 指明widget在窗口系统坐标系的有效范围之外. 有效范围外的widget无法在屏幕映射. 这个标识由Qt内核设置/清除. |
Qt::WA_PaintOnScreen | 8 | 指明widget直接绘制到屏幕上. 具有这个属性的widget不被管理, 即. 它不能是半透明或半透明叠加的widget. 注意: 这个标识仅在X11上支持, 它禁用双缓存. 在嵌入式Linux上, 这个标识仅在顶级widget生效, 并且它依赖显卡驱动的支持. 这个标识由widget作者设置或清除. 要在Qt的绘制系统之外渲染(如., 支持原生窗口绘制), 则重载QWidget::paintEngine(), 返回0, 并设置此属性. |
Qt::WA_PaintUnclipped | 52 | widget上的所有绘制操作不进行裁剪. 设置WA_PaintOnScreen标识后, 这个标识才有效. 跨平台的首选实现方式是创建一个位于其他widget前面的透明widget. |
Qt::WA_PendingMoveEvent | 34 | 挂起移动事件, 如., 移动隐藏的widget. 这个标识由Qt内核设置或清除. |
Qt::WA_PendingResizeEvent | 35 | 挂机resize事件, 如., 调整隐藏的widget的大小. 这个标识由Qt内核设置或清除. |
Qt::WA_QuitOnClose | 76 | 最后一个窗口收到closeEvent()时, Qt退出应用程序. 这个行为可以通过 QApplication::quitOnLastWindowClosed 属性修改. 默认情况下, Qt::Window类型的widget设置这个标识. |
Qt::WA_Resized | 42 | 指明widget有明确的大小. 这个标识调用QWidget::resize()和QWidget::setGeometry()设置或清除. |
Qt::WA_RightToLeft | 56 | 指明widget的布局方向是从右到左. |
Qt::WA_SetCursor | 38 | 指明widget有自定义的光标. 这个标识调用QWidget::setCursor()和QWidget::unsetCursor()设置或清除. |
Qt::WA_SetFont | 37 | 指明widget有自定义的字体. 这个标识调用QWidget::setFont()设置或清除. |
Qt::WA_SetPalette | 36 | 指明widget有自定义的palette. 这个标识调用QWidget::setPalette()设置或清除. |
Qt::WA_SetStyle | 86 | 指明widget有自定义的style. 这个标识调用QWidget::setStyle()设置或清除. |
Qt::WA_ShowModal | 70 | 已弃用. 使用QWidget::windowModality替代. |
Qt::WA_StaticContents | 5 | 指明widget内容是西北对齐的, 静态的. 调整大小时, 这种widget只接收其自身新可见的部分的绘制事件. 这个标志由widget作者设置或清除. |
Qt::WA_StyleSheet | 97 | 指明widget的样式使用样式表设置.WA_StyleSheet是widget受样式表约束时设置的, 即使样式表不影响widget的外观. |
Qt::WA_TabletTracking | 129 | 指明widget启用Tablet追踪. 参见QWidget::tabletTracking. |
Qt::WA_TranslucentBackground | 120 | 指明widget应具有半透明背景, widget具有alpha通道. 设置这个属性自动设置WA_NoSystemBackground. 在Windows上, widget还需要设置Qt::FramelessWindowHint标识. 这个标志由widget作者设置或清除. |
Qt::WA_UnderMouse | 1 | 指明widget位于鼠标光标下. 在拖放操作时, 这个值无法正确更新. 对应检测函数是QWidget::underMouse(). 这个标识由Qt内核设置或清除. |
Qt::WA_UpdatesDisabled | 10 | 禁用更新(包括系统背景). 这个标识由Qt内核设置或清除. 警告: widget作者不能设置或清除这个标识. |
Qt::WA_WindowModified | 41 | 指明窗口已修改. 某些平台上, 这个标志不起作用, 在macOS和Windows上, 窗口采用修改后的外观. 这个标志调用QWidget::setWindowModified()设置或清除. |
Qt::WA_WindowPropagation | 80 | M顶层窗口从父窗口继承字体, 样式和区域设置. |
Qt::WA_MacAlwaysShowToolWindow | 96 | macOS系统上, 应用程序未激活时, 显示工具窗口. 默认情况下, 应用程序未激活时, 隐藏所有的工具窗口. |
Qt::WA_SetLocale | 87 | 指明widget应考虑区域设置. |
Qt::WA_StyledBackground | 93 | 指明widget应该使用样式化的背景绘制. |
Qt::WA_ShowWithoutActivating | 98 | 未激活时, 显示widget. |
Qt::WA_NativeWindow | 100 | 指明Qt为widget创建一个原生窗口. 除非祖先窗口设置Qt::WA_DontCreateNativeAncestors, 不然祖先窗口也会强制设置这个标志. |
Qt::WA_DontCreateNativeAncestors | 101 | 虽然widget设置为原生窗口, 但是它的祖先widget保持非原生窗口. |
Qt::WA_X11NetWmWindowTypeDesktop | 104 | _NET_WM_WINDOW_TYPE_DESKTOP 加到X11窗口属性 _NET_WM_WINDOW_TYPE. 详见 http://standards.freedesktop.org/wm-spec/. 这个属性在非X11平台无效. |
Qt::WA_X11NetWmWindowTypeDock | 105 | _NET_WM_WINDOW_TYPE_DOCK 加到X11窗口属性 _NET_WM_WINDOW_TYPE. 详见 http://standards.freedesktop.org/wm-spec/. 这个属性在非X11平台无效. |
Qt::WA_X11NetWmWindowTypeToolBar | 106 | _NET_WM_WINDOW_TYPE_TOOLBAR 加到X11窗口属性 _NET_WM_WINDOW_TYPE. 详见 http://standards.freedesktop.org/wm-spec/. 这个属性在非X11平台无效. 注意: Qt自动为QToolBar设置这个属性. |
Qt::WA_X11NetWmWindowTypeMenu | 107 | _NET_WM_WINDOW_TYPE_MENU 加到X11窗口属性 _NET_WM_WINDOW_TYPE. 详见 http://standards.freedesktop.org/wm-spec/. 这个属性在非X11平台无效. 注意: torn-off时, Qt自动为QMenu设置这个属性. |
Qt::WA_X11NetWmWindowTypeUtility | 108 | _NET_WM_WINDOW_TYPE_UTILITY 加到X11窗口属性 _NET_WM_WINDOW_TYPE. 详见 http://standards.freedesktop.org/wm-spec/. 这个属性在非X11平台无效. 注意: Qt自动为Qt::Tool设置这个属性. |
Qt::WA_X11NetWmWindowTypeSplash | 109 | _NET_WM_WINDOW_TYPE_SPLASH 加到X11窗口属性 _NET_WM_WINDOW_TYPE. 详见 http://standards.freedesktop.org/wm-spec/. 这个属性在非X11平台无效. 注意: Qt自动为Qt::SplashScreen类型窗口设置这个属性. |
Qt::WA_X11NetWmWindowTypeDialog | 110 | _NET_WM_WINDOW_TYPE_DIALOG 加到X11窗口属性 _NET_WM_WINDOW_TYPE. 详见 http://standards.freedesktop.org/wm-spec/. 这个属性在非X11平台无效. 注意: Qt自动为Qt::Dialog 和 Qt::Sheet类型窗口设置这个属性. |
Qt::WA_X11NetWmWindowTypeDropDownMenu | 111 | _NET_WM_WINDOW_TYPE_DROPDOWN_MENU 加到X11窗口属性 _NET_WM_WINDOW_TYPE. 详见 http://standards.freedesktop.org/wm-spec/. 这个属性在非X11平台无效. 注意: Qt自动为添加到QMenuBar上的QMenu对象设置这个属性. |
Qt::WA_X11NetWmWindowTypePopupMenu | 112 | _NET_WM_WINDOW_TYPE_POPUP_MENU 加到X11窗口属性 _NET_WM_WINDOW_TYPE. 详见 http://standards.freedesktop.org/wm-spec/. 这个属性在非X11平台无效. 注意: Qt自动为QMenu设置这个属性. |
Qt::WA_X11NetWmWindowTypeToolTip | 113 | _NET_WM_WINDOW_TYPE_TOOLTIP 加到X11窗口属性 _NET_WM_WINDOW_TYPE. 详见 http://standards.freedesktop.org/wm-spec/. 这个属性在非X11平台无效. 注意: Qt自动为Qt::ToolTip类型窗口设置这个属性. |
Qt::WA_X11NetWmWindowTypeNotification | 114 | _NET_WM_WINDOW_TYPE_NOTIFICATION 加到X11窗口属性 _NET_WM_WINDOW_TYPE. 详见 http://standards.freedesktop.org/wm-spec/. 这个属性在非X11平台无效. |
Qt::WA_X11NetWmWindowTypeCombo | 115 | _NET_WM_WINDOW_TYPE_COMBO 加到X11窗口属性 _NET_WM_WINDOW_TYPE. 详见 http://standards.freedesktop.org/wm-spec/. 这个属性在非X11平台无效. 注意: Qt自动为弹出的QComboBox设置这个属性. |
Qt::WA_X11NetWmWindowTypeDND | 116 | _NET_WM_WINDOW_TYPE_DND 加到X11窗口属性 _NET_WM_WINDOW_TYPE. 详见 http://standards.freedesktop.org/wm-spec/. 这个属性在非X11平台无效. 注意: Qt自动为拖动过程中的feedback widget设置这个属性. |
Qt::WA_MacFrameworkScaled | 117 | 已弃用, 无效. |
Qt::WA_AcceptTouchEvents | 121 | 允许widget接收触摸事件(参见QTouchEvent). 必须在所有处理触摸事件的widget上设置. 未设置时, 触摸事件转为鼠标事件发送. |
Qt::WA_TouchPadAcceptSingleTouchEvents | 123 | 允许将触摸板单个触摸事件发送给widget. |
Qt::WA_X11DoNotAcceptFocus | 126 | 要求窗口管理器不给顶级窗口焦点. 这个属性在非X11平台无效. |
Qt::WA_AlwaysStackOnTop | 128 | 从Qt 5.4开始, 这个属性强制QOpenGLWidget和QQuickWidget在其他widget上面, 且最后绘制. 其他类型的widget忽略. 这个属性会打破窗口的堆叠顺序, 但是允许有半透明的OpenGL widget在其他widget的下方可见. 强烈建议: 启用或禁止这个属性后, widget的顶级窗口调用update(). |
Qt::WA_ContentsMarginsRespectsSafeArea | 130 | 默认情况下, QWidget优先考虑窗口的内容边距. 这表明, 除非设置Qt::WA_LayoutOnEntireRect属性, 否则QLayout使用widget的内容区域进行布局. 这与内容边距为0一起可以在实际布局中使用, 例如, 允许背景图像位于iOS设备上的状态栏和其他系统区域的下方, 同时仍然允许基于安全区域插入该背景的子窗口widget. |
enum Qt::WindowFrameSection
This enum is used to describe parts of a window frame. It is returned by QGraphicsWidget::windowFrameSectionAt() to describe what section of the window frame is under the mouse.
Constant | Value |
---|---|
Qt::NoSection | 0 |
Qt::LeftSection | 1 |
Qt::TopLeftSection | 2 |
Qt::TopSection | 3 |
Qt::TopRightSection | 4 |
Qt::RightSection | 5 |
Qt::BottomRightSection | 6 |
Qt::BottomSection | 7 |
Qt::BottomLeftSection | 8 |
Qt::TitleBarArea | 9 |
This enum was introduced or modified in Qt 4.4.
参见 QGraphicsWidget::windowFrameEvent(), QGraphicsWidget::paintWindowFrame(), and QGraphicsWidget::windowFrameSectionAt().
enum Qt::WindowModality
This enum specifies the behavior of a modal window. A modal window is one that blocks input to other windows. Note that windows that are children of a modal window are not blocked.
The values are:
Constant | Value | Description |
---|---|---|
Qt::NonModal | 0 | The window is not modal and does not block input to other windows. |
Qt::WindowModal | 1 | The window is modal to a single window hierarchy and blocks input to its parent window, all grandparent windows, and all siblings of its parent and grandparent windows. |
Qt::ApplicationModal | 2 | The window is modal to the application and blocks input to all windows. |
参见 QWidget::windowModality and QDialog.
enum Qt::WindowState
flags Qt::WindowStates
This enum type is used to specify the current state of a top-level window.
The states are
Constant | Value | Description |
---|---|---|
Qt::WindowNoState | 0x00000000 | The window has no state set (in normal state). |
Qt::WindowMinimized | 0x00000001 | The window is minimized (i.e. iconified). |
Qt::WindowMaximized | 0x00000002 | The window is maximized with a frame around it. |
Qt::WindowFullScreen | 0x00000004 | The window fills the entire screen without any frame around it. |
Qt::WindowActive | 0x00000008 | The window is the active window, i.e. it has keyboard focus. |
The WindowStates type is a typedef for QFlags<WindowState>. It stores an OR combination of WindowState values.
enum Qt::WindowType
flags Qt::WindowFlags
This enum type is used to specify various window-system properties for the widget. They are fairly unusual but necessary in a few cases. Some of these flags depend on whether the underlying window manager supports them.
The main types are
Constant | Value | Description |
---|---|---|
Qt::Widget | 0x00000000 | This is the default type for QWidget. Widgets of this type are child widgets if they have a parent, and independent windows if they have no parent. See also Qt::Window and Qt::SubWindow. |
Qt::Window | 0x00000001 | Indicates that the widget is a window, usually with a window system frame and a title bar, irrespective of whether the widget has a parent or not. Note that it is not possible to unset this flag if the widget does not have a parent. |
Qt::Dialog | 0x00000002 | Window | Indicates that the widget is a window that should be decorated as a dialog (i.e., typically no maximize or minimize buttons in the title bar). This is the default type for QDialog. If you want to use it as a modal dialog, it should be launched from another window, or have a parent and used with the QWidget::windowModality property. If you make it modal, the dialog will prevent other top-level windows in the application from getting any input. We refer to a top-level window that has a parent as a secondary window. |
Qt::Sheet | 0x00000004 | Window | Indicates that the window is a Macintosh sheet. Since using a sheet implies window modality, the recommended way is to use QWidget::setWindowModality(), or QDialog::open(), instead. |
Qt::Drawer | Sheet | Dialog | Indicates that the widget is a Macintosh drawer. |
Qt::Popup | 0x00000008 | Window | Indicates that the widget is a pop-up top-level window, i.e. that it is modal, but has a window system frame appropriate for pop-up menus. |
Qt::Tool | Popup | Dialog | Indicates that the widget is a tool window. A tool window is often a small window with a smaller than usual title bar and decoration, typically used for collections of tool buttons. If there is a parent, the tool window will always be kept on top of it. If there isn't a parent, you may consider using Qt::WindowStaysOnTopHint as well. If the window system supports it, a tool window can be decorated with a somewhat lighter frame. It can also be combined with Qt::FramelessWindowHint. On macOS, tool windows correspond to the Floating class of windows. This means that the window lives on a level above normal windows making it impossible to put a normal window on top of it. By default, tool windows will disappear when the application is inactive. This can be controlled by the Qt::WA_MacAlwaysShowToolWindow attribute. |
Qt::ToolTip | Popup | Sheet | Indicates that the widget is a tooltip. This is used internally to implement tooltips. |
Qt::SplashScreen | ToolTip | Dialog | Indicates that the window is a splash screen. This is the default type for QSplashScreen. |
Qt::Desktop | 0x00000010 | Window | Indicates that this widget is the desktop. This is the type for QDesktopWidget. |
Qt::SubWindow | 0x00000012 | Indicates that this widget is a sub-window, such as a QMdiSubWindow widget. |
Qt::ForeignWindow | 0x00000020 | Window | Indicates that this window object is a handle representing a native platform window created by another process or by manually using native code. |
Qt::CoverWindow | 0x00000040 | Window | Indicates that the window represents a cover window, which is shown when the application is minimized on some platforms. |
There are also a number of flags which you can use to customize the appearance of top-level windows. These have no effect on other windows:
Constant | Value | Description |
---|---|---|
Qt::MSWindowsFixedSizeDialogHint | 0x00000100 | Gives the window a thin dialog border on Windows. This style is traditionally used for fixed-size dialogs. |
Qt::MSWindowsOwnDC | 0x00000200 | Gives the window its own display context on Windows. |
Qt::BypassWindowManagerHint | 0x00000400 | This flag can be used to indicate to the platform plugin that "all" window manager protocols should be disabled. This flag will behave different depending on what operating system the application is running on and what window manager is running. The flag can be used to get a native window with no configuration set. |
Qt::X11BypassWindowManagerHint | BypassWindowManagerHint | Bypass the window manager completely. This results in a borderless window that is not managed at all (i.e., no keyboard input unless you call QWidget::activateWindow() manually). |
Qt::FramelessWindowHint | 0x00000800 | Produces a borderless window. The user cannot move or resize a borderless window via the window system. On X11, the result of the flag is dependent on the window manager and its ability to understand Motif and/or NETWM hints. Most existing modern window managers can handle this. |
Qt::NoDropShadowWindowHint | 0x40000000 | Disables window drop shadow on supporting platforms. |
The CustomizeWindowHint
flag is used to enable customization of the window controls. This flag must be set to allow the WindowTitleHint
, WindowSystemMenuHint
, WindowMinimizeButtonHint
, WindowMaximizeButtonHint
and WindowCloseButtonHint
flags to be changed.
Constant | Value | Description |
---|---|---|
Qt::CustomizeWindowHint | 0x02000000 | Turns off the default window title hints. |
Qt::WindowTitleHint | 0x00001000 | Gives the window a title bar. |
Qt::WindowSystemMenuHint | 0x00002000 | Adds a window system menu, and possibly a close button (for example on Mac). If you need to hide or show a close button, it is more portable to use WindowCloseButtonHint . |
Qt::WindowMinimizeButtonHint | 0x00004000 | Adds a minimize button. On some platforms this implies Qt::WindowSystemMenuHint for it to work. |
Qt::WindowMaximizeButtonHint | 0x00008000 | Adds a maximize button. On some platforms this implies Qt::WindowSystemMenuHint for it to work. |
Qt::WindowMinMaxButtonsHint | WindowMinimizeButtonHint | WindowMaximizeButtonHint | Adds a minimize and a maximize button. On some platforms this implies Qt::WindowSystemMenuHint for it to work. |
Qt::WindowCloseButtonHint | 0x08000000 | Adds a close button. On some platforms this implies Qt::WindowSystemMenuHint for it to work. |
Qt::WindowContextHelpButtonHint | 0x00010000 | Adds a context help button to dialogs. On some platforms this implies Qt::WindowSystemMenuHint for it to work. |
Qt::MacWindowToolBarButtonHint | 0x10000000 | On macOS adds a tool bar button (i.e., the oblong button that is on the top right of windows that have toolbars). |
Qt::WindowFullscreenButtonHint | 0x80000000 | On macOS adds a fullscreen button. |
Qt::BypassGraphicsProxyWidget | 0x20000000 | Prevents the window and its children from automatically embedding themselves into a QGraphicsProxyWidget if the parent widget is already embedded. You can set this flag if you want your widget to always be a toplevel widget on the desktop, regardless of whether the parent widget is embedded in a scene or not. |
Qt::WindowShadeButtonHint | 0x00020000 | Adds a shade button in place of the minimize button if the underlying window manager supports it. |
Qt::WindowStaysOnTopHint | 0x00040000 | Informs the window system that the window should stay on top of all other windows. Note that on some window managers on X11 you also have to pass Qt::X11BypassWindowManagerHint for this flag to work correctly. |
Qt::WindowStaysOnBottomHint | 0x04000000 | Informs the window system that the window should stay on bottom of all other windows. Note that on X11 this hint will work only in window managers that support _NET_WM_STATE_BELOW atom. If a window always on the bottom has a parent, the parent will also be left on the bottom. This window hint is currently not implemented for macOS. |
Qt::WindowTransparentForInput | 0x00080000 | Informs the window system that this window is used only for output (displaying something) and does not take input. Therefore input events should pass through as if it wasn't there. |
Qt::WindowOverridesSystemGestures | 0x00100000 | Informs the window system that this window implements its own set of gestures and that system level gestures, like for instance three-finger desktop switching, should be disabled. |
Qt::WindowDoesNotAcceptFocus | 0x00200000 | Informs the window system that this window should not receive the input focus. |
Qt::MaximizeUsingFullscreenGeometryHint | 0x00400000 | Informs the window system that when maximizing the window it should use as much of the available screen geometry as possible, including areas that may be covered by system UI such as status bars or application launchers. This may result in the window being placed under these system UIs, but does not guarantee it, depending on whether or not the platform supports it. When the flag is enabled the user is responsible for taking QScreen::availableGeometry() into account, so that any UI elements in the application that require user interaction are not covered by system UI. |
Qt::WindowType_Mask | 0x000000ff | A mask for extracting the window type part of the window flags. |
The WindowFlags type is a typedef for QFlags<WindowType>. It stores an OR combination of WindowType values.