Skip to content

Commit

Permalink
fix: hide toast label by default
Browse files Browse the repository at this point in the history
Change-Id: Ie836e98843570545e5115556485580c7000acee9
  • Loading branch information
Iceyer committed Jan 27, 2018
1 parent a9b3321 commit 0dfb156
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/widgets/DToast
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include <dtoast.h>
5 changes: 5 additions & 0 deletions src/widgets/dtoast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,20 +108,23 @@ int DToast::radius() const
void DToast::setText(QString text)
{
D_D(DToast);
d->textLabel->setVisible(true);
d->textLabel->setText(text);
}

void DToast::setIcon(QString iconfile)
{
D_D(DToast);
d->icon = QIcon(iconfile);
d->iconLabel->setVisible(true);
d->iconLabel->setPixmap(DHiDPIHelper::loadNxPixmap(iconfile));
}

void DToast::setIcon(QIcon icon, QSize defaultSize)
{
D_D(DToast);
d->icon = icon;
d->iconLabel->setVisible(true);
d->iconLabel->setPixmap(d->icon.pixmap(icon.actualSize(defaultSize)));
}

Expand Down Expand Up @@ -243,7 +246,9 @@ void DToastPrivate::initUI()
layout->setSpacing(12);

iconLabel = new QLabel;
iconLabel->setVisible(false);
textLabel = new QLabel;
textLabel->setVisible(false);

layout->addWidget(iconLabel);
layout->addWidget(textLabel);
Expand Down
3 changes: 2 additions & 1 deletion src/widgets/widgets.pri
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ includes.files += \
$$PWD/DCrumbEdit \
$$PWD/DTabBar \
$$PWD/DSuggestButton \
$$PWD/DStyleOption
$$PWD/DStyleOption \
$$PWD/DToast


0 comments on commit 0dfb156

Please sign in to comment.