qt/LedOK/LoQClass/loqwindowtitlebar.cpp

57 lines
1.5 KiB
C++
Raw Normal View History

2022-01-04 18:11:48 +08:00
#include "loqwindowtitlebar.h"
LoQWindowTitleBar::LoQWindowTitleBar(QWidget *parent) :
LoQTitleBar(parent)
{
QHBoxLayout *pLayout = new QHBoxLayout(this);
pLayout->addStretch();
pLayout->addWidget(bn_Minimize);
pLayout->addWidget(bn_Maximize);
pLayout->addWidget(bn_Close);
pLayout->setContentsMargins(3, 3, 3, 0);
setLayout(pLayout);
}
LoQWindowTitleBar::LoQWindowTitleBar(const QString &text, QWidget *parent) :
LoQTitleBar(parent)
{
m_wText = new QLabel(text, this);
m_wText->adjustSize();
QHBoxLayout *pLayout = new QHBoxLayout(this);
pLayout->addStretch();
pLayout->addWidget(m_wText);
pLayout->addStretch();
pLayout->addWidget(bn_Minimize);
pLayout->addWidget(bn_Maximize);
pLayout->addWidget(bn_Close);
pLayout->setContentsMargins(3, 3, 3, 0);
setLayout(pLayout);
}
LoQWindowTitleBar::LoQWindowTitleBar(const QPixmap &icon, const QString &text, QWidget *parent) :
LoQTitleBar(parent)
{
m_wIcon = new QLabel(this);
m_wIcon->setPixmap(icon);
m_wIcon->adjustSize();
m_wText = new QLabel(text, this);
m_wText->adjustSize();
QHBoxLayout *pLayout = new QHBoxLayout(this);
pLayout->addWidget(m_wIcon);
pLayout->addStretch();
pLayout->addWidget(m_wText);
pLayout->addStretch();
pLayout->addWidget(bn_Minimize);
pLayout->addWidget(bn_Maximize);
pLayout->addWidget(bn_Close);
pLayout->setContentsMargins(3, 3, 3, 0);
setLayout(pLayout);
}
void LoQWindowTitleBar::RenameTitle(QString strName)
{
m_wText->setText(strName);
}