mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-07-25 03:24:18 -04:00
Add FramelessWindowResizer class for resizig frameless windows.
Remove top-right resize grip from windows. In channels and features, make sure enterEvent and leaveEvent are passed to parent class.
This commit is contained in:
@@ -37,7 +37,8 @@ DeviceGUI::DeviceGUI(QWidget *parent) :
|
||||
m_deviceSetIndex(0),
|
||||
m_contextMenuType(ContextMenuNone),
|
||||
m_drag(false),
|
||||
m_currentDeviceIndex(-1)
|
||||
m_currentDeviceIndex(-1),
|
||||
m_resizer(this)
|
||||
{
|
||||
qDebug("DeviceGUI::DeviceGUI: %p", parent);
|
||||
setWindowFlags(windowFlags() | Qt::FramelessWindowHint);
|
||||
@@ -128,7 +129,7 @@ DeviceGUI::DeviceGUI(QWidget *parent) :
|
||||
m_showAllChannelsButton->setToolTip("Show all channels");
|
||||
|
||||
m_layouts = new QVBoxLayout();
|
||||
m_layouts->setContentsMargins(0, 4, 0, 4);
|
||||
m_layouts->setContentsMargins(m_resizer.m_gripSize, 4, m_resizer.m_gripSize, 4);
|
||||
m_layouts->setSpacing(2);
|
||||
|
||||
m_topLayout = new QHBoxLayout();
|
||||
@@ -145,10 +146,6 @@ DeviceGUI::DeviceGUI(QWidget *parent) :
|
||||
m_topLayout->addWidget(m_moveButton);
|
||||
m_topLayout->addWidget(m_shrinkButton);
|
||||
m_topLayout->addWidget(m_closeButton);
|
||||
m_sizeGripTopRight = new QSizeGrip(this);
|
||||
m_sizeGripTopRight->setStyleSheet("QSizeGrip { background-color: rgb(128, 128, 128); width: 10px; height: 10px; }");
|
||||
m_sizeGripTopRight->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
m_topLayout->addWidget(m_sizeGripTopRight, 0, Qt::AlignTop | Qt::AlignRight);
|
||||
|
||||
m_centerLayout = new QHBoxLayout();
|
||||
m_contents = new QWidget(); // Do not delete! Done in child's destructor with "delete ui"
|
||||
@@ -160,7 +157,6 @@ DeviceGUI::DeviceGUI(QWidget *parent) :
|
||||
m_bottomLayout->addWidget(m_showAllChannelsButton);
|
||||
m_bottomLayout->addWidget(m_statusLabel);
|
||||
m_sizeGripBottomRight = new QSizeGrip(this);
|
||||
m_sizeGripBottomRight->setStyleSheet("QSizeGrip { background-color: rgb(128, 128, 128); width: 10px; height: 10px; }");
|
||||
m_sizeGripBottomRight->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
// m_bottomLayout->addStretch(1);
|
||||
m_bottomLayout->addWidget(m_sizeGripBottomRight, 0, Qt::AlignBottom | Qt::AlignRight);
|
||||
@@ -199,7 +195,6 @@ DeviceGUI::~DeviceGUI()
|
||||
delete m_sizeGripBottomRight;
|
||||
delete m_bottomLayout;
|
||||
delete m_centerLayout;
|
||||
delete m_sizeGripTopRight;
|
||||
delete m_topLayout;
|
||||
delete m_layouts;
|
||||
delete m_showAllChannelsButton;
|
||||
@@ -234,6 +229,15 @@ void DeviceGUI::mousePressEvent(QMouseEvent* event)
|
||||
m_DragPosition = event->globalPos() - pos();
|
||||
event->accept();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_resizer.mousePressEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceGUI::mouseReleaseEvent(QMouseEvent* event)
|
||||
{
|
||||
m_resizer.mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
void DeviceGUI::mouseMoveEvent(QMouseEvent* event)
|
||||
@@ -243,6 +247,16 @@ void DeviceGUI::mouseMoveEvent(QMouseEvent* event)
|
||||
move(event->globalPos() - m_DragPosition);
|
||||
event->accept();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_resizer.mouseMoveEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceGUI::leaveEvent(QEvent* event)
|
||||
{
|
||||
m_resizer.leaveEvent(event);
|
||||
QMdiSubWindow::leaveEvent(event);
|
||||
}
|
||||
|
||||
void DeviceGUI::openChangeDeviceDialog()
|
||||
|
||||
Reference in New Issue
Block a user