summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2019-12-03 06:55:21 +0100
committerLiang Qi <liang.qi@qt.io>2019-12-03 06:57:05 +0100
commite62d04b933a91c2bdd347aa97dc15ba210a04d2a (patch)
tree67c67af5f59d9b71522738da8a8d2d803e3ff44f /src/widgets
parentf81f21151d30a37f955aa4af2398a96507626b15 (diff)
parent9ac156c90b92a981f70929e081c64083b14e9a57 (diff)
Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts: src/corelib/serialization/qcborvalue.cpp Change-Id: I675a3029955c96e81a33ed9d98b72b55b6784b52
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/itemviews/qtreeview.cpp2
-rw-r--r--src/widgets/kernel/qwidget.cpp11
-rw-r--r--src/widgets/styles/qstylehelper.cpp9
-rw-r--r--src/widgets/widgets/qlineedit.cpp33
4 files changed, 40 insertions, 15 deletions
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index 034c1f4b4f..442369c2ec 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -1892,6 +1892,8 @@ void QTreeView::mousePressEvent(QMouseEvent *event)
handled = d->expandOrCollapseItemAtPos(event->pos());
if (!handled && d->itemDecorationAt(event->pos()) == -1)
QAbstractItemView::mousePressEvent(event);
+ else
+ d->pressedIndex = QModelIndex();
}
/*!
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index e96e06d874..9099805cf8 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -7005,8 +7005,10 @@ void QWidget::resize(const QSize &s)
d->setGeometry_sys(geometry().x(), geometry().y(), s.width(), s.height(), false);
d->setDirtyOpaqueRegion();
} else {
+ const auto oldRect = data->crect;
data->crect.setSize(s.boundedTo(maximumSize()).expandedTo(minimumSize()));
- setAttribute(Qt::WA_PendingResizeEvent);
+ if (oldRect != data->crect)
+ setAttribute(Qt::WA_PendingResizeEvent);
}
}
@@ -7021,10 +7023,13 @@ void QWidget::setGeometry(const QRect &r)
d->setGeometry_sys(r.x(), r.y(), r.width(), r.height(), true);
d->setDirtyOpaqueRegion();
} else {
+ const auto oldRect = data->crect;
data->crect.setTopLeft(r.topLeft());
data->crect.setSize(r.size().boundedTo(maximumSize()).expandedTo(minimumSize()));
- setAttribute(Qt::WA_PendingMoveEvent);
- setAttribute(Qt::WA_PendingResizeEvent);
+ if (oldRect != data->crect) {
+ setAttribute(Qt::WA_PendingMoveEvent);
+ setAttribute(Qt::WA_PendingResizeEvent);
+ }
}
if (d->extra && d->extra->hasWindowContainer)
diff --git a/src/widgets/styles/qstylehelper.cpp b/src/widgets/styles/qstylehelper.cpp
index 4e61b2d1ec..9477ca86da 100644
--- a/src/widgets/styles/qstylehelper.cpp
+++ b/src/widgets/styles/qstylehelper.cpp
@@ -274,6 +274,12 @@ void drawDial(const QStyleOptionSlider *option, QPainter *painter)
painter->drawLines(QStyleHelper::calcLines(option));
}
+ // setting color before BEGIN_STYLE_PIXMAPCACHE since
+ // otherwise it is not set when the image is in the cache
+ buttonColor.setHsv(buttonColor .hue(),
+ qMin(140, buttonColor .saturation()),
+ qMax(180, buttonColor.value()));
+
// Cache dial background
BEGIN_STYLE_PIXMAPCACHE(QString::fromLatin1("qdial"));
p->setRenderHint(QPainter::Antialiasing);
@@ -285,9 +291,6 @@ void drawDial(const QStyleOptionSlider *option, QPainter *painter)
QRectF br = QRectF(dx + 0.5, dy + 0.5,
int(r * 2 - 2 * d_ - 2),
int(r * 2 - 2 * d_ - 2));
- buttonColor.setHsv(buttonColor .hue(),
- qMin(140, buttonColor .saturation()),
- qMax(180, buttonColor.value()));
if (enabled) {
// Drop shadow
diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp
index 92f43a309d..dc767cdae6 100644
--- a/src/widgets/widgets/qlineedit.cpp
+++ b/src/widgets/widgets/qlineedit.cpp
@@ -1198,12 +1198,18 @@ QMargins QLineEdit::textMargins() const
Unset the mask and return to normal QLineEdit operation by passing
an empty string ("").
- The table below shows the characters that can be used in an input mask.
- A space character, the default character for a blank, is needed for cases
- where a character is \e{permitted but not required}.
+ The input mask is an input template string. It can contain the following elements:
+ \table
+ \row \li Mask Characters \li Defines the class of input characters that are
+ considered valid in this position
+ \row \li Meta Characters \li Various special meanings
+ \row \li Separators \li All other characters are regarded as immutable separators
+ \endtable
+
+ The following table shows the mask and meta characters that can be used in an input mask.
\table
- \header \li Character \li Meaning
+ \header \li Mask Character \li Meaning
\row \li \c A \li ASCII alphabetic character required. A-Z, a-z.
\row \li \c a \li ASCII alphabetic character permitted but not required.
\row \li \c N \li ASCII alphanumeric character required. A-Z, a-z, 0-9.
@@ -1219,19 +1225,28 @@ QMargins QLineEdit::textMargins() const
\row \li \c h \li Hexadecimal character permitted but not required.
\row \li \c B \li Binary character required. 0-1.
\row \li \c b \li Binary character permitted but not required.
+ \header \li Meta Character \li Meaning
\row \li \c > \li All following alphabetic characters are uppercased.
\row \li \c < \li All following alphabetic characters are lowercased.
\row \li \c ! \li Switch off case conversion.
+ \row \li \c {;c} \li Terminates the input mask and sets the \e{blank} character to \e{c}.
\row \li \c {[ ] { }} \li Reserved.
\row \li \tt{\\} \li Use \tt{\\} to escape the special
characters listed above to use them as
separators.
\endtable
- The mask consists of a string of mask characters and separators,
- optionally followed by a semicolon and the character used for
- blanks. The blank characters are always removed from the text
- after editing.
+ When created or cleared, the line edit will be filled with a copy of the
+ input mask string where the meta characters have been removed, and the mask
+ characters have been replaced with the \e{blank} character (by default, a
+ \c space).
+
+ When an input mask is set, the text() method returns a modified copy of the
+ line edit content where all the \e{blank} characters have been removed. The
+ unmodified content can be read using displayText().
+
+ The hasAcceptableInput() method returns false if the current content of the
+ line edit does not fulfil the requirements of the input mask.
Examples:
\table
@@ -1240,7 +1255,7 @@ QMargins QLineEdit::textMargins() const
\row \li \c HH:HH:HH:HH:HH:HH;_ \li MAC address
\row \li \c 0000-00-00 \li ISO Date; blanks are \c space
\row \li \c >AAAAA-AAAAA-AAAAA-AAAAA-AAAAA;# \li License number;
- blanks are \c - and all (alphabetic) characters are converted to
+ blanks are \c{#} and all (alphabetic) characters are converted to
uppercase.
\endtable