mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-26 01:39:05 -05:00
Massive UI revamping (v7): better handling of expandable rollup sub widgets. Part of #1209
This commit is contained in:
parent
db71b9fcb2
commit
5ba8b21dcc
@ -140,6 +140,7 @@ ChannelGUI::ChannelGUI(QWidget *parent) :
|
|||||||
m_topLayout->addWidget(m_closeButton);
|
m_topLayout->addWidget(m_closeButton);
|
||||||
|
|
||||||
m_centerLayout = new QHBoxLayout();
|
m_centerLayout = new QHBoxLayout();
|
||||||
|
m_centerLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
m_rollupContents = new RollupContents(); // Do not delete! Done in child's destructor with "delete ui"
|
m_rollupContents = new RollupContents(); // Do not delete! Done in child's destructor with "delete ui"
|
||||||
m_centerLayout->addWidget(m_rollupContents);
|
m_centerLayout->addWidget(m_rollupContents);
|
||||||
|
|
||||||
|
@ -95,6 +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; }
|
||||||
|
|
||||||
DeviceType m_deviceType;
|
DeviceType m_deviceType;
|
||||||
int m_deviceSetIndex;
|
int m_deviceSetIndex;
|
||||||
|
@ -92,6 +92,36 @@ 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()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < children().count(); ++i)
|
||||||
|
{
|
||||||
|
QWidget* r = qobject_cast<QWidget*>(children()[i]);
|
||||||
|
|
||||||
|
if (r && isRollupChild(r) && !r->isHidden() && (r->sizePolicy().verticalPolicy() == QSizePolicy::Expanding)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
int RollupContents::arrangeRollups()
|
int RollupContents::arrangeRollups()
|
||||||
{
|
{
|
||||||
QFontMetrics fm(font());
|
QFontMetrics fm(font());
|
||||||
|
@ -34,6 +34,8 @@ 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();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void widgetRolled(QWidget* widget, bool rollDown);
|
void widgetRolled(QWidget* widget, bool rollDown);
|
||||||
|
Loading…
Reference in New Issue
Block a user