mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-05-24 11:12:27 -04:00
Massive UI revamping (v7): Feature and channels: set the border on the outer side of the window. Part of #1213
This commit is contained in:
parent
f7bfd10bd7
commit
f762863a23
@ -44,6 +44,10 @@ ChannelGUI::ChannelGUI(QWidget *parent) :
|
|||||||
{
|
{
|
||||||
qDebug("ChannelGUI::ChannelGUI");
|
qDebug("ChannelGUI::ChannelGUI");
|
||||||
setWindowFlags(windowFlags() | Qt::FramelessWindowHint);
|
setWindowFlags(windowFlags() | Qt::FramelessWindowHint);
|
||||||
|
setObjectName("ChannelGUI");
|
||||||
|
setStyleSheet(QString(tr("#ChannelGUI { border: 1px solid %1; background-color: %2; }")
|
||||||
|
.arg(palette().highlight().color().darker(115).name()))
|
||||||
|
.arg(palette().dark().color().darker(115).name()));
|
||||||
|
|
||||||
m_indexLabel = new QLabel();
|
m_indexLabel = new QLabel();
|
||||||
m_indexLabel->setFixedSize(50, 16);
|
m_indexLabel->setFixedSize(50, 16);
|
||||||
@ -124,8 +128,8 @@ ChannelGUI::ChannelGUI(QWidget *parent) :
|
|||||||
m_statusLabel->setToolTip("Channel status");
|
m_statusLabel->setToolTip("Channel status");
|
||||||
|
|
||||||
m_layouts = new QVBoxLayout();
|
m_layouts = new QVBoxLayout();
|
||||||
m_layouts->setContentsMargins(m_resizer.m_gripSize, 4, m_resizer.m_gripSize, 4);
|
m_layouts->setContentsMargins(m_resizer.m_gripSize, m_resizer.m_gripSize, m_resizer.m_gripSize, m_resizer.m_gripSize);
|
||||||
m_layouts->setSpacing(2);
|
m_layouts->setSpacing(0);
|
||||||
|
|
||||||
m_topLayout = new QHBoxLayout();
|
m_topLayout = new QHBoxLayout();
|
||||||
m_topLayout->setContentsMargins(0, 0, 0, 0);
|
m_topLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
@ -152,6 +156,7 @@ ChannelGUI::ChannelGUI(QWidget *parent) :
|
|||||||
m_bottomLayout->addWidget(m_statusLabel);
|
m_bottomLayout->addWidget(m_statusLabel);
|
||||||
m_sizeGripBottomRight = new QSizeGrip(this);
|
m_sizeGripBottomRight = new QSizeGrip(this);
|
||||||
m_sizeGripBottomRight->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
m_sizeGripBottomRight->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||||
|
m_sizeGripBottomRight->setFixedHeight(20);
|
||||||
// m_bottomLayout->addStretch(1);
|
// m_bottomLayout->addStretch(1);
|
||||||
m_bottomLayout->addWidget(m_sizeGripBottomRight, 0, Qt::AlignBottom | Qt::AlignRight);
|
m_bottomLayout->addWidget(m_sizeGripBottomRight, 0, Qt::AlignBottom | Qt::AlignRight);
|
||||||
|
|
||||||
@ -318,6 +323,7 @@ void ChannelGUI::shrinkWindow()
|
|||||||
{
|
{
|
||||||
qDebug("ChannelGUI::shrinkWindow");
|
qDebug("ChannelGUI::shrinkWindow");
|
||||||
adjustSize();
|
adjustSize();
|
||||||
|
resize(width(), m_rollupContents->height() + getAdditionalHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChannelGUI::setTitle(const QString& title)
|
void ChannelGUI::setTitle(const QString& title)
|
||||||
|
@ -95,7 +95,7 @@ protected:
|
|||||||
void mouseMoveEvent(QMouseEvent* event) override;
|
void mouseMoveEvent(QMouseEvent* event) override;
|
||||||
void resetContextMenuType() { m_contextMenuType = ContextMenuNone; }
|
void resetContextMenuType() { m_contextMenuType = ContextMenuNone; }
|
||||||
void updateIndexLabel();
|
void updateIndexLabel();
|
||||||
int getAdditionalHeight() const { return 29 + 26; }
|
int getAdditionalHeight() const { return 25 + 22; }
|
||||||
|
|
||||||
DeviceType m_deviceType;
|
DeviceType m_deviceType;
|
||||||
int m_deviceSetIndex;
|
int m_deviceSetIndex;
|
||||||
|
@ -39,6 +39,10 @@ FeatureGUI::FeatureGUI(QWidget *parent) :
|
|||||||
{
|
{
|
||||||
qDebug("FeatureGUI::FeatureGUI");
|
qDebug("FeatureGUI::FeatureGUI");
|
||||||
setWindowFlags(windowFlags() | Qt::FramelessWindowHint);
|
setWindowFlags(windowFlags() | Qt::FramelessWindowHint);
|
||||||
|
setObjectName("FeatureGUI");
|
||||||
|
setStyleSheet(QString(tr("#FeatureGUI { border: 1px solid %1; background-color: %2; }")
|
||||||
|
.arg(palette().highlight().color().darker(115).name()))
|
||||||
|
.arg(palette().dark().color().darker(115).name()));
|
||||||
|
|
||||||
m_indexLabel = new QLabel();
|
m_indexLabel = new QLabel();
|
||||||
m_indexLabel->setFixedSize(40, 16);
|
m_indexLabel->setFixedSize(40, 16);
|
||||||
@ -90,8 +94,8 @@ FeatureGUI::FeatureGUI(QWidget *parent) :
|
|||||||
m_statusLabel->setToolTip("Feature status");
|
m_statusLabel->setToolTip("Feature status");
|
||||||
|
|
||||||
m_layouts = new QVBoxLayout();
|
m_layouts = new QVBoxLayout();
|
||||||
m_layouts->setContentsMargins(m_resizer.m_gripSize, 4, m_resizer.m_gripSize, 4);
|
m_layouts->setContentsMargins(m_resizer.m_gripSize, m_resizer.m_gripSize, m_resizer.m_gripSize, m_resizer.m_gripSize);
|
||||||
m_layouts->setSpacing(2);
|
m_layouts->setSpacing(0);
|
||||||
|
|
||||||
m_topLayout = new QHBoxLayout();
|
m_topLayout = new QHBoxLayout();
|
||||||
m_topLayout->setContentsMargins(0, 0, 0, 0);
|
m_topLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
@ -112,6 +116,7 @@ FeatureGUI::FeatureGUI(QWidget *parent) :
|
|||||||
m_bottomLayout->addWidget(m_statusLabel);
|
m_bottomLayout->addWidget(m_statusLabel);
|
||||||
m_sizeGripBottomRight = new QSizeGrip(this);
|
m_sizeGripBottomRight = new QSizeGrip(this);
|
||||||
m_sizeGripBottomRight->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
m_sizeGripBottomRight->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||||
|
m_sizeGripBottomRight->setFixedHeight(20);
|
||||||
// m_bottomLayout->addStretch(1);
|
// m_bottomLayout->addStretch(1);
|
||||||
m_bottomLayout->addWidget(m_sizeGripBottomRight, 0, Qt::AlignBottom | Qt::AlignRight);
|
m_bottomLayout->addWidget(m_sizeGripBottomRight, 0, Qt::AlignBottom | Qt::AlignRight);
|
||||||
|
|
||||||
@ -256,6 +261,7 @@ void FeatureGUI::shrinkWindow()
|
|||||||
{
|
{
|
||||||
qDebug("FeatureGUI::shrinkWindow");
|
qDebug("FeatureGUI::shrinkWindow");
|
||||||
adjustSize();
|
adjustSize();
|
||||||
|
resize(width(), m_rollupContents.height() + getAdditionalHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
void FeatureGUI::setTitle(const QString& title)
|
void FeatureGUI::setTitle(const QString& title)
|
||||||
|
@ -72,6 +72,7 @@ protected:
|
|||||||
void mouseReleaseEvent(QMouseEvent* event) override;
|
void mouseReleaseEvent(QMouseEvent* event) override;
|
||||||
void mouseMoveEvent(QMouseEvent* event) override;
|
void mouseMoveEvent(QMouseEvent* event) override;
|
||||||
void resetContextMenuType() { m_contextMenuType = ContextMenuNone; }
|
void resetContextMenuType() { m_contextMenuType = ContextMenuNone; }
|
||||||
|
int getAdditionalHeight() const { return 25 + 22; }
|
||||||
|
|
||||||
int m_featureIndex;
|
int m_featureIndex;
|
||||||
QString m_helpURL;
|
QString m_helpURL;
|
||||||
|
@ -54,7 +54,7 @@ public:
|
|||||||
void mouseMoveEvent(QMouseEvent* event);
|
void mouseMoveEvent(QMouseEvent* event);
|
||||||
void leaveEvent(QEvent* event);
|
void leaveEvent(QEvent* event);
|
||||||
|
|
||||||
const int m_gripSize = 3; // Size in pixels of the border of the window that can be clicked in to resize it
|
const int m_gripSize = 2; // Size in pixels of the border of the window that can be clicked in to resize it
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool mouseOnTopBorder(QPoint pos) const;
|
bool mouseOnTopBorder(QPoint pos) const;
|
||||||
|
@ -92,22 +92,6 @@ void RollupContents::setHighlighted(bool highlighted)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int RollupContents::getAdditionalHeiht()
|
|
||||||
{
|
|
||||||
int pos = 0;
|
|
||||||
|
|
||||||
for (int i = 0; i < children().count(); ++i)
|
|
||||||
{
|
|
||||||
QWidget* r = qobject_cast<QWidget*>(children()[i]);
|
|
||||||
|
|
||||||
if (r && isRollupChild(r) && !r->isHidden()) {
|
|
||||||
pos += 5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RollupContents::hasExpandableWidgets()
|
bool RollupContents::hasExpandableWidgets()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < children().count(); ++i)
|
for (int i = 0; i < children().count(); ++i)
|
||||||
@ -218,7 +202,8 @@ int RollupContents::arrangeRollups()
|
|||||||
void RollupContents::paintEvent(QPaintEvent*)
|
void RollupContents::paintEvent(QPaintEvent*)
|
||||||
{
|
{
|
||||||
QPainter p(this);
|
QPainter p(this);
|
||||||
QColor frameColor = palette().highlight().color().darker(115);
|
QColor frameColor = palette().highlight().color().darker(125);
|
||||||
|
// QColor frameColor = Qt::black;
|
||||||
|
|
||||||
// Eigenbau
|
// Eigenbau
|
||||||
QFontMetrics fm(font());
|
QFontMetrics fm(font());
|
||||||
@ -237,9 +222,10 @@ void RollupContents::paintEvent(QPaintEvent*)
|
|||||||
p.setPen(m_highlighted ? Qt::white : frameColor);
|
p.setPen(m_highlighted ? Qt::white : frameColor);
|
||||||
p.setBrush(palette().window());
|
p.setBrush(palette().window());
|
||||||
QRectF r(rect());
|
QRectF r(rect());
|
||||||
r.adjust(0.5, 0.5, -0.5, -0.5);
|
// r.adjust(0.5, 0.5, -0.5, -0.5);
|
||||||
// p.drawRoundedRect(r, 3.0, 3.0, Qt::AbsoluteSize);
|
// p.drawRoundedRect(r, 3.0, 3.0, Qt::AbsoluteSize);
|
||||||
p.drawRect(r);
|
// p.drawRect(r);
|
||||||
|
p.fillRect(r, palette().window());
|
||||||
|
|
||||||
// Rollups
|
// Rollups
|
||||||
int pos = 2; // fm.height() + 4;
|
int pos = 2; // fm.height() + 4;
|
||||||
|
@ -34,7 +34,6 @@ public:
|
|||||||
void saveState(RollupState& state) const;
|
void saveState(RollupState& state) const;
|
||||||
void restoreState(const RollupState& state);
|
void restoreState(const RollupState& state);
|
||||||
int arrangeRollups();
|
int arrangeRollups();
|
||||||
int getAdditionalHeiht();
|
|
||||||
bool hasExpandableWidgets();
|
bool hasExpandableWidgets();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user