#1365 Added sizeHint to QMinimizePanel

This commit is contained in:
Magne Sjaastad 2017-03-27 15:20:11 +02:00
parent dc493b0b68
commit bf9d65d249
2 changed files with 23 additions and 0 deletions

View File

@ -189,6 +189,28 @@ QString QMinimizePanel::title() const
return m_titleLabel->text();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QSize QMinimizePanel::sizeHint() const
{
QSize labelSize = m_titleLabel->sizeHint();
QSize titleBarHint = labelSize + QSize(4 + labelSize.height() + 8 - 2 + 1, 8);
if (!m_contentFrame->isHidden())
{
QSize titleBarMin(0, labelSize.height() + 8);
QSize contentsMin(m_contentFrame->sizeHint());
QSize total = contentsMin.expandedTo(titleBarMin);
total.rheight() += titleBarMin.height();
return total;
}
else
{
return titleBarHint;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -53,6 +53,7 @@ public:
QFrame * contentFrame() { return m_contentFrame; }
void setTitle (const QString& title);
QString title() const;
virtual QSize sizeHint() const override;
public slots:
void setExpanded(bool isExpanded);