mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-16 05:11:49 -05:00
Merge pull request #1215 from srcejon/v7_fix_cursor_over_child
Restore cursor when move from border to child widget
This commit is contained in:
commit
1855e9afe7
@ -184,6 +184,8 @@ ChannelGUI::ChannelGUI(QWidget *parent) :
|
|||||||
this,
|
this,
|
||||||
&ChannelGUI::onWidgetRolled
|
&ChannelGUI::onWidgetRolled
|
||||||
);
|
);
|
||||||
|
|
||||||
|
m_resizer.enableChildMouseTracking();
|
||||||
}
|
}
|
||||||
|
|
||||||
ChannelGUI::~ChannelGUI()
|
ChannelGUI::~ChannelGUI()
|
||||||
|
@ -193,6 +193,8 @@ DeviceGUI::DeviceGUI(QWidget *parent) :
|
|||||||
this,
|
this,
|
||||||
&DeviceGUI::addChannelEmitted
|
&DeviceGUI::addChannelEmitted
|
||||||
);
|
);
|
||||||
|
|
||||||
|
m_resizer.enableChildMouseTracking();
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceGUI::~DeviceGUI()
|
DeviceGUI::~DeviceGUI()
|
||||||
|
@ -141,6 +141,8 @@ FeatureGUI::FeatureGUI(QWidget *parent) :
|
|||||||
this,
|
this,
|
||||||
&FeatureGUI::onWidgetRolled
|
&FeatureGUI::onWidgetRolled
|
||||||
);
|
);
|
||||||
|
|
||||||
|
m_resizer.enableChildMouseTracking();
|
||||||
}
|
}
|
||||||
|
|
||||||
FeatureGUI::~FeatureGUI()
|
FeatureGUI::~FeatureGUI()
|
||||||
|
@ -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
|
bool FramelessWindowResizer::mouseOnTopBorder(QPoint pos) const
|
||||||
{
|
{
|
||||||
return (pos.y() >= 0) && (pos.y() < m_gripSize);
|
return (pos.y() >= 0) && (pos.y() < m_gripSize);
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
// by clicking and draging on the border
|
// by clicking and draging on the border
|
||||||
// The window needs to forward the mousePressEvent, mouseReleaseEvent, mouseMoveEvent
|
// The window needs to forward the mousePressEvent, mouseReleaseEvent, mouseMoveEvent
|
||||||
// and leaveEvent events to this class
|
// 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
|
class SDRGUI_API FramelessWindowResizer
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
@ -49,6 +51,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
FramelessWindowResizer(QWidget *widget);
|
FramelessWindowResizer(QWidget *widget);
|
||||||
|
void enableChildMouseTracking();
|
||||||
void mousePressEvent(QMouseEvent* event);
|
void mousePressEvent(QMouseEvent* event);
|
||||||
void mouseReleaseEvent(QMouseEvent* event);
|
void mouseReleaseEvent(QMouseEvent* event);
|
||||||
void mouseMoveEvent(QMouseEvent* event);
|
void mouseMoveEvent(QMouseEvent* event);
|
||||||
|
@ -2565,6 +2565,8 @@ void GLSpectrum::mouseMoveEvent(QMouseEvent* event)
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
event->setAccepted(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLSpectrum::mousePressEvent(QMouseEvent* event)
|
void GLSpectrum::mousePressEvent(QMouseEvent* event)
|
||||||
|
@ -140,6 +140,7 @@ MainSpectrumGUI::MainSpectrumGUI(GLSpectrum *spectrum, GLSpectrumGUI *spectrumGU
|
|||||||
connect(this, SIGNAL(forceShrink()), this, SLOT(shrinkWindow()));
|
connect(this, SIGNAL(forceShrink()), this, SLOT(shrinkWindow()));
|
||||||
connect(m_hideButton, SIGNAL(clicked()), this, SLOT(hide()));
|
connect(m_hideButton, SIGNAL(clicked()), this, SLOT(hide()));
|
||||||
|
|
||||||
|
m_resizer.enableChildMouseTracking();
|
||||||
shrinkWindow();
|
shrinkWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user