| qcolormap.cpp |
screen |
5385 |
- |
| qcolormap.h |
|
1164 |
- |
| qcolormap.qdoc |
|
2552 |
- |
| qcompleter.cpp |
!
\class QCompleter
\brief The QCompleter class provides completions based on an item model.
\since 4.2
\inmodule QtWidgets
You can use QCompleter to provide auto completions in any Qt
widget, such as QLineEdit and QComboBox.
When the user starts typing a word, QCompleter suggests possible ways of
completing the word, based on a word list. The word list is
provided as a QAbstractItemModel. (For simple applications, where
the word list is static, you can pass a QStringList to
QCompleter's constructor.)
\section1 Basic Usage
A QCompleter is used typically with a QLineEdit or QComboBox.
For example, here's how to provide auto completions from a simple
word list in a QLineEdit:
\snippet code/src_gui_util_qcompleter.cpp 0
A QFileSystemModel can be used to provide auto completion of file names.
For example:
\snippet code/src_gui_util_qcompleter.cpp 1
To set the model on which QCompleter should operate, call
setModel(). By default, QCompleter will attempt to match the \l
{completionPrefix}{completion prefix} (i.e., the word that the
user has started typing) against the Qt::EditRole data stored in
column 0 in the model case sensitively. This can be changed
using setCompletionRole(), setCompletionColumn(), and
setCaseSensitivity().
If the model is sorted on the column and role that are used for completion,
you can call setModelSorting() with either
QCompleter::CaseSensitivelySortedModel or
QCompleter::CaseInsensitivelySortedModel as the argument. On large models,
this can lead to significant performance improvements, because QCompleter
can then use binary search instead of linear search. The binary search only
works when the filterMode is Qt::MatchStartsWith.
The model can be a \l{QAbstractListModel}{list model},
a \l{QAbstractTableModel}{table model}, or a
\l{QAbstractItemModel}{tree model}. Completion on tree models
is slightly more involved and is covered in the \l{Handling
Tree Models} section below.
The completionMode() determines the mode used to provide completions to
the user.
\section1 Iterating Through Completions
To retrieve a single candidate string, call setCompletionPrefix()
with the text that needs to be completed and call
currentCompletion(). You can iterate through the list of
completions as below:
\snippet code/src_gui_util_qcompleter.cpp 2
completionCount() returns the total number of completions for the
current prefix. completionCount() should be avoided when possible,
since it requires a scan of the entire model.
\section1 The Completion Model
completionModel() return a list model that contains all possible
completions for the current completion prefix, in the order in which
they appear in the model. This model can be used to display the current
completions in a custom view. Calling setCompletionPrefix() automatically
refreshes the completion model.
\section1 Handling Tree Models
QCompleter can look for completions in tree models, assuming
that any item (or sub-item or sub-sub-item) can be unambiguously
represented as a string by specifying the path to the item. The
completion is then performed one level at a time.
Let's take the example of a user typing in a file system path.
The model is a (hierarchical) QFileSystemModel. The completion
occurs for every element in the path. For example, if the current
text is \c C:\Wind, QCompleter might suggest \c Windows to
complete the current path element. Similarly, if the current text
is \c C:\Windows\Sy, QCompleter might suggest \c System.
For this kind of completion to work, QCompleter needs to be able to
split the path into a list of strings that are matched at each level.
For \c C:\Windows\Sy, it needs to be split as "C:", "Windows" and "Sy".
The default implementation of splitPath(), splits the completionPrefix
using QDir::separator() if the model is a QFileSystemModel.
To provide completions, QCompleter needs to know the path from an index.
This is provided by pathFromIndex(). The default implementation of
pathFromIndex(), returns the data for the \l{Qt::EditRole}{edit role}
for list models and the absolute file path if the mode is a QFileSystemModel.
\sa QAbstractItemModel, QLineEdit, QComboBox, {Completer Example}
|
59060 |
- |
| qcompleter.h |
|
4075 |
- |
| qcompleter_p.h |
|
7157 |
- |
| qflickgesture.cpp |
|
22036 |
- |
| qflickgesture_p.h |
|
1798 |
- |
| qscroller.cpp |
|
69477 |
- |
| qscroller.h |
|
3079 |
- |
| qscroller_p.h |
|
5313 |
- |
| qscrollerproperties.cpp |
!
\class QScrollerProperties
\brief The QScrollerProperties class stores the settings for a QScroller.
\since 4.8
\inmodule QtWidgets
The QScrollerProperties class stores the parameters used by QScroller.
The default settings are platform dependent so that Qt emulates the
platform behaviour for kinetic scrolling.
As a convention the QScrollerProperties are in physical units (meter,
seconds) and are converted by QScroller using the current DPI.
\sa QScroller
|
16362 |
- |
| qscrollerproperties.h |
|
3413 |
- |
| qscrollerproperties_p.h |
|
1599 |
- |
| qsystemtrayicon.cpp |
!
\class QSystemTrayIcon
\brief The QSystemTrayIcon class provides an icon for an application in the system tray.
\since 4.2
\ingroup desktop
\inmodule QtWidgets
Modern operating systems usually provide a special area on the desktop,
called the \e{system tray} or \e{notification area}, where long-running
applications can display icons and short messages.
\image system-tray.webp The system tray on Windows 10.
The QSystemTrayIcon class can be used on the following platforms:
\list
\li All supported versions of Windows.
\li All Linux desktop environments that implement the D-Bus
\l{http://www.freedesktop.org/wiki/Specifications/StatusNotifierItem/StatusNotifierItem}
{StatusNotifierItem specification}, including KDE, Gnome, Xfce, LXQt, and DDE.
\li All window managers and independent tray implementations for X11 that implement the
\l{http://standards.freedesktop.org/systemtray-spec/systemtray-spec-0.2.html}
{freedesktop.org XEmbed system tray specification}.
\li All supported versions of \macos.
\endlist
To check whether a system tray is present on the user's desktop,
call the QSystemTrayIcon::isSystemTrayAvailable() static function.
To add a system tray entry, create a QSystemTrayIcon object, call setContextMenu()
to provide a context menu for the icon, and call show() to make it visible in the
system tray. Status notification messages ("balloon messages") can be displayed at
any time using showMessage().
If the system tray is unavailable when a system tray icon is constructed, but
becomes available later, QSystemTrayIcon will automatically add an entry for the
application in the system tray if the icon is \l visible.
The activated() signal is emitted when the user activates the icon.
Only on X11, when a tooltip is requested, the QSystemTrayIcon receives a QHelpEvent
of type QEvent::ToolTip. Additionally, the QSystemTrayIcon receives wheel events of
type QEvent::Wheel. These are not supported on any other platform. Note: Since GNOME
Shell version 3.26, not all QSystemTrayIcon::ActivationReason are supported by the
system without shell extensions installed.
\sa QDesktopServices, {Desktop Integration}, {System Tray Icon Example}
|
22283 |
- |
| qsystemtrayicon.h |
|
2370 |
- |
| qsystemtrayicon_p.h |
|
2990 |
- |
| qsystemtrayicon_qpa.cpp |
|
2660 |
- |
| qsystemtrayicon_x11.cpp |
|
8616 |
- |
| qundogroup.h |
|
350 |
- |
| qundostack.h |
|
350 |
- |
| qundoview.cpp |
|
10318 |
- |
| qundoview.h |
|
1402 |
- |