aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@qt.io>2024-02-29 15:09:24 +0100
committerChristian Stenger <christian.stenger@qt.io>2024-03-07 07:49:18 +0000
commitc87435f9713c768f75975ca80a9b83919172b5eb (patch)
tree020ad47b73250dabea74e9d2a8bbdf5b5decda93
parent9832af970187df48d233e3cfe1738eae6fb3d29b (diff)
Core: Tweak cursor handling of mini splitter
It is possible that the internal signals are missed which results in a stale cursor until it gets changed again. Explicitly handle the hover event and set the cursor there. This also makes the need to restart QC obsolete when toggling the respective option. Task-number: QTCREATORBUG-29980 Change-Id: I51dfa6fda018a325d43cddae99f395cd8c0accde Reviewed-by: Eike Ziller <eike.ziller@qt.io>
-rw-r--r--src/plugins/coreplugin/generalsettings.cpp4
-rw-r--r--src/plugins/coreplugin/minisplitter.cpp14
2 files changed, 12 insertions, 6 deletions
diff --git a/src/plugins/coreplugin/generalsettings.cpp b/src/plugins/coreplugin/generalsettings.cpp
index 0689adea52..71cfacbb40 100644
--- a/src/plugins/coreplugin/generalsettings.cpp
+++ b/src/plugins/coreplugin/generalsettings.cpp
@@ -250,12 +250,8 @@ void GeneralSettingsWidget::fillLanguageBox() const
void GeneralSettingsWidget::apply()
{
- bool showRestart = generalSettings().provideSplitterCursors.volatileValue()
- != generalSettings().provideSplitterCursors.value();
generalSettings().apply();
generalSettings().writeSettings();
- if (showRestart)
- ICore::askForRestart(Tr::tr("The cursors for resizing views will change after restart."));
int currentIndex = m_languageBox->currentIndex();
setLanguage(m_languageBox->itemData(currentIndex, Qt::UserRole).toString());
diff --git a/src/plugins/coreplugin/minisplitter.cpp b/src/plugins/coreplugin/minisplitter.cpp
index 8fdec456b0..dd2aa280e1 100644
--- a/src/plugins/coreplugin/minisplitter.cpp
+++ b/src/plugins/coreplugin/minisplitter.cpp
@@ -90,10 +90,9 @@ public:
{
setMask(QRegion(contentsRect()));
setAttribute(Qt::WA_MouseNoMask, true);
- if (generalSettings().provideSplitterCursors())
- setCursor(orientation == Qt::Horizontal ? hsplitCursor() : vsplitCursor());
}
protected:
+ bool event(QEvent *event) override;
void resizeEvent(QResizeEvent *event) override;
void paintEvent(QPaintEvent *event) override;
@@ -107,6 +106,17 @@ private:
using namespace Core;
using namespace Core::Internal;
+bool MiniSplitterHandle::event(QEvent *event)
+{
+ if (generalSettings().provideSplitterCursors()) {
+ if (event->type() == QEvent::HoverEnter)
+ setCursor(orientation() == Qt::Horizontal ? hsplitCursor() : vsplitCursor());
+ else if (event->type() == QEvent::HoverLeave)
+ unsetCursor();
+ }
+ return QSplitterHandle::event(event);
+}
+
void MiniSplitterHandle::resizeEvent(QResizeEvent *event)
{
if (orientation() == Qt::Horizontal)