0
0
mirror of https://github.com/yse/easy_profiler.git synced 2024-12-27 00:21:11 +08:00

[ui] round progress indicator: added setTitle method

This commit is contained in:
Victor Zarubkin 2019-10-29 23:51:57 +03:00
parent 7d0c04bd73
commit 00ee2d0e18
2 changed files with 12 additions and 0 deletions

View File

@ -625,6 +625,8 @@ RoundProgressWidget::RoundProgressWidget(const QString& title, QWidget* parent)
setAttribute(Qt::WA_TranslucentBackground); setAttribute(Qt::WA_TranslucentBackground);
setAutoFillBackground(false); setAutoFillBackground(false);
m_title->setAlignment(Qt::AlignCenter);
auto wlay = new QHBoxLayout(m_indicatorWrapper); auto wlay = new QHBoxLayout(m_indicatorWrapper);
wlay->setContentsMargins(0, 0, 0, 0); wlay->setContentsMargins(0, 0, 0, 0);
wlay->addWidget(m_indicator, 0, Qt::AlignCenter); wlay->addWidget(m_indicator, 0, Qt::AlignCenter);
@ -647,6 +649,7 @@ RoundProgressWidget::~RoundProgressWidget()
void RoundProgressWidget::setTitle(const QString& title) void RoundProgressWidget::setTitle(const QString& title)
{ {
m_title->setText(title); m_title->setText(title);
adjustSize();
} }
int RoundProgressWidget::value() const int RoundProgressWidget::value() const
@ -852,6 +855,13 @@ void RoundProgressDialog::setStyle(RoundProgressStyle style)
m_progress->setStyle(style); m_progress->setStyle(style);
} }
void RoundProgressDialog::setTitle(const QString& title)
{
m_progress->setTitle(title);
adjustSize();
update();
}
QDialog::DialogCode RoundProgressDialog::buttonRole() const QDialog::DialogCode RoundProgressDialog::buttonRole() const
{ {
return m_progress->buttonRole(); return m_progress->buttonRole();

View File

@ -266,6 +266,8 @@ public:
RoundProgressStyle style() const; RoundProgressStyle style() const;
void setStyle(RoundProgressStyle style); void setStyle(RoundProgressStyle style);
void setTitle(const QString& title);
protected: protected:
void showEvent(QShowEvent* event) override; void showEvent(QShowEvent* event) override;