forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -250,12 +250,8 @@ void GeneralSettingsWidget::fillLanguageBox() const
|
|||||||
|
|
||||||
void GeneralSettingsWidget::apply()
|
void GeneralSettingsWidget::apply()
|
||||||
{
|
{
|
||||||
bool showRestart = generalSettings().provideSplitterCursors.volatileValue()
|
|
||||||
!= generalSettings().provideSplitterCursors.value();
|
|
||||||
generalSettings().apply();
|
generalSettings().apply();
|
||||||
generalSettings().writeSettings();
|
generalSettings().writeSettings();
|
||||||
if (showRestart)
|
|
||||||
ICore::askForRestart(Tr::tr("The cursors for resizing views will change after restart."));
|
|
||||||
|
|
||||||
int currentIndex = m_languageBox->currentIndex();
|
int currentIndex = m_languageBox->currentIndex();
|
||||||
setLanguage(m_languageBox->itemData(currentIndex, Qt::UserRole).toString());
|
setLanguage(m_languageBox->itemData(currentIndex, Qt::UserRole).toString());
|
||||||
|
@@ -90,10 +90,9 @@ public:
|
|||||||
{
|
{
|
||||||
setMask(QRegion(contentsRect()));
|
setMask(QRegion(contentsRect()));
|
||||||
setAttribute(Qt::WA_MouseNoMask, true);
|
setAttribute(Qt::WA_MouseNoMask, true);
|
||||||
if (generalSettings().provideSplitterCursors())
|
|
||||||
setCursor(orientation == Qt::Horizontal ? hsplitCursor() : vsplitCursor());
|
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
|
bool event(QEvent *event) override;
|
||||||
void resizeEvent(QResizeEvent *event) override;
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
void paintEvent(QPaintEvent *event) override;
|
void paintEvent(QPaintEvent *event) override;
|
||||||
|
|
||||||
@@ -107,6 +106,17 @@ private:
|
|||||||
using namespace Core;
|
using namespace Core;
|
||||||
using namespace Core::Internal;
|
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)
|
void MiniSplitterHandle::resizeEvent(QResizeEvent *event)
|
||||||
{
|
{
|
||||||
if (orientation() == Qt::Horizontal)
|
if (orientation() == Qt::Horizontal)
|
||||||
|
Reference in New Issue
Block a user