mirror of
https://github.com/YACReader/yacreader
synced 2026-03-02 10:50:04 -05:00
Initial implementation of theming
This commit is contained in:
@ -1,53 +1,19 @@
|
||||
#include "no_search_results_widget.h"
|
||||
|
||||
#include "yacreader_global.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QPainter>
|
||||
|
||||
NoSearchResultsWidget::NoSearchResultsWidget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
: EmptyContainerInfo(parent)
|
||||
{
|
||||
#ifdef Y_MAC_UI
|
||||
backgroundColor = "#FFFFFF";
|
||||
#else
|
||||
backgroundColor = "#2A2A2A";
|
||||
#endif
|
||||
setUpDefaultLayout(true);
|
||||
|
||||
auto layout = new QVBoxLayout;
|
||||
|
||||
iconLabel = new QLabel();
|
||||
iconLabel->setPixmap(QPixmap(":/images/empty_search.png"));
|
||||
iconLabel->setAlignment(Qt::AlignCenter);
|
||||
|
||||
titleLabel = new QLabel("No results");
|
||||
titleLabel->setAlignment(Qt::AlignCenter);
|
||||
|
||||
#ifdef Y_MAC_UI
|
||||
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();
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->setSpacing(0);
|
||||
setPixmap(theme.emptyContainer.noSearchResultsIcon);
|
||||
setText(tr("No results"));
|
||||
|
||||
setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
setStyleSheet(QString("QWidget {background:%1}").arg(backgroundColor));
|
||||
|
||||
setSizePolicy(QSizePolicy ::Expanding, QSizePolicy ::Expanding);
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
void NoSearchResultsWidget::paintEvent(QPaintEvent *)
|
||||
void NoSearchResultsWidget::applyTheme(const Theme &theme)
|
||||
{
|
||||
QPainter painter(this);
|
||||
painter.fillRect(0, 0, width(), height(), QColor(backgroundColor));
|
||||
EmptyContainerInfo::applyTheme(theme);
|
||||
setPixmap(theme.emptyContainer.noSearchResultsIcon);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user