Restore cursor when moved over child widget

pull/1215/head
Jon Beniston 2022-04-25 15:01:59 +01:00
rodzic 3259cf7f0a
commit 3f1ed5b934
7 zmienionych plików z 20 dodań i 0 usunięć

Wyświetl plik

@ -184,6 +184,8 @@ ChannelGUI::ChannelGUI(QWidget *parent) :
this,
&ChannelGUI::onWidgetRolled
);
m_resizer.enableChildMouseTracking();
}
ChannelGUI::~ChannelGUI()

Wyświetl plik

@ -193,6 +193,8 @@ DeviceGUI::DeviceGUI(QWidget *parent) :
this,
&DeviceGUI::addChannelEmitted
);
m_resizer.enableChildMouseTracking();
}
DeviceGUI::~DeviceGUI()

Wyświetl plik

@ -141,6 +141,8 @@ FeatureGUI::FeatureGUI(QWidget *parent) :
this,
&FeatureGUI::onWidgetRolled
);
m_resizer.enableChildMouseTracking();
}
FeatureGUI::~FeatureGUI()

Wyświetl plik

@ -34,6 +34,14 @@ FramelessWindowResizer::FramelessWindowResizer(QWidget *widget) :
{
}
void FramelessWindowResizer::enableChildMouseTracking()
{
QList<QWidget *> widgets = m_widget->findChildren<QWidget *>();
for (auto widget : widgets) {
widget->setMouseTracking(true);
}
}
bool FramelessWindowResizer::mouseOnTopBorder(QPoint pos) const
{
return (pos.y() >= 0) && (pos.y() < m_gripSize);

Wyświetl plik

@ -28,6 +28,8 @@
// by clicking and draging on the border
// The window needs to forward the mousePressEvent, mouseReleaseEvent, mouseMoveEvent
// and leaveEvent events to this class
// Child widgets should have mouse tracking enabled, so cursor can be controlled properly
// This can be achieved by calling enableChildMouseTracking
class SDRGUI_API FramelessWindowResizer
{
private:
@ -49,6 +51,7 @@ private:
public:
FramelessWindowResizer(QWidget *widget);
void enableChildMouseTracking();
void mousePressEvent(QMouseEvent* event);
void mouseReleaseEvent(QMouseEvent* event);
void mouseMoveEvent(QMouseEvent* event);

Wyświetl plik

@ -2565,6 +2565,8 @@ void GLSpectrum::mouseMoveEvent(QMouseEvent* event)
return;
}
event->setAccepted(false);
}
void GLSpectrum::mousePressEvent(QMouseEvent* event)

Wyświetl plik

@ -140,6 +140,7 @@ MainSpectrumGUI::MainSpectrumGUI(GLSpectrum *spectrum, GLSpectrumGUI *spectrumGU
connect(this, SIGNAL(forceShrink()), this, SLOT(shrinkWindow()));
connect(m_hideButton, SIGNAL(clicked()), this, SLOT(hide()));
m_resizer.enableChildMouseTracking();
shrinkWindow();
}