| qaction.h |
|
255 |
- |
| qaction_widgets.cpp |
|
1990 |
- |
| qaction_widgets_p.h |
|
1190 |
- |
| qactiongroup.h |
|
260 |
- |
| qapplication.cpp |
|
147825 |
- |
| qapplication.h |
|
5205 |
- |
| qapplication_p.h |
|
7581 |
- |
| qboxlayout.cpp |
The purpose of this function is to make sure that widgets are not laid out outside its layout.
E.g. the layoutItemRect margins are only meant to take of the surrounding margins/spacings.
However, if the margin is 0, it can easily cover the area of a widget above it.
|
40287 |
- |
| qboxlayout.h |
|
2823 |
- |
| qformlayout.cpp |
|
78255 |
- |
| qformlayout.h |
|
4926 |
- |
| qgesture.cpp |
!
\class QGesture
\since 4.6
\ingroup gestures
\inmodule QtWidgets
\brief The QGesture class represents a gesture, containing properties that
describe the corresponding user input.
Gesture objects are not constructed directly by developers. They are created by
the QGestureRecognizer object that is registered with the application; see
QGestureRecognizer::registerRecognizer().
For an overview of gesture handling in Qt and information on using gestures
in your applications, see the \l{Gestures in Widgets and Graphics View} document.
\section1 Gesture Properties
The class has a list of properties that can be queried by the user to get
some gesture-specific arguments. For example, the pinch gesture has a scale
factor that is exposed as a property.
Developers of custom gesture recognizers can add additional properties in
order to provide additional information about a gesture. This can be done
by adding new dynamic properties to a QGesture object, or by subclassing
the QGesture class (or one of its subclasses).
\section1 Lifecycle of a Gesture Object
A QGesture instance is implicitly created when needed and is owned by Qt.
Developers should never destroy them or store them for later use as Qt may
destroy particular instances of them and create new ones to replace them.
The registered gesture recognizer monitors the input events for the target
object via its \l{QGestureRecognizer::}{recognize()} function, updating the
properties of the gesture object as required.
The gesture object may be delivered to the target object in a QGestureEvent if
the corresponding gesture is active or has just been canceled. Each event that
is delivered contains a list of gesture objects, since support for more than
one gesture may be enabled for the target object. Due to the way events are
handled in Qt, gesture events may be filtered by other objects.
\sa QGestureEvent, QGestureRecognizer
|
32331 |
- |
| qgesture.h |
|
8909 |
- |
| qgesture_p.h |
|
3732 |
- |
| qgesturemanager.cpp |
|
31414 |
- |
| qgesturemanager_p.h |
|
3524 |
- |
| qgesturerecognizer.cpp |
!
\class QGestureRecognizer
\since 4.6
\brief The QGestureRecognizer class provides the infrastructure for gesture recognition.
\ingroup gestures
\inmodule QtWidgets
Gesture recognizers are responsible for creating and managing QGesture objects and
monitoring input events sent to QWidget and QGraphicsObject subclasses.
QGestureRecognizer is the base class for implementing custom gestures.
Developers that only need to provide gesture recognition for standard gestures do not
need to use this class directly. Instances will be created behind the scenes by the
framework.
For an overview of gesture handling in Qt and information on using gestures
in your applications, see the \l{Gestures in Widgets and Graphics View} document.
\section1 Recognizing Gestures
The process of recognizing gestures involves filtering input events sent to specific
objects, and modifying the associated QGesture objects to include relevant information
about the user's input.
Gestures are created when the framework calls create() to handle user input
for a particular instance of a QWidget or QGraphicsObject subclass. A QGesture object
is created for each widget or item that is configured to use gestures.
Once a QGesture has been created for a target object, the gesture recognizer will
receive events for it in its recognize() handler function.
When a gesture is canceled, the reset() function is called, giving the recognizer the
chance to update the appropriate properties in the corresponding QGesture object.
\section1 Supporting New Gestures
To add support for new gestures, you need to derive from QGestureRecognizer to create
a custom recognizer class, construct an instance of this class, and register it with
the application by calling QGestureRecognizer::registerRecognizer(). You can also
subclass QGesture to create a custom gesture class, or rely on dynamic properties
to express specific details of the gesture you want to handle.
Your custom QGestureRecognizer subclass needs to reimplement the recognize()
function to handle and filter the incoming input events for QWidget and
QGraphicsObject subclasses. Although the logic for gesture recognition is
implemented in this function, you can store persistent information about the
state of the recognition process in the QGesture object supplied. The
recognize() function must return a value of QGestureRecognizer::Result that
indicates the state of recognition for a given gesture and target object.
This determines whether or not a gesture event will be delivered to a target
object.
If you choose to represent a gesture by a custom QGesture subclass, you will need to
reimplement the create() function to construct instances of your gesture class.
Similarly, you may need to reimplement the reset() function if your custom gesture
objects need to be specially handled when a gesture is canceled.
\sa QGesture
|
7929 |
- |
| qgesturerecognizer.h |
|
1504 |
- |
| qgridlayout.cpp |
Three internal classes related to QGridLayout: (1) QGridBox is a
QLayoutItem with (row, column) information and (torow, tocolumn) information; (3) QGridLayoutData is
the internal representation of a QGridLayout.
|
50354 |
- |
| qgridlayout.h |
|
3065 |
- |
| qlayout.cpp |
!
\class QLayout
\brief The QLayout class is the base class of geometry managers.
\ingroup geomanagement
\inmodule QtWidgets
This is an abstract base class inherited by the concrete classes
QBoxLayout, QGridLayout, QFormLayout, and QStackedLayout.
For users of QLayout subclasses or of QMainWindow there is seldom
any need to use the basic functions provided by QLayout, such as
setSizeConstraint() or setMenuBar(). See \l{Layout Management}
for more information.
To make your own layout manager, implement the functions
addItem(), sizeHint(), setGeometry(), itemAt() and takeAt(). You
should also implement minimumSize() to ensure your layout isn't
resized to zero size if there is too little space. To support
children whose heights depend on their widths, implement
hasHeightForWidth() and heightForWidth(). See the
\l{layouts/flowlayout}{Flow Layout} example for
more information about implementing custom layout managers.
Geometry management stops when the layout manager is deleted.
\sa QLayoutItem, {Layout Management}, {Basic Layouts Example},
{Flow Layout Example}
|
45871 |
- |
| qlayout.h |
|
4412 |
- |
| qlayout_p.h |
|
2175 |
- |
| qlayoutengine.cpp |
This is the main workhorse of the QGridLayout. It portions out
available space to the chain's children.
The calculation is done in fixed point: "fixed" variables are
scaled by a factor of 256.
If the layout runs "backwards" (i.e. RightToLeft or Up) the layout
is computed mirror-reversed, and it's the caller's responsibility
do reverse the values before use.
chain contains input and output parameters describing the geometry.
count is the count of items in the chain; pos and space give the
interval (relative to parentWidget topLeft).
|
14487 |
- |
| qlayoutengine_p.h |
Modify total maximum (max), total expansion (exp), and total empty
when adding boxmax/boxexp.
Expansive boxes win over non-expansive boxes.
Non-empty boxes win over empty boxes.
|
3101 |
- |
| qlayoutitem.cpp |
!
\class QLayoutItem
\brief The QLayoutItem class provides an abstract item that a
QLayout manipulates.
\ingroup geomanagement
\inmodule QtWidgets
This is used by custom layouts.
Pure virtual functions are provided to return information about
the layout, including, sizeHint(), minimumSize(), maximumSize()
and expandingDirections().
The layout's geometry can be set and retrieved with setGeometry()
and geometry(), and its alignment with setAlignment() and
alignment().
isEmpty() returns whether the layout item is empty. If the
concrete item is a QWidget, it can be retrieved using widget().
Similarly for layout() and spacerItem().
Some layouts have width and height interdependencies. These can
be expressed using hasHeightForWidth(), heightForWidth(), and
minimumHeightForWidth(). For more explanation see the \e{Qt
Quarterly} article
\l{http://doc.qt.io/archives/qq/qq04-height-for-width.html}{Trading
Height for Width}.
\sa QLayout
|
22731 |
- |
| qlayoutitem.h |
|
4152 |
- |
| qmacgesturerecognizer.cpp |
target |
8864 |
- |
| qmacgesturerecognizer_p.h |
|
1966 |
- |
| qohosgesturerecognizer.cpp |
|
4364 |
- |
| qohosgesturerecognizer_p.h |
|
715 |
- |
| qrhiwidget.cpp |
|
51088 |
- |
| qrhiwidget.h |
|
3113 |
- |
| qrhiwidget_p.h |
|
2022 |
- |
| qshortcut.h |
|
257 |
- |
| qshortcut_widgets.cpp |
! \internal
Returns \c true if the widget \a w is a logical sub window of the current
top-level widget.
|
11333 |
- |
| qsizepolicy.cpp |
!
\class QSizePolicy
\brief The QSizePolicy class is a layout attribute describing horizontal
and vertical resizing policy.
\ingroup geomanagement
\inmodule QtWidgets
The size policy of a widget is an expression of its willingness to
be resized in various ways, and affects how the widget is treated
by the \l{Layout Management}{layout engine}. Each widget returns a
QSizePolicy that describes the horizontal and vertical resizing
policy it prefers when being laid out. You can change this for
a specific widget by changing its QWidget::sizePolicy property.
QSizePolicy contains two independent QSizePolicy::Policy values
and two stretch factors; one describes the widgets's horizontal
size policy, and the other describes its vertical size policy. It
also contains a flag to indicate whether the height and width of
its preferred size are related.
The horizontal and vertical policies can be set in the
constructor, and altered using the setHorizontalPolicy() and
setVerticalPolicy() functions. The stretch factors can be set
using the setHorizontalStretch() and setVerticalStretch()
functions. The flag indicating whether the widget's
\l{QWidget::sizeHint()}{sizeHint()} is width-dependent (such as a
menu bar or a word-wrapping label) can be set using the
setHeightForWidth() function.
The current size policies and stretch factors be retrieved using
the horizontalPolicy(), verticalPolicy(), horizontalStretch() and
verticalStretch() functions. Alternatively, use the transpose()
function to swap the horizontal and vertical policies and
stretches. The hasHeightForWidth() function returns the current
status of the flag indicating the size hint dependencies.
Use the expandingDirections() function to determine whether the
associated widget can make use of more space than its
\l{QWidget::sizeHint()}{sizeHint()} function indicates, as well as
find out in which directions it can expand.
Finally, the QSizePolicy class provides operators comparing this
size policy to a given policy, as well as a QVariant operator
storing this QSizePolicy as a QVariant object.
\sa QSize, QWidget::sizeHint(), QWidget::sizePolicy,
QLayoutItem::sizeHint()
|
15051 |
- |
| qsizepolicy.h |
|
6419 |
- |
| qstackedlayout.cpp |
!
\class QStackedLayout
\brief The QStackedLayout class provides a stack of widgets where
only one widget is visible at a time.
\ingroup geomanagement
\inmodule QtWidgets
QStackedLayout can be used to create a user interface similar to
the one provided by QTabWidget. There is also a convenience
QStackedWidget class built on top of QStackedLayout.
A QStackedLayout can be populated with a number of child widgets
("pages"). For example:
\snippet qstackedlayout/main.cpp 0
\codeline
\snippet qstackedlayout/main.cpp 2
\snippet qstackedlayout/main.cpp 3
QStackedLayout provides no intrinsic means for the user to switch
page. This is typically done through a QComboBox or a QListWidget
that stores the titles of the QStackedLayout's pages. For
example:
\snippet qstackedlayout/main.cpp 1
When populating a layout, the widgets are added to an internal
list. The indexOf() function returns the index of a widget in that
list. The widgets can either be added to the end of the list using
the addWidget() function, or inserted at a given index using the
insertWidget() function. The removeWidget() function removes the
widget at the given index from the layout. The number of widgets
contained in the layout, can be obtained using the count()
function.
The widget() function returns the widget at a given index
position. The index of the widget that is shown on screen is given
by currentIndex() and can be changed using setCurrentIndex(). In a
similar manner, the currently shown widget can be retrieved using
the currentWidget() function, and altered using the
setCurrentWidget() function.
Whenever the current widget in the layout changes or a widget is
removed from the layout, the currentChanged() and widgetRemoved()
signals are emitted respectively.
\sa QStackedWidget, QTabWidget
|
15677 |
- |
| qstackedlayout.h |
|
1954 |
- |
| qstandardgestures.cpp |
|
20670 |
- |
| qstandardgestures_p.h |
|
2310 |
- |
| qt_widgets_pch.h |
This is a precompiled header file for use in Xcode / Mac GCC /
GCC >= 3.4 / VC to greatly speed the building of Qt. It may also be
of use to people developing their own project, but it is probably
better to define your own header. Use of this header is currently
UNSUPPORTED.
|
960 |
- |
| qtestsupport_widgets.cpp |
!
\since 5.0
\overload
The \a timeout is in milliseconds.
|
7905 |
- |
| qtestsupport_widgets.h |
|
2015 |
- |
| qtooltip.cpp |
!
\class QToolTip
\brief The QToolTip class provides tool tips (balloon help) for any
widget.
\ingroup helpsystem
\inmodule QtWidgets
The tip is a short piece of text reminding the user of the
widget's function. It is drawn immediately below the given
position in a distinctive black-on-yellow color combination. The
tip can be any \l{QTextEdit}{rich text} formatted string.
Rich text displayed in a tool tip is implicitly word-wrapped unless
specified differently with \c{<p style='white-space:pre'>}.
UI elements that are created via \l{QAction} use the tooltip property
of the QAction, so for most interactive UI elements, setting that
property is the easiest way to provide tool tips.
\snippet tooltips/main.cpp action_tooltip
For any other widgets, the simplest and most common way to set
a widget's tool tip is by calling its QWidget::setToolTip() function.
\snippet tooltips/main.cpp static_tooltip
It is also possible to show different tool tips for different
regions of a widget, by using a QHelpEvent of type
QEvent::ToolTip. Intercept the help event in your widget's \l
{QWidget::}{event()} function and call QToolTip::showText() with
the text you want to display.
\snippet tooltips/main.cpp dynamic_tooltip
If you are calling QToolTip::hideText(), or QToolTip::showText()
with an empty string, as a result of a \l{QEvent::}{ToolTip}-event you
should also call \l{QEvent::}{ignore()} on the event, to signal
that you don't want to start any tooltip specific modes.
Note that, if you want to show tooltips in an item view, the
model/view architecture provides functionality to set an item's
tool tip; e.g., the QTableWidgetItem::setToolTip() function.
However, if you want to provide custom tool tips in an item view,
you must intercept the help event in the
QAbstractItemView::viewportEvent() function and handle it yourself.
The default tool tip color and font can be customized with
setPalette() and setFont(). When a tooltip is currently on
display, isVisible() returns \c true and text() the currently visible
text.
\note Tool tips use the inactive color group of QPalette, because tool
tips are not active windows.
\sa QWidget::toolTip, QAction::toolTip
|
17664 |
- |
| qtooltip.h |
|
890 |
- |
| qtooltip_p.h |
|
1944 |
- |
| qtwidgetsglobal.h |
|
382 |
- |
| qtwidgetsglobal_p.h |
|
657 |
- |
| qwhatsthis.cpp |
!
\class QWhatsThis
\brief The QWhatsThis class provides a simple description of any
widget, i.e. answering the question "What's This?".
\ingroup helpsystem
\inmodule QtWidgets
"What's This?" help is part of an application's online help
system, and provides users with information about the
functionality and usage of a particular widget. "What's This?"
help texts are typically longer and more detailed than
\l{QToolTip}{tooltips}, but generally provide less information
than that supplied by separate help windows.
QWhatsThis provides a single window with an explanatory text that
pops up when the user asks "What's This?". The default way for
users to ask the question is to move the focus to the relevant
widget and press Shift+F1. The help text appears immediately; it
goes away as soon as the user does something else.
(Note that if there is a shortcut for Shift+F1, this mechanism
will not work.) Some dialogs provide a "?" button that users can
click to enter "What's This?" mode; they then click the relevant
widget to pop up the "What's This?" window. It is also possible to
provide a a menu option or toolbar button to switch into "What's
This?" mode.
To add "What's This?" text to a widget or an action, you simply
call QWidget::setWhatsThis() or QAction::setWhatsThis().
The text can be either rich text or plain text. If you specify a
rich text formatted string, it will be rendered using the default
stylesheet, making it possible to embed images in the displayed
text. To be as fast as possible, the default stylesheet uses a
simple method to determine whether the text can be rendered as
plain text. See Qt::mightBeRichText() for details.
\snippet whatsthis/whatsthis.cpp 0
An alternative way to enter "What's This?" mode is to call
createAction(), and add the returned QAction to either a menu or
a tool bar. By invoking this context help action (in the picture
below, the button with the arrow and question mark icon) the user
switches into "What's This?" mode. If they now click on a widget
the appropriate help text is shown. The mode is left when help is
given or when the user presses Esc.
\image whatsthis.png {"What's This?" mode for New File button}
You can enter "What's This?" mode programmatically with
enterWhatsThisMode(), check the mode with inWhatsThisMode(), and
return to normal mode with leaveWhatsThisMode().
If you want to control the "What's This?" behavior of a widget
manually see Qt::WA_CustomWhatsThis.
It is also possible to show different help texts for different
regions of a widget, by using a QHelpEvent of type
QEvent::WhatsThis. Intercept the help event in your widget's
QWidget::event() function and call QWhatsThis::showText() with the
text you want to display for the position specified in
QHelpEvent::pos(). If the text is rich text and the user clicks
on a link, the widget also receives a QWhatsThisClickedEvent with
the link's reference as QWhatsThisClickedEvent::href(). If a
QWhatsThisClickedEvent is handled (i.e. QWidget::event() returns
true), the help window remains visible. Call
QWhatsThis::hideText() to hide it explicitly.
\sa QToolTip
|
19277 |
- |
| qwhatsthis.h |
|
906 |
- |
| qwidget.cpp |
|
456595 |
- |
| qwidget.h |
|
30914 |
- |
| qwidget_p.h |
|
30290 |
- |
| qwidgetaction.cpp |
!
\class QWidgetAction
\since 4.2
\brief The QWidgetAction class extends QAction by an interface
for inserting custom widgets into action based containers, such
as toolbars.
\ingroup mainwindow-classes
\inmodule QtWidgets
Most actions in an application are represented as items in menus or
buttons in toolbars. However sometimes more complex widgets are
necessary. For example a zoom action in a word processor may be
realized using a QComboBox in a QToolBar, presenting a range
of different zoom levels. QToolBar provides QToolBar::insertWidget()
as convenience function for inserting a single widget.
However if you want to implement an action that uses custom
widgets for visualization in multiple containers then you have to
subclass QWidgetAction.
If a QWidgetAction is added for example to a QToolBar then
QWidgetAction::createWidget() is called. Reimplementations of that
function should create a new custom widget with the specified parent.
If the action is removed from a container widget then
QWidgetAction::deleteWidget() is called with the previously created custom
widget as argument. The default implementation hides the widget and deletes
it using QObject::deleteLater().
If you have only one single custom widget then you can set it as default
widget using setDefaultWidget(). That widget will then be used if the
action is added to a QToolBar, or in general to an action container that
supports QWidgetAction. If a QWidgetAction with only a default widget is
added to two toolbars at the same time then the default widget is shown
only in the first toolbar the action was added to. QWidgetAction takes
over ownership of the default widget.
Note that it is up to the widget to activate the action, for example by
reimplementing mouse event handlers and calling QAction::trigger().
\b {\macos}: If you add a widget to a menu in the application's menu
bar on \macos, the widget will be added and it will function but with some
limitations:
\list 1
\li The widget is reparented away from the QMenu to the native menu
view. If you show the menu in some other place (e.g. as a popup menu),
the widget will not be there.
\li Focus/Keyboard handling of the widget is not possible.
\li Due to Apple's design, mouse tracking on the widget currently does
not work.
\li Connecting the triggered() signal to a slot that opens a modal
dialog will cause a crash in \macos 10.4 (known bug acknowledged
by Apple), a workaround is to use a QueuedConnection instead of a
DirectConnection.
\endlist
\sa QAction, QActionGroup, QWidget
|
7872 |
- |
| qwidgetaction.h |
|
1118 |
- |
| qwidgetaction_p.h |
|
1172 |
- |
| qwidgetrepaintmanager.cpp |
!
\internal
Invalidates the \a r (in widget's coordinates) of the backing store, i.e.
all widgets intersecting with the region will be repainted when the backing
store is synced.
|
47931 |
- |
| qwidgetrepaintmanager_p.h |
|
3229 |
- |
| qwidgetsvariant.cpp |
|
898 |
- |
| qwidgetwindow.cpp |
|
47095 |
- |
| qwidgetwindow_p.h |
|
3035 |
- |
| qwindowcontainer.cpp |
Qt (e.g. QSplitter) sometimes prefer to hide a widget by *not* calling
setVisible(false). This is often done by setting its coordinates to a sufficiently
negative value so that its clipped outside the parent. Since a QWindow is not clipped
to widgets in general, it needs to be dealt with as a special case.
|
16243 |
- |
| qwindowcontainer_p.h |
|
1392 |
- |