summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-11-30 08:28:20 +0100
committerLiang Qi <liang.qi@qt.io>2017-11-30 09:16:58 +0100
commit87204c856ae3d8495c41af998ac196a12fe1c779 (patch)
tree5af64eaa3acde506d19fe4ab1c88b028a2197adf /src/widgets
parent498ef7f9d77fca75bcba2f657aaac38c8dc78aea (diff)
parentd0812cbdabcff4d388334c499c23992cce98d4da (diff)
Merge remote-tracking branch 'origin/5.10' into dev
Conflicts: src/corelib/thread/qsemaphore.cpp tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp Change-Id: Id35b535e88df63fdfe4007ea92ed4a39c4b6d707
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/Qt5WidgetsMacros.cmake3
-rw-r--r--src/widgets/doc/images/stardelegate.pngbin12230 -> 21528 bytes
-rw-r--r--src/widgets/itemviews/qheaderview.cpp34
-rw-r--r--src/widgets/itemviews/qtableview.cpp3
-rw-r--r--src/widgets/itemviews/qtreeview.cpp24
-rw-r--r--src/widgets/styles/qfusionstyle.cpp6
-rw-r--r--src/widgets/widgets/qtoolbar.cpp2
7 files changed, 41 insertions, 31 deletions
diff --git a/src/widgets/Qt5WidgetsMacros.cmake b/src/widgets/Qt5WidgetsMacros.cmake
index f5e7b7f050..737371a5ad 100644
--- a/src/widgets/Qt5WidgetsMacros.cmake
+++ b/src/widgets/Qt5WidgetsMacros.cmake
@@ -59,6 +59,9 @@ function(QT5_WRAP_UI outfiles )
COMMAND ${Qt5Widgets_UIC_EXECUTABLE}
ARGS ${ui_options} -o ${outfile} ${infile}
MAIN_DEPENDENCY ${infile} VERBATIM)
+ set_source_files_properties(${infile} PROPERTIES SKIP_AUTOUIC ON)
+ set_source_files_properties(${outfile} PROPERTIES SKIP_AUTOMOC ON)
+ set_source_files_properties(${outfile} PROPERTIES SKIP_AUTOUIC ON)
list(APPEND ${outfiles} ${outfile})
endforeach()
set(${outfiles} ${${outfiles}} PARENT_SCOPE)
diff --git a/src/widgets/doc/images/stardelegate.png b/src/widgets/doc/images/stardelegate.png
index 24fa9fb0d7..66f55c5fc7 100644
--- a/src/widgets/doc/images/stardelegate.png
+++ b/src/widgets/doc/images/stardelegate.png
Binary files differ
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp
index 463ed7e58c..c7966f624f 100644
--- a/src/widgets/itemviews/qheaderview.cpp
+++ b/src/widgets/itemviews/qheaderview.cpp
@@ -2086,40 +2086,26 @@ void QHeaderViewPrivate::_q_layoutChanged()
{
Q_Q(QHeaderView);
viewport->update();
- if (persistentHiddenSections.isEmpty() || modelIsEmpty()) {
- if (modelSectionCount() != sectionCount())
- q->initializeSections();
- persistentHiddenSections.clear();
+
+ const auto hiddenSections = persistentHiddenSections;
+ persistentHiddenSections.clear();
+
+ clear();
+ q->initializeSections();
+ invalidateCachedSizeHint();
+
+ if (modelIsEmpty()) {
return;
}
- QBitArray oldSectionHidden = sectionsHiddenToBitVector();
- oldSectionHidden.resize(sectionItems.size());
- bool sectionCountChanged = false;
-
- for (int i = 0; i < persistentHiddenSections.count(); ++i) {
- QModelIndex index = persistentHiddenSections.at(i);
+ for (const auto &index : hiddenSections) {
if (index.isValid()) {
const int logical = (orientation == Qt::Horizontal
? index.column()
: index.row());
q->setSectionHidden(logical, true);
- oldSectionHidden.setBit(logical, false);
- } else if (!sectionCountChanged && (modelSectionCount() != sectionCount())) {
- sectionCountChanged = true;
- break;
}
}
- persistentHiddenSections.clear();
-
- for (int i = 0; i < oldSectionHidden.count(); ++i) {
- if (oldSectionHidden.testBit(i))
- q->setSectionHidden(i, false);
- }
-
- // the number of sections changed; we need to reread the state of the model
- if (sectionCountChanged)
- q->initializeSections();
}
/*!
diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp
index d42ed0ad19..fd3bdfd065 100644
--- a/src/widgets/itemviews/qtableview.cpp
+++ b/src/widgets/itemviews/qtableview.cpp
@@ -1397,6 +1397,9 @@ void QTableView::paintEvent(QPaintEvent *event)
} else {
dirtyArea.setRight(qMin(dirtyArea.right(), int(x)));
}
+ // dirtyArea may be invalid when the horizontal header is not stretched
+ if (!dirtyArea.isValid())
+ continue;
// get the horizontal start and end visual sections
int left = horizontalHeader->visualIndexAt(dirtyArea.left());
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index d504263bd1..6ea180dcf2 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -736,7 +736,10 @@ void QTreeView::dataChanged(const QModelIndex &topLeft, const QModelIndex &botto
void QTreeView::hideColumn(int column)
{
Q_D(QTreeView);
+ if (d->header->isSectionHidden(column))
+ return;
d->header->hideSection(column);
+ doItemsLayout();
}
/*!
@@ -747,7 +750,10 @@ void QTreeView::hideColumn(int column)
void QTreeView::showColumn(int column)
{
Q_D(QTreeView);
+ if (!d->header->isSectionHidden(column))
+ return;
d->header->showSection(column);
+ doItemsLayout();
}
/*!
@@ -1008,11 +1014,16 @@ void QTreeView::keyboardSearch(const QString &search)
if (!d->model->rowCount(d->root) || !d->model->columnCount(d->root))
return;
+ // Do a relayout nows, so that we can utilize viewItems
+ d->executePostedLayout();
+ if (d->viewItems.isEmpty())
+ return;
+
QModelIndex start;
if (currentIndex().isValid())
start = currentIndex();
else
- start = d->model->index(0, 0, d->root);
+ start = d->viewItems.at(0).index;
bool skipRow = false;
bool keyboardTimeWasValid = d->keyboardInputTime.isValid();
@@ -1040,13 +1051,16 @@ void QTreeView::keyboardSearch(const QString &search)
// skip if we are searching for the same key or a new search started
if (skipRow) {
- if (indexBelow(start).isValid())
+ if (indexBelow(start).isValid()) {
start = indexBelow(start);
- else
- start = d->model->index(0, start.column(), d->root);
+ } else {
+ const int origCol = start.column();
+ start = d->viewItems.at(0).index;
+ if (origCol != start.column())
+ start = start.sibling(start.row(), origCol);
+ }
}
- d->executePostedLayout();
int startIndex = d->viewIndex(start);
if (startIndex <= -1)
return;
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp
index 074aa3ecec..e002b49d25 100644
--- a/src/widgets/styles/qfusionstyle.cpp
+++ b/src/widgets/styles/qfusionstyle.cpp
@@ -476,8 +476,10 @@ void QFusionStyle::drawPrimitive(PrimitiveElement elem,
break;
if (option->state & State_Open)
drawPrimitive(PE_IndicatorArrowDown, option, painter, widget);
- else
- drawPrimitive(PE_IndicatorArrowRight, option, painter, widget);
+ else {
+ const bool reverse = (option->direction == Qt::RightToLeft);
+ drawPrimitive(reverse ? PE_IndicatorArrowLeft : PE_IndicatorArrowRight, option, painter, widget);
+ }
break;
}
#if QT_CONFIG(tabbar)
diff --git a/src/widgets/widgets/qtoolbar.cpp b/src/widgets/widgets/qtoolbar.cpp
index 1c6d41ee2f..a00557c34e 100644
--- a/src/widgets/widgets/qtoolbar.cpp
+++ b/src/widgets/widgets/qtoolbar.cpp
@@ -1119,6 +1119,8 @@ static bool waitForPopup(QToolBar *tb, QWidget *popup)
static void enableMacToolBar(QToolBar *toolbar, bool enable)
{
QPlatformNativeInterface *nativeInterface = QApplication::platformNativeInterface();
+ if (!nativeInterface)
+ return;
QPlatformNativeInterface::NativeResourceForIntegrationFunction function =
nativeInterface->nativeResourceFunctionForIntegration("setContentBorderAreaEnabled");
if (!function)