summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/Qt5CoreMacros.cmake9
-rw-r--r--src/corelib/global/qfloat16.h15
-rw-r--r--src/corelib/io/qstandardpaths_win.cpp13
-rw-r--r--src/gui/image/qplatformpixmap.cpp3
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp4
-rw-r--r--src/gui/kernel/qwindowsysteminterface.h1
-rw-r--r--src/network/access/qnetworkaccessmanager.cpp24
-rw-r--r--src/platformsupport/themes/genericunix/qgenericunixthemes.cpp8
-rw-r--r--src/plugins/platforms/ios/qiosapplicationstate.mm6
-rw-r--r--src/plugins/platforms/ios/qioscontext.mm11
-rw-r--r--src/plugins/platforms/ios/qiosglobal.h2
-rw-r--r--src/plugins/platforms/ios/qiosglobal.mm2
-rw-r--r--src/plugins/platforms/ios/qioswindow.mm27
-rw-r--r--src/plugins/platforms/ios/quiview.mm2
-rw-r--r--src/widgets/Qt5WidgetsMacros.cmake3
-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
20 files changed, 130 insertions, 69 deletions
diff --git a/src/corelib/Qt5CoreMacros.cmake b/src/corelib/Qt5CoreMacros.cmake
index 489bc75511..8b65db95cb 100644
--- a/src/corelib/Qt5CoreMacros.cmake
+++ b/src/corelib/Qt5CoreMacros.cmake
@@ -137,6 +137,9 @@ function(QT5_CREATE_MOC_COMMAND infile outfile moc_flags moc_options moc_target
DEPENDS ${infile} ${moc_depends}
${_moc_working_dir}
VERBATIM)
+ set_source_files_properties(${infile} PROPERTIES SKIP_AUTOMOC ON)
+ set_source_files_properties(${outfile} PROPERTIES SKIP_AUTOMOC ON)
+ set_source_files_properties(${outfile} PROPERTIES SKIP_AUTOUIC ON)
endfunction()
@@ -155,7 +158,6 @@ function(QT5_GENERATE_MOC infile outfile )
set(moc_target ${ARGV3})
endif()
qt5_create_moc_command(${abs_infile} ${_outfile} "${moc_flags}" "" "${moc_target}" "")
- set_source_files_properties(${outfile} PROPERTIES SKIP_AUTOMOC TRUE) # dont run automoc on this file
endfunction()
@@ -246,6 +248,7 @@ function(QT5_ADD_BINARY_RESOURCES target )
get_filename_component(infile ${it} ABSOLUTE)
_QT5_PARSE_QRC_FILE(${infile} _out_depends _rc_depends)
+ set_source_files_properties(${infile} PROPERTIES SKIP_AUTORCC ON)
set(infiles ${infiles} ${infile})
set(out_depends ${out_depends} ${_out_depends})
set(rc_depends ${rc_depends} ${_rc_depends})
@@ -255,7 +258,6 @@ function(QT5_ADD_BINARY_RESOURCES target )
COMMAND ${Qt5Core_RCC_EXECUTABLE}
ARGS ${rcc_options} --binary --name ${target} --output ${rcc_destination} ${infiles}
DEPENDS ${rc_depends} ${out_depends} VERBATIM)
-
add_custom_target(${target} ALL DEPENDS ${rcc_destination})
endfunction()
@@ -283,12 +285,15 @@ function(QT5_ADD_RESOURCES outfiles )
set(outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${outfilename}.cpp)
_QT5_PARSE_QRC_FILE(${infile} _out_depends _rc_depends)
+ set_source_files_properties(${infile} PROPERTIES SKIP_AUTORCC ON)
add_custom_command(OUTPUT ${outfile}
COMMAND ${Qt5Core_RCC_EXECUTABLE}
ARGS ${rcc_options} --name ${outfilename} --output ${outfile} ${infile}
MAIN_DEPENDENCY ${infile}
DEPENDS ${_rc_depends} "${out_depends}" VERBATIM)
+ 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/corelib/global/qfloat16.h b/src/corelib/global/qfloat16.h
index a36852fc22..72e28edf63 100644
--- a/src/corelib/global/qfloat16.h
+++ b/src/corelib/global/qfloat16.h
@@ -44,7 +44,16 @@
#include <QtCore/qmetatype.h>
#include <string.h>
-#if defined __F16C__
+#if defined(QT_COMPILER_SUPPORTS_F16C) && defined(__AVX2__) && !defined(__F16C__)
+// All processors that support AVX2 do support F16C too. That doesn't mean
+// we're allowed to use the intrinsics directly, so we'll do it only for
+// the Intel and Microsoft's compilers.
+# if defined(Q_CC_INTEL) || defined(Q_CC_MSVC)
+# define __F16C__ 1
+# endif
+#endif
+
+#if defined(QT_COMPILER_SUPPORTS_F16C) && defined(__F16C__)
#include <immintrin.h>
#endif
@@ -116,7 +125,7 @@ QT_WARNING_DISABLE_CLANG("-Wc99-extensions")
QT_WARNING_DISABLE_GCC("-Wold-style-cast")
inline qfloat16::qfloat16(float f) Q_DECL_NOTHROW
{
-#if defined(QT_COMPILER_SUPPORTS_F16C) && (defined(__F16C__) || defined(__AVX2__))
+#if defined(QT_COMPILER_SUPPORTS_F16C) && defined(__F16C__)
__m128 packsingle = _mm_set_ss(f);
__m128i packhalf = _mm_cvtps_ph(packsingle, 0);
b16 = _mm_extract_epi16(packhalf, 0);
@@ -134,7 +143,7 @@ QT_WARNING_POP
inline qfloat16::operator float() const Q_DECL_NOTHROW
{
-#if defined(QT_COMPILER_SUPPORTS_F16C) && (defined(__F16C__) || defined(__AVX2__))
+#if defined(QT_COMPILER_SUPPORTS_F16C) && defined(__F16C__)
__m128i packhalf = _mm_cvtsi32_si128(b16);
__m128 packsingle = _mm_cvtph_ps(packhalf);
return _mm_cvtss_f32(packsingle);
diff --git a/src/corelib/io/qstandardpaths_win.cpp b/src/corelib/io/qstandardpaths_win.cpp
index 41fd31df8b..eeb02419c3 100644
--- a/src/corelib/io/qstandardpaths_win.cpp
+++ b/src/corelib/io/qstandardpaths_win.cpp
@@ -201,6 +201,10 @@ QString QStandardPaths::writableLocation(StandardLocation type)
return result;
}
+#ifndef QT_BOOTSTRAPPED
+extern QString qAppFileName();
+#endif
+
QStringList QStandardPaths::standardLocations(StandardLocation type)
{
QStringList dirs;
@@ -217,8 +221,13 @@ QStringList QStandardPaths::standardLocations(StandardLocation type)
dirs.append(programData);
}
#ifndef QT_BOOTSTRAPPED
- dirs.append(QCoreApplication::applicationDirPath());
- const QString dataDir = QCoreApplication::applicationDirPath() + QLatin1String("/data");
+ // Note: QCoreApplication::applicationDirPath(), while static, requires
+ // an application instance. But we might need to resolve the standard
+ // locations earlier than that, so we fall back to qAppFileName().
+ QString applicationDirPath = qApp ? QCoreApplication::applicationDirPath()
+ : QFileInfo(qAppFileName()).path();
+ dirs.append(applicationDirPath);
+ const QString dataDir = applicationDirPath + QLatin1String("/data");
dirs.append(dataDir);
if (!isGenericConfigLocation(type)) {
diff --git a/src/gui/image/qplatformpixmap.cpp b/src/gui/image/qplatformpixmap.cpp
index b123afb4db..2209c3de4d 100644
--- a/src/gui/image/qplatformpixmap.cpp
+++ b/src/gui/image/qplatformpixmap.cpp
@@ -58,6 +58,9 @@ QT_BEGIN_NAMESPACE
*/
QPlatformPixmap *QPlatformPixmap::create(int w, int h, PixelType type)
{
+ if (Q_UNLIKELY(!QGuiApplicationPrivate::platformIntegration()))
+ qFatal("QPlatformPixmap: QGuiApplication required");
+
QPlatformPixmap *data = QGuiApplicationPrivate::platformIntegration()->createPlatformPixmap(static_cast<QPlatformPixmap::PixelType>(type));
data->resize(w, h);
return data;
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index f9580291bc..2cecb444c3 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -265,12 +265,12 @@ void QWindowSystemInterface::handleWindowScreenChanged(QWindow *window, QScreen
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
}
-void QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationState newState, bool forcePropagate)
+QT_DEFINE_QPA_EVENT_HANDLER(void, handleApplicationStateChanged, Qt::ApplicationState newState, bool forcePropagate)
{
Q_ASSERT(QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ApplicationState));
QWindowSystemInterfacePrivate::ApplicationStateChangedEvent *e =
new QWindowSystemInterfacePrivate::ApplicationStateChangedEvent(newState, forcePropagate);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
+ QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
}
QWindowSystemInterfacePrivate::GeometryChangeEvent::GeometryChangeEvent(QWindow *window, const QRect &newGeometry)
diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h
index 1ded12d88d..b1ca6238cb 100644
--- a/src/gui/kernel/qwindowsysteminterface.h
+++ b/src/gui/kernel/qwindowsysteminterface.h
@@ -180,6 +180,7 @@ public:
static void handleWindowStateChanged(QWindow *window, Qt::WindowStates newState, int oldState = -1);
static void handleWindowScreenChanged(QWindow *window, QScreen *newScreen);
+ template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
static void handleApplicationStateChanged(Qt::ApplicationState newState, bool forcePropagate = false);
#ifndef QT_NO_DRAGANDDROP
diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp
index edf9dee78e..67b765d9e6 100644
--- a/src/network/access/qnetworkaccessmanager.cpp
+++ b/src/network/access/qnetworkaccessmanager.cpp
@@ -1027,8 +1027,7 @@ QNetworkConfiguration QNetworkAccessManager::configuration() const
if (session) {
return session->configuration();
} else {
- QNetworkConfigurationManager manager;
- return manager.defaultConfiguration();
+ return d->networkConfigurationManager.defaultConfiguration();
}
}
@@ -1052,12 +1051,11 @@ QNetworkConfiguration QNetworkAccessManager::activeConfiguration() const
Q_D(const QNetworkAccessManager);
QSharedPointer<QNetworkSession> networkSession(d->getNetworkSession());
- QNetworkConfigurationManager manager;
if (networkSession) {
- return manager.configurationFromIdentifier(
+ return d->networkConfigurationManager.configurationFromIdentifier(
networkSession->sessionProperty(QLatin1String("ActiveConfiguration")).toString());
} else {
- return manager.defaultConfiguration();
+ return d->networkConfigurationManager.defaultConfiguration();
}
}
@@ -1384,17 +1382,16 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera
}
if (!d->networkSessionStrongRef && (d->initializeSession || !d->networkConfiguration.identifier().isEmpty())) {
- QNetworkConfigurationManager manager;
if (!d->networkConfiguration.identifier().isEmpty()) {
if ((d->networkConfiguration.state() & QNetworkConfiguration::Defined)
- && d->networkConfiguration != manager.defaultConfiguration())
- d->createSession(manager.defaultConfiguration());
+ && d->networkConfiguration != d->networkConfigurationManager.defaultConfiguration())
+ d->createSession(d->networkConfigurationManager.defaultConfiguration());
else
d->createSession(d->networkConfiguration);
} else {
- if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired)
- d->createSession(manager.defaultConfiguration());
+ if (d->networkSessionRequired)
+ d->createSession(d->networkConfigurationManager.defaultConfiguration());
else
d->initializeSession = false;
}
@@ -1926,8 +1923,8 @@ void QNetworkAccessManagerPrivate::_q_onlineStateChanged(bool isOnline)
online = (networkConfiguration.state() & QNetworkConfiguration::Active);
} else {
if (online != isOnline) {
- _q_networkSessionClosed();
- createSession(q->configuration());
+ _q_networkSessionClosed();
+ createSession(q->configuration());
online = isOnline;
}
}
@@ -1951,13 +1948,13 @@ void QNetworkAccessManagerPrivate::_q_configurationChanged(const QNetworkConfigu
const QString id = configuration.identifier();
if (configuration.state().testFlag(QNetworkConfiguration::Active)) {
if (!onlineConfigurations.contains(id)) {
-
QSharedPointer<QNetworkSession> session(getNetworkSession());
if (session) {
if (online && session->configuration().identifier()
!= networkConfigurationManager.defaultConfiguration().identifier()) {
onlineConfigurations.insert(id);
+ // CHECK: If it's having Active flag - why would it be disconnected ???
//this one disconnected but another one is online,
// close and create new session
_q_networkSessionClosed();
@@ -1968,6 +1965,7 @@ void QNetworkAccessManagerPrivate::_q_configurationChanged(const QNetworkConfigu
} else if (onlineConfigurations.contains(id)) {
//this one is disconnecting
+ // CHECK: If it disconnected while we create a session over a down configuration ???
onlineConfigurations.remove(id);
if (!onlineConfigurations.isEmpty()) {
_q_networkSessionClosed();
diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
index be0fac4b55..2105145263 100644
--- a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
+++ b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
@@ -112,9 +112,11 @@ static bool isDBusTrayAvailable() {
#ifndef QT_NO_DBUS
static bool checkDBusGlobalMenuAvailable()
{
- QDBusConnection connection = QDBusConnection::sessionBus();
- QString registrarService = QStringLiteral("com.canonical.AppMenu.Registrar");
- return connection.interface()->isServiceRegistered(registrarService);
+ const QDBusConnection connection = QDBusConnection::sessionBus();
+ static const QString registrarService = QStringLiteral("com.canonical.AppMenu.Registrar");
+ if (const auto iface = connection.interface())
+ return iface->isServiceRegistered(registrarService);
+ return false;
}
static bool isDBusGlobalMenuAvailable()
diff --git a/src/plugins/platforms/ios/qiosapplicationstate.mm b/src/plugins/platforms/ios/qiosapplicationstate.mm
index 7b923e4692..13e7e1150f 100644
--- a/src/plugins/platforms/ios/qiosapplicationstate.mm
+++ b/src/plugins/platforms/ios/qiosapplicationstate.mm
@@ -39,6 +39,8 @@
#include "qiosapplicationstate.h"
+#include "qiosglobal.h"
+
#include <qpa/qwindowsysteminterface.h>
#include <QtCore/qcoreapplication.h>
@@ -72,8 +74,8 @@ static Qt::ApplicationState qtApplicationState(UIApplicationState uiApplicationS
static void handleApplicationStateChanged(UIApplicationState uiApplicationState)
{
Qt::ApplicationState state = qtApplicationState(uiApplicationState);
- QWindowSystemInterface::handleApplicationStateChanged(state);
- QWindowSystemInterface::flushWindowSystemEvents();
+ qCDebug(lcQpaApplication) << "moved to" << state;
+ QWindowSystemInterface::handleApplicationStateChanged<QWindowSystemInterface::SynchronousDelivery>(state);
}
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/platforms/ios/qioscontext.mm b/src/plugins/platforms/ios/qioscontext.mm
index 2d5286e971..6a6cbb4324 100644
--- a/src/plugins/platforms/ios/qioscontext.mm
+++ b/src/plugins/platforms/ios/qioscontext.mm
@@ -165,8 +165,6 @@ bool QIOSContext::makeCurrent(QPlatformSurface *surface)
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER,
framebufferObject.depthRenderbuffer);
}
-
- connect(static_cast<QIOSWindow *>(surface), SIGNAL(destroyed(QObject*)), this, SLOT(windowDestroyed(QObject*)));
} else {
glBindFramebuffer(GL_FRAMEBUFFER, framebufferObject.handle);
}
@@ -249,8 +247,13 @@ QIOSContext::FramebufferObject &QIOSContext::backingFramebufferObjectFor(QPlatfo
// should probably use QOpenGLMultiGroupSharedResource to track the shared default-FBOs.
if (m_sharedContext)
return m_sharedContext->backingFramebufferObjectFor(surface);
- else
- return m_framebufferObjects[surface];
+
+ if (!m_framebufferObjects.contains(surface)) {
+ // We're about to create a new FBO, make sure it's cleaned up as well
+ connect(static_cast<QIOSWindow *>(surface), SIGNAL(destroyed(QObject*)), this, SLOT(windowDestroyed(QObject*)));
+ }
+
+ return m_framebufferObjects[surface];
}
GLuint QIOSContext::defaultFramebufferObject(QPlatformSurface *surface) const
diff --git a/src/plugins/platforms/ios/qiosglobal.h b/src/plugins/platforms/ios/qiosglobal.h
index f74e3004cc..8b39aded06 100644
--- a/src/plugins/platforms/ios/qiosglobal.h
+++ b/src/plugins/platforms/ios/qiosglobal.h
@@ -47,7 +47,9 @@
QT_BEGIN_NAMESPACE
+Q_DECLARE_LOGGING_CATEGORY(lcQpaApplication);
Q_DECLARE_LOGGING_CATEGORY(lcQpaInputMethods);
+Q_DECLARE_LOGGING_CATEGORY(lcQpaWindow);
#if !defined(QT_NO_DEBUG)
#define qImDebug \
diff --git a/src/plugins/platforms/ios/qiosglobal.mm b/src/plugins/platforms/ios/qiosglobal.mm
index 1482ffc7af..f27b2242df 100644
--- a/src/plugins/platforms/ios/qiosglobal.mm
+++ b/src/plugins/platforms/ios/qiosglobal.mm
@@ -44,7 +44,9 @@
QT_BEGIN_NAMESPACE
+Q_LOGGING_CATEGORY(lcQpaApplication, "qt.qpa.application");
Q_LOGGING_CATEGORY(lcQpaInputMethods, "qt.qpa.input.methods");
+Q_LOGGING_CATEGORY(lcQpaWindow, "qt.qpa.window");
bool isQtApplication()
{
diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm
index 4e6d48423d..bcec9899f7 100644
--- a/src/plugins/platforms/ios/qioswindow.mm
+++ b/src/plugins/platforms/ios/qioswindow.mm
@@ -239,15 +239,28 @@ void QIOSWindow::setWindowState(Qt::WindowStates state)
if (window()->isTopLevel() && window()->isVisible() && window()->isActive())
[m_view.qtViewController updateProperties];
- if (state & Qt::WindowMinimized)
+ if (state & Qt::WindowMinimized) {
applyGeometry(QRect());
- else if (state & Qt::WindowFullScreen)
- applyGeometry(screen()->geometry());
- else if (state & Qt::WindowMaximized)
- applyGeometry(window()->flags() & Qt::MaximizeUsingFullscreenGeometryHint ?
- screen()->geometry() : screen()->availableGeometry());
- else
+ } else if (state & (Qt::WindowFullScreen | Qt::WindowMaximized)) {
+ // When an application is in split-view mode, the UIScreen still has the
+ // same geometry, but the UIWindow is resized to the area reserved for the
+ // application. We use this to constrain the geometry used when applying the
+ // fullscreen or maximized window states. Note that we do not do this
+ // in applyGeometry(), as we don't want to artificially limit window
+ // placement "outside" of the screen bounds if that's what the user wants.
+
+ QRect uiWindowBounds = QRectF::fromCGRect(m_view.window.bounds).toRect();
+ QRect fullscreenGeometry = screen()->geometry().intersected(uiWindowBounds);
+ QRect maximizedGeometry = window()->flags() & Qt::MaximizeUsingFullscreenGeometryHint ?
+ fullscreenGeometry : screen()->availableGeometry().intersected(uiWindowBounds);
+
+ if (state & Qt::WindowFullScreen)
+ applyGeometry(fullscreenGeometry);
+ else
+ applyGeometry(maximizedGeometry);
+ } else {
applyGeometry(m_normalGeometry);
+ }
}
void QIOSWindow::setParent(const QPlatformWindow *parentWindow)
diff --git a/src/plugins/platforms/ios/quiview.mm b/src/plugins/platforms/ios/quiview.mm
index 1507ff37f7..849e61c409 100644
--- a/src/plugins/platforms/ios/quiview.mm
+++ b/src/plugins/platforms/ios/quiview.mm
@@ -161,6 +161,7 @@
QWindow *window = m_qioswindow->window();
QRect lastReportedGeometry = qt_window_private(window)->geometry;
QRect currentGeometry = QRectF::fromCGRect(self.frame).toRect();
+ qCDebug(lcQpaWindow) << m_qioswindow->window() << "new geometry is" << currentGeometry;
QWindowSystemInterface::handleGeometryChange<QWindowSystemInterface::SynchronousDelivery>(window, currentGeometry);
if (currentGeometry.size() != lastReportedGeometry.size()) {
@@ -193,6 +194,7 @@
region = QRect(QPoint(), bounds);
}
+ qCDebug(lcQpaWindow) << m_qioswindow->window() << region << "isExposed" << m_qioswindow->isExposed();
QWindowSystemInterface::handleExposeEvent<QWindowSystemInterface::SynchronousDelivery>(m_qioswindow->window(), region);
}
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/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 2d5813198c..8ab811e9f7 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 61721143ef..d6d0fd4322 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)