#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("
%1
").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)); }