summaryrefslogtreecommitdiffstats
path: root/src/widgets/doc
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/doc')
-rw-r--r--src/widgets/doc/snippets/javastyle.cpp2
-rw-r--r--src/widgets/doc/snippets/simplemodel-use/main.cpp7
-rw-r--r--src/widgets/doc/src/model-view-programming.qdoc13
-rw-r--r--src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc24
4 files changed, 38 insertions, 8 deletions
diff --git a/src/widgets/doc/snippets/javastyle.cpp b/src/widgets/doc/snippets/javastyle.cpp
index de3143f753..54a4ade921 100644
--- a/src/widgets/doc/snippets/javastyle.cpp
+++ b/src/widgets/doc/snippets/javastyle.cpp
@@ -2589,7 +2589,7 @@ int JavaStyle::styleHint(StyleHint hint, const QStyleOption *option,
switch (hint) {
case SH_Table_GridLineColor: {
- ret = static_cast<int>(option->palette.color(QPalette::Mid).rgb());
+ ret = static_cast<int>(option->palette.color(QPalette::Mid).rgba());
break;
}
case QStyle::SH_Menu_Scrollable:
diff --git a/src/widgets/doc/snippets/simplemodel-use/main.cpp b/src/widgets/doc/snippets/simplemodel-use/main.cpp
index 3e106c8eea..940669e101 100644
--- a/src/widgets/doc/snippets/simplemodel-use/main.cpp
+++ b/src/widgets/doc/snippets/simplemodel-use/main.cpp
@@ -79,8 +79,11 @@ int main(int argc, char *argv[])
//! [0]
QFileSystemModel *model = new QFileSystemModel;
- QModelIndex parentIndex = model->index(QDir::currentPath());
- int numRows = model->rowCount(parentIndex);
+ connect(model, &QFileSystemModel::directoryLoaded, [model](const QString &directory) {
+ QModelIndex parentIndex = model->index(directory);
+ int numRows = model->rowCount(parentIndex);
+ });
+ model->setRootPath(QDir::currentPath);
//! [0]
//! [1]
diff --git a/src/widgets/doc/src/model-view-programming.qdoc b/src/widgets/doc/src/model-view-programming.qdoc
index 236582ef3f..ede1ebf932 100644
--- a/src/widgets/doc/src/model-view-programming.qdoc
+++ b/src/widgets/doc/src/model-view-programming.qdoc
@@ -465,14 +465,19 @@
Although this does not show a normal way of using a model, it demonstrates
the conventions used by models when dealing with model indexes.
+ QFileSystemModel loading is asynchronous to minimize system resource use.
+ We have to take that into account when dealing with this model.
+
We construct a file system model in the following way:
\snippet simplemodel-use/main.cpp 0
- In this case, we set up a default QFileSystemModel, obtain a parent index
- using a specific implementation of \l{QFileSystemModel::}{index()}
- provided by that model, and we count the number of rows in the model using
- the \l{QFileSystemModel::}{rowCount()} function.
+ In this case, we start by setting up a default QFileSystemModel. We connect
+ it to a lambda, in which we will obtain a parent index using a specific
+ implementation of \l{QFileSystemModel::}{index()} provided by that model.
+ In the lambda, we count the number of rows in the model using the
+ \l{QFileSystemModel::}{rowCount()} function. Finally, we set the root path
+ of the QFileSystemModel so it starts loading data and triggers the lambda.
For simplicity, we are only interested in the items in the first column
of the model. We examine each row in turn, obtaining a model index for
diff --git a/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc b/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc
index 84233e4b62..35bad6786a 100644
--- a/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc
+++ b/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
@@ -59,6 +59,11 @@
\li \l{Qt Style Sheets Examples}
\endlist
+ \note If Qt Style Sheets are used on the same widget as functions that
+ set the appearance of widgets, such as \l QWidget::setFont() or
+ \l QTreeWidgetItem::setBackground(), style sheets will take precedence
+ if the settings conflict.
+
\target overview
\section1 Overview
@@ -988,6 +993,9 @@
\li Supports the \l{box model}. Supports the \l{#default-ps}{:default},
\l{#flat-ps}{:flat}, \l{#checked-ps}{:checked} pseudo states.
+ Since 5.15, the \l{#icon-prop}{icon} property can be set to
+ override the button icon.
+
For QPushButton with a menu, the menu indicator is styled
using the \l{#menu-indicator-sub}{::menu-indicator}
subcontrol. Appearance of checkable push buttons can be
@@ -1941,6 +1949,20 @@
See also \l{#width-prop}{width}.
\row
+ \li \b{\c icon} \target icon-prop
+ \li \l{#Url}{Url}+
+ \li The icon that is used, for widgets that have an icon.
+
+ The only widget currently supporting this property is QPushButton.
+
+ \note It's the application's responsibilty to assign an icon to a
+ button (using the QAbstractButton API), and not the style's. So be
+ careful setting it unless your stylesheet is targeting a specific
+ application.
+
+ Available since 5.15.
+
+ \row
\li \b{\c icon-size} \target icon-size-prop
\li \l{#Length}{Length}
\li The width and height of the icon in a widget.