Commit e8a2c3fb authored by Janis Born's avatar Janis Born

initially display an empty tip before an actual one is ready

parent 9c9ffacb
......@@ -56,6 +56,7 @@ DidYouKnowWidget::DidYouKnowWidget(QWidget* _parent) :
setLayout(mVBoxLayoutGlobal);
setFixedSize(sizeHint());
displayEmptyTip();
try {
updateTips();
displayRandomTip();
......@@ -134,15 +135,22 @@ void DidYouKnowWidget::updateTips()
void DidYouKnowWidget::displayTip(std::size_t _tipIndex)
{
displayEmptyTip();
if (_tipIndex < mTips.size()) {
QString text;
text += "<h1><img src=\"" + OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator() + "lightbulb.png\"> Did you know...</h1>";
text += "<hr>";
QString text = mLabelTip->text();
text += mTips[_tipIndex];
mLabelTip->setText(text);
}
}
void DidYouKnowWidget::displayEmptyTip()
{
QString text;
text += "<h1><img src=\"" + OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator() + "lightbulb.png\"> Did you know...</h1>";
text += "<hr>";
mLabelTip->setText(text);
}
void DidYouKnowWidget::displayRandomTip()
{
mCurrentTipIndex = rand() % mTips.size();
......
......@@ -31,6 +31,7 @@ private:
private slots:
void updateTips();
void displayTip(std::size_t _tipIndex);
void displayEmptyTip();
void displayRandomTip();
void displayNextTip();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment