dde-dock/plugins/plugin-guide/home_monitor/informationwidget.cpp
石博文 184445992d add plugins develop guide
Change-Id: I448c791af97d6ce50a39dff542f843763883a3e1
2018-02-24 13:31:06 +08:00

34 lines
785 B
C++

#include "informationwidget.h"
#include <QVBoxLayout>
#include <QTimer>
InformationWidget::InformationWidget(QWidget *parent)
: QWidget(parent)
, m_infoLabel(new QLabel)
{
m_infoLabel->setStyleSheet("QLabel {"
"color: white;"
"}");
QVBoxLayout *centralLayout = new QVBoxLayout;
centralLayout->addWidget(m_infoLabel);
centralLayout->setSpacing(0);
centralLayout->setMargin(0);
setLayout(centralLayout);
QTimer::singleShot(1, this, &InformationWidget::refreshInfo);
}
void InformationWidget::refreshInfo()
{
// TODO: fetch info
const int remain = 50;
const int total = 100;
// update display
m_infoLabel->setText(tr("Home:\n%1G/%2G").arg(remain).arg(total));
}