added label content loading

This commit is contained in:
Luis Ángel San Martín
2014-11-21 18:54:07 +01:00
parent 2af75b35ca
commit 2289e24602
15 changed files with 193 additions and 32 deletions

View File

@ -0,0 +1,49 @@
#include "empty_label_widget.h"
EmptyLabelWidget::EmptyLabelWidget(QWidget *parent) :
QWidget(parent)
{
#ifdef Q_OS_MAC
backgroundColor = "#FFFFFF";
#else
backgroundColor = "#2A2A2A";
#endif
QVBoxLayout * layout = new QVBoxLayout;
iconLabel = new QLabel();
iconLabel->setPixmap(QPixmap(":/images/empty_label.png"));
iconLabel->setAlignment(Qt::AlignCenter);
//titleLabel->setText(tr("This label doesn't contain comics yet") + QString("<p style='color:rgb(150,150,150);font-size:14px;font-weight:normal;'>%1</p>").arg(tr("Drag and drop folders and comics here")));
titleLabel = new QLabel(("This label doesn't contain comics yet"));
titleLabel->setAlignment(Qt::AlignCenter);
#ifdef Q_OS_MAC
titleLabel->setStyleSheet("QLabel {color:#888888; font-size:24px;font-family:Arial;font-weight:bold;}");
#else
titleLabel->setStyleSheet("QLabel {color:#CCCCCC; font-size:24px;font-family:Arial;font-weight:bold;}");
#endif
layout->addSpacing(100);
layout->addWidget(iconLabel);
layout->addSpacing(30);
layout->addWidget(titleLabel);
layout->addStretch();
setLayout(layout);
}
void EmptyLabelWidget::setColor(YACReader::LabelColors color)
{
//TODO tint the widget depending on color
//backgroundColor = "#FF0000";
//repaint();
}
void EmptyLabelWidget::paintEvent(QPaintEvent * event)
{
QPainter painter (this);
painter.fillRect(0,0,width(),height(),QColor(backgroundColor));
}