mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
fixed empty folder and no results widgets style in MacOSX
This commit is contained in:
parent
613f1b2ec5
commit
e47f95981f
@ -19,6 +19,12 @@ void testListView(QListView * l)
|
|||||||
EmptyFolderWidget::EmptyFolderWidget(QWidget *parent) :
|
EmptyFolderWidget::EmptyFolderWidget(QWidget *parent) :
|
||||||
QWidget(parent),subfoldersModel(new QStringListModel())
|
QWidget(parent),subfoldersModel(new QStringListModel())
|
||||||
{
|
{
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
backgroundColor = "#FFFFFF";
|
||||||
|
#else
|
||||||
|
backgroundColor = "#2A2A2A";
|
||||||
|
#endif
|
||||||
|
|
||||||
QVBoxLayout * layout = new QVBoxLayout;
|
QVBoxLayout * layout = new QVBoxLayout;
|
||||||
|
|
||||||
iconLabel = new QLabel();
|
iconLabel = new QLabel();
|
||||||
@ -27,12 +33,35 @@ EmptyFolderWidget::EmptyFolderWidget(QWidget *parent) :
|
|||||||
|
|
||||||
titleLabel = new QLabel(tr("Subfolders in this folder"));
|
titleLabel = new QLabel(tr("Subfolders in this folder"));
|
||||||
titleLabel->setAlignment(Qt::AlignCenter);
|
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;}");
|
titleLabel->setStyleSheet("QLabel {color:#CCCCCC; font-size:24px;font-family:Arial;font-weight:bold;}");
|
||||||
|
#endif
|
||||||
|
|
||||||
foldersView = new QListView();
|
foldersView = new QListView();
|
||||||
foldersView->setMinimumWidth(282);
|
foldersView->setMinimumWidth(282);
|
||||||
foldersView->setWrapping(true);
|
foldersView->setWrapping(true);
|
||||||
|
foldersView->setAttribute(Qt::WA_MacShowFocusRect,false);
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
foldersView->setStyleSheet("QListView {background-color:transparent; border: none; color:#959595; outline:0; font-size: 18px; show-decoration-selected: 0; margin:0}"
|
||||||
|
"QListView::item:selected {background-color: #EFEFEF; color:#CCCCCC;}"
|
||||||
|
"QListView::item:hover {background-color:#F4F4F8; color:#757575; }"
|
||||||
|
|
||||||
|
|
||||||
|
"QScrollBar:vertical { border: none; background: #F4F4F8; width: 14px; margin: 0 10px 0 0; }"
|
||||||
|
"QScrollBar::handle:vertical { background: #999999; width: 14px; min-height: 20px; }"
|
||||||
|
"QScrollBar::add-line:vertical { border: none; background: #999999; height: 0px; subcontrol-position: bottom; subcontrol-origin: margin; margin: 0 3px 0 0;}"
|
||||||
|
|
||||||
|
"QScrollBar::sub-line:vertical { border: none; background: #999999; height: 0px; subcontrol-position: top; subcontrol-origin: margin; margin: 0 3px 0 0;}"
|
||||||
|
"QScrollBar::up-arrow:vertical {border:none;width: 9px;height: 6px;background: url(':/images/folders_view/line-up.png') center top no-repeat;}"
|
||||||
|
"QScrollBar::down-arrow:vertical {border:none;width: 9px;height: 6px;background: url(':/images/folders_view/line-down.png') center top no-repeat;}"
|
||||||
|
|
||||||
|
"QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {background: none; }"
|
||||||
|
"QScrollBar:horizontal{height:0px;}"
|
||||||
|
);
|
||||||
|
#else
|
||||||
foldersView->setStyleSheet("QListView {background-color:transparent; border: none; color:#858585; outline:0; font-size: 18px; font:bold; show-decoration-selected: 0; margin:0}"
|
foldersView->setStyleSheet("QListView {background-color:transparent; border: none; color:#858585; outline:0; font-size: 18px; font:bold; show-decoration-selected: 0; margin:0}"
|
||||||
"QListView::item:selected {background-color: #212121; color:#CCCCCC;}"
|
"QListView::item:selected {background-color: #212121; color:#CCCCCC;}"
|
||||||
"QListView::item:hover {background-color:#212121; color:#CCCCCC; }"
|
"QListView::item:hover {background-color:#212121; color:#CCCCCC; }"
|
||||||
@ -50,6 +79,7 @@ EmptyFolderWidget::EmptyFolderWidget(QWidget *parent) :
|
|||||||
"QScrollBar:horizontal{height:0px;}"
|
"QScrollBar:horizontal{height:0px;}"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#endif
|
||||||
foldersView->setSizePolicy(QSizePolicy ::Expanding , QSizePolicy ::Expanding );
|
foldersView->setSizePolicy(QSizePolicy ::Expanding , QSizePolicy ::Expanding );
|
||||||
testListView(foldersView);
|
testListView(foldersView);
|
||||||
|
|
||||||
@ -65,7 +95,7 @@ EmptyFolderWidget::EmptyFolderWidget(QWidget *parent) :
|
|||||||
|
|
||||||
setContentsMargins(0,0,0,0);
|
setContentsMargins(0,0,0,0);
|
||||||
|
|
||||||
setStyleSheet("QWidget {background:#2A2A2A}");
|
setStyleSheet(QString("QWidget {background:%1}").arg(backgroundColor));
|
||||||
|
|
||||||
setSizePolicy(QSizePolicy ::Expanding , QSizePolicy ::Expanding );
|
setSizePolicy(QSizePolicy ::Expanding , QSizePolicy ::Expanding );
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
@ -99,7 +129,7 @@ void EmptyFolderWidget::onItemClicked(const QModelIndex &mi)
|
|||||||
void EmptyFolderWidget::paintEvent(QPaintEvent *)
|
void EmptyFolderWidget::paintEvent(QPaintEvent *)
|
||||||
{
|
{
|
||||||
QPainter painter (this);
|
QPainter painter (this);
|
||||||
painter.fillRect(0,0,width(),height(),QColor("#2A2A2A"));
|
painter.fillRect(0,0,width(),height(),QColor(backgroundColor));
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO remove repeated code in drag & drop support....
|
//TODO remove repeated code in drag & drop support....
|
||||||
|
@ -31,6 +31,7 @@ protected:
|
|||||||
QModelIndex parent;
|
QModelIndex parent;
|
||||||
QStringListModel * subfoldersModel;
|
QStringListModel * subfoldersModel;
|
||||||
void paintEvent(QPaintEvent *);
|
void paintEvent(QPaintEvent *);
|
||||||
|
QString backgroundColor;
|
||||||
|
|
||||||
//Drop to import
|
//Drop to import
|
||||||
void dragEnterEvent(QDragEnterEvent *event);
|
void dragEnterEvent(QDragEnterEvent *event);
|
||||||
|
@ -7,6 +7,12 @@
|
|||||||
NoSearchResultsWidget::NoSearchResultsWidget(QWidget *parent) :
|
NoSearchResultsWidget::NoSearchResultsWidget(QWidget *parent) :
|
||||||
QWidget(parent)
|
QWidget(parent)
|
||||||
{
|
{
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
backgroundColor = "#FFFFFF";
|
||||||
|
#else
|
||||||
|
backgroundColor = "#2A2A2A";
|
||||||
|
#endif
|
||||||
|
|
||||||
QVBoxLayout * layout = new QVBoxLayout;
|
QVBoxLayout * layout = new QVBoxLayout;
|
||||||
|
|
||||||
iconLabel = new QLabel();
|
iconLabel = new QLabel();
|
||||||
@ -15,7 +21,12 @@ NoSearchResultsWidget::NoSearchResultsWidget(QWidget *parent) :
|
|||||||
|
|
||||||
titleLabel = new QLabel("No results");
|
titleLabel = new QLabel("No results");
|
||||||
titleLabel->setAlignment(Qt::AlignCenter);
|
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;}");
|
titleLabel->setStyleSheet("QLabel {color:#CCCCCC; font-size:24px;font-family:Arial;font-weight:bold;}");
|
||||||
|
#endif
|
||||||
|
|
||||||
layout->addSpacing(100);
|
layout->addSpacing(100);
|
||||||
layout->addWidget(iconLabel);
|
layout->addWidget(iconLabel);
|
||||||
@ -27,7 +38,7 @@ NoSearchResultsWidget::NoSearchResultsWidget(QWidget *parent) :
|
|||||||
|
|
||||||
setContentsMargins(0,0,0,0);
|
setContentsMargins(0,0,0,0);
|
||||||
|
|
||||||
setStyleSheet("QWidget {background:#2A2A2A}");
|
setStyleSheet(QString("QWidget {background:%1}").arg(backgroundColor));
|
||||||
|
|
||||||
setSizePolicy(QSizePolicy ::Expanding , QSizePolicy ::Expanding );
|
setSizePolicy(QSizePolicy ::Expanding , QSizePolicy ::Expanding );
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
@ -36,5 +47,5 @@ NoSearchResultsWidget::NoSearchResultsWidget(QWidget *parent) :
|
|||||||
void NoSearchResultsWidget::paintEvent(QPaintEvent *)
|
void NoSearchResultsWidget::paintEvent(QPaintEvent *)
|
||||||
{
|
{
|
||||||
QPainter painter (this);
|
QPainter painter (this);
|
||||||
painter.fillRect(0,0,width(),height(),QColor("#2A2A2A"));
|
painter.fillRect(0,0,width(),height(),QColor(backgroundColor));
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ protected:
|
|||||||
QLabel * iconLabel;
|
QLabel * iconLabel;
|
||||||
QLabel * titleLabel;
|
QLabel * titleLabel;
|
||||||
void paintEvent(QPaintEvent *);
|
void paintEvent(QPaintEvent *);
|
||||||
|
QString backgroundColor;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user