The Qt class is a namespace for miscellaneous identifiers that need to be global-like.
Normally, you can ignore this class. QObject and a few other
classes inherit it, so that all the identifiers in the Qt namespace
are visible to you without qualification.
However, occasionally you may need to say Qt::black instead just
black, particularly in static utility functions (such as many
class factories).
This enum type is used to describe alignment. It contains four sets
of flags: Horizontal, vertical and modifying flags. The horizontal
flags are:
AlignLeft - Align with the left edge.
AlignRight - Align with the right edge.
AlignHCenter - Center horizontally in the available space.
The vertical flags are:
AlignTop - Align with the top.
AlignBottom - Align with the bottom.
AlignVCenter - Center vertically in the available space.
You can only use one of the horizontal flags at a time. There
is one two-dimensional flag:
AlignCenter - Center in both dimensions.
This counts both as a horizontal and vertical flag: It cannot
be combined with any other horizontal or vertical flags.
There are also some modifier flags. All of them apply only to
printing:
SingleLine - Treat all white-space as space and print just
one line.
DontClip - If it's impossible to stay within the given
bounds, print outside.
ExpandTabs - Make the U+0009 (ascii tab) character move to
the next tab stop.
ShowPrefix - Display the string "&P" as an underlined P
(see QButton for an example). To get an ampersand, use "&&".
WordBreak - Do line breaking at at appropriate points.
You can only use one of the horizontal flags at a time, and one of
the vertical flags. AlignCenter counts as both horizontal and
vertical. You can use as many modifier flags as you want, except
that SingleLine and WordBreak cannot be combined.
Flags that are inappropriate for a given use (e.g. ShowPrefix to
QGridLayout::addWidget()) are ignored.
Conflicting combinations of flags have undefined meanings.
This enum type describes the state of the mouse buttons and the
modifier buttons. The currently defined values are:
NoButton - used when the button state does not refer to any
button (see QMouseEvent::button()).
LeftButton - set if the left button is pressed, or this
event refers to the left button. Note that the left button may be
the right button on left-handed mice.
RightButton - the right button.
MidButton - the middle button
ShiftButton - a shift key on the keyboard is also pressed.
ControlButton - a control key on the keyboard is also pressed.
AltButton - an alt (or meta) key on the keyboard is also pressed.
This enum type defines the pen join styles supported by Qt; ie. what
sorts of joins between two connected lines that can be drawn using
QPainter. The available styles are:
MiterJoin - The outer edges of the lines are extended to
meet at an angle, and this area is filled.
BevelJoin - The triangular notch between the two lines is filled.
RoundJoin - A circular arc between the two lines is filled.
This enum type is used to describe the way things are written to the
paint device. Each bit of the src (what you write) interacts with
the corresponding bit of the dst pixel. The currently defined
values are:
CopyROP - dst = src
OrROP - dst = src OR dst
XorROP - dst = src XOR dst
NotAndROP - dst = (NOT src) AND dst
EraseROP - an alias for NotAndROP
NotCopyROP - dst = NOT src
NotOrROP - dst = (NOT src) OR dst
NotXorROP - dst = (NOT src) XOR dst
AndROP - dst = src AND dst
NotEraseROP - an alias for AndROP
NotROP - dst = NOT dst
ClearROP - dst = 0
SetROP - dst = 1
NopROP - dst = dst
AndNotROP - dst = src AND (NOT dst)
OrNotROP - dst = src OR (NOT dst)
NandROP - dst = NOT (src AND dst)
NorROP - dst = NOT (src OR dst)
By far the most useful ones are CopyROP and XorROP.
On Qt/Embedded, only CopyROP, XorROP, and NotROP are supported.
This enum is used in widgets that can display both plain text and
rich text, e.g. QLabel. It is used for deciding whether a text
string should be interpreted as the one or the other. This is
normally done by passing one of the enum values to a setTextFormat()
function.
PlainText - The text string is interpreted as a normal text string.
RichText - The text string is interpreted as a rich text according to the current QStyleSheet::defaultSheet().
AutoText - The text string is interpreted as for RichText if QStyleSheet::mightBeRichText() returns TRUE, otherwise as for PlainText.
This enum type is used to specify various window-system properties
of the widget. Mostly they are fairly unusual, but necessary in a
few cases.
The main types are
WType_TopLevel - indicates that this widget is a top-level
widget, usually with a window-system frame and so on.
WType_Modal - indicates that this widget is a modal top-level
widget, ie. that it prevents widgets in all other top-level widget
from getting any input. WType_Modal inplies WStyle_Dialog.
WType_Popup - indicates that this widget is a popup top-level
window, ie. that it is modal, but has a window system frame
appropriate for popup menus.
WType_Desktop - indicates that this widget is the desktop.
See also WPaintDesktop below.
There are also a number of flags to let you customize the
appearance of top-level windows. These have no effect on other
windows.
WStyle_Customize - indicates that instead of the default, the
WStyle_* flags should be used to build the window.
WStyle_NormalBorder - gives the window a normal border. Cannot
be combined with WStyle_DialogBorder or WStyle_NoBorder.
WStyle_DialogBorder - gives the window a thin dialog border.
Cannot be combined with WStyle_NormalBorder or WStyle_NoBorder.
WStyle_NoBorder - gives a borderless window. Note that the
user cannot move or resize a borderless window via the window system.
Cannot be combined with WStyle_NormalBorder or WStyle_DialogBorder. On Windows, the flag works fine. On X11, it
bypasses the window manager completely. This results in a borderless
window, but also in a window that is not managed at all (i.e. for
example no keyboard focus unless you call setActiveWindow()
manually. ) For compatibility, the flag was not changed for Qt-2.1. We
suggest using WStyle_NoBorderEx instead.
WStyle_NoBorderEx - gives a borderless window. Note that the
user cannot move or resize a borderless window via the window system.
Cannot be combined with WStyle_NormalBorder or WStyle_DialogBorder. On X11, the result of the flag is depending on
the window manager and its ability to understand MOTIF hints to some
degree. Most existing modern window managers do this. With WX11BypassWM, you can bypass the window manager completely. This
results in a borderless window for sure, but also in a window that is
not managed at all (i.e. for example no keyboard input unless you call
setActiveWindow() manually )
WStyle_Title - gives the window a title bar.
WStyle_SysMenu - adds a window system menu.
WStyle_Minimize - adds a minimize button. Note that on Windows
this has to be combined with WStyle_SysMenu for it to work.
WStyle_Maximize - adds a maximize button. Note that on Windows
this has to be combined with WStyle_SysMenu for it to work.
WStyle_MinMax - is equal to WStyle_Minimize|WStyle_Maximize.
Note that on Windows this has to be combined with WStyle_SysMenu for
it to work.
WStyle_ContextHelp - adds a context help button to dialogs.
WStyle_Tool - makes the window a tool window. A tool window
is a small window that lives for a short time and it is typically used
for creating popup windows. It there is a parent, the tool window
will always be kept on top of it. If there isn't a parent, you may
consider passing WStyle_StaysOnTop as well. If the window system
supports it, a tool window is be decorated with a somewhat lighter
frame. It can, however, be combined with WStyle_NoBorder as well.
WStyle_StaysOnTop - informs the window system that the window
should stay on top of all other windows.
WStyle_Dialog - indicates that the window is a logical
subwindow of its parent, in other words: a dialog. The window will
not get its own taskbar entry and be kept on top of its parent by
the window system. Usually, it will also be minimized when the
parent is minimized. If not customized, the window is decorated
with a slightly simpler title bar. This is the flag QDialog uses.
Finally, there are some modifier flags:
WDestructiveClose - makes Qt delete this object when the object has
accepted closeEvent(), or when the widget tried to ignore closeEvent() but
could not.
WPaintDesktop - gives this widget paint events for the desktop.
WPaintUnclipped - makes all painters operating on this widget
unclipped. Children of this widget, or other widgets in front of it,
do not clip the area the painter can paint on.
WPaintClever - indicates that Qt should not try to optimize
repainting for the widget, but instead pass on window system repaint
events directly. (This tends to produce more events and smaller
repaint regions.)
WResizeNoErase - indicates that resizing the widget should not
erase it. This allows smart-repainting to avoid flicker.
WMouseNoMask - indicates that even if the widget has a mask,
it wants mouse events for its entire rectangle.
WNorthWestGravity - indicates that the widget contents is
north-west aligned and static. On resize, such a widget will receive
paint events only for the newly visible part of itself.
WRepaintNoErase - indicates that the widget paints all its
pixels. Updating, scrolling and focus changes should therefore not
erase the widget. This allows smart-repainting to avoid flicker.
WGroupLeader - makes this widget or window a group
leader. Modality of secondary windows only affects windows within the
same group.
Search the documentation, FAQ, qt-interest archive and more (uses
www.trolltech.com):
Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).
Qt dans le magazine
Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter
ou par MP !