summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-03-02 01:00:10 +0100
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-03-02 01:00:10 +0100
commit6cf3428a43c5744096db0c849aa975c4cb06bd31 (patch)
treef7961a992461793ea40781516903c5dd629fe1e5 /src/widgets
parent529cb7217c0162c31ef6f309730e93612b9798d3 (diff)
parentb3e91b66b9175c1c3ff5f73f3ac231f74f9bf932 (diff)
Merge remote-tracking branch 'origin/5.11' into dev
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/itemviews/qheaderview.cpp8
-rw-r--r--src/widgets/kernel/qtooltip.cpp12
2 files changed, 16 insertions, 4 deletions
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp
index b0359de3ea..708b9b44ca 100644
--- a/src/widgets/itemviews/qheaderview.cpp
+++ b/src/widgets/itemviews/qheaderview.cpp
@@ -2163,9 +2163,11 @@ void QHeaderViewPrivate::_q_sectionsAboutToBeChanged()
layoutChangePersistentSections.clear();
layoutChangePersistentSections.reserve(std::min(10, sectionItems.count()));
// after layoutChanged another section can be last stretched section
- if (stretchLastSection) {
+ if (stretchLastSection && lastSectionLogicalIdx >= 0 && lastSectionLogicalIdx < sectionItems.count()) {
const int visual = visualIndex(lastSectionLogicalIdx);
- sectionItems[visual].size = lastSectionSize;
+ if (visual >= 0 && visual < sectionItems.size()) {
+ sectionItems[visual].size = lastSectionSize;
+ }
}
for (int i = 0; i < sectionItems.size(); ++i) {
auto s = sectionItems.at(i);
@@ -4045,7 +4047,7 @@ bool QHeaderViewPrivate::read(QDataStream &in)
QVector<SectionItem> newSectionItems;
for (int u = 0; u < sectionItemsIn.count(); ++u) {
int count = sectionItemsIn.at(u).tmpDataStreamSectionCount;
- if (count > 0)
+ if (count > 1)
sectionItemsIn[u].size /= count;
for (int n = 0; n < count; ++n)
newSectionItems.append(sectionItemsIn[u]);
diff --git a/src/widgets/kernel/qtooltip.cpp b/src/widgets/kernel/qtooltip.cpp
index 1057c9b842..b10ccdd9fe 100644
--- a/src/widgets/kernel/qtooltip.cpp
+++ b/src/widgets/kernel/qtooltip.cpp
@@ -127,6 +127,8 @@ public:
~QTipLabel();
static QTipLabel *instance;
+ void updateSize();
+
bool eventFilter(QObject *, QEvent *) override;
QBasicTimer hideTimer, expireTimer;
@@ -214,13 +216,18 @@ void QTipLabel::reuseTip(const QString &text, int msecDisplayTime)
setWordWrap(Qt::mightBeRichText(text));
setText(text);
+ updateSize();
+ restartExpireTimer(msecDisplayTime);
+}
+
+void QTipLabel::updateSize()
+{
QFontMetrics fm(font());
QSize extra(1, 0);
// Make it look good with the default ToolTip font on Mac, which has a small descent.
if (fm.descent() == 2 && fm.ascent() >= 11)
++extra.rheight();
resize(sizeHint() + extra);
- restartExpireTimer(msecDisplayTime);
}
void QTipLabel::paintEvent(QPaintEvent *ev)
@@ -387,6 +394,9 @@ void QTipLabel::placeTip(const QPoint &pos, QWidget *w)
if (w) {
connect(w, SIGNAL(destroyed()),
QTipLabel::instance, SLOT(styleSheetParentDestroyed()));
+ // QTBUG-64550: A font inherited by the style sheet might change the size,
+ // particular on Windows, where the tip is not parented on a window.
+ QTipLabel::instance->updateSize();
}
}
#endif //QT_NO_STYLE_STYLESHEET