fixed retina-OSX icons in the side bar

This commit is contained in:
Luis Ángel San Martín 2015-08-20 22:30:20 +02:00
parent 05a6d433d7
commit 1d59ba206a
22 changed files with 40 additions and 11 deletions

View File

@ -64,6 +64,7 @@
<file>../images/sidebar/expanded_branch_osx.png</file>
<file>../images/sidebar/libraryIconSelected.png</file>
<file>../images/sidebar/libraryOptions.png</file>
<file>../images/sidebar/libraryOptions@2x.png</file>
<file>../images/sidebar/branch-open.png</file>
<file>../images/sidebar/branch-closed.png</file>
<file>../images/sidebar/expanded_branch_selected.png</file>

View File

@ -16,16 +16,32 @@ YACReaderLibraryItemWidget::YACReaderLibraryItemWidget(QString n/*ame*/, QString
QPixmap iconPixmap(":/images/sidebar/libraryIcon.png");
icon = new QLabel(this);
icon->setPixmap(iconPixmap);
icon->setPixmap(iconPixmap);
nameLabel = new QLabel(name,this);
options = new QToolButton(this);
options = new QToolButton(this);
#ifdef Q_OS_MAC
//TODO fix this crazy hack for having a propper retina icon for the options
//this hack has been perpetrated using Qt 5.5.0
QString sourceOptionsImage;
if(devicePixelRatio()>1)
sourceOptionsImage = ":/images/sidebar/libraryOptions@2x.png";
else
sourceOptionsImage = ":/images/sidebar/libraryOptions.png";
QPixmap iconOptionsPixmap(sourceOptionsImage);
iconOptionsPixmap.setDevicePixelRatio(devicePixelRatio());
QLabel * helperLabel = new QLabel(options);
helperLabel->move(4,2);
helperLabel->setFixedSize(14,14);
helperLabel->setPixmap(iconOptionsPixmap);
#else
options->setIcon(QIcon(":/images/sidebar/libraryOptions.png"));
#endif
options->setHidden(true);
options->setFixedWidth(18);
options->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Minimum);
options->setStyleSheet("QToolButton {border:none;}");
options->setFixedWidth(18);
options->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Minimum);
options->setStyleSheet("QToolButton {border:none;}");
connect(options,SIGNAL(clicked()),this,SIGNAL(showOptions()));
/*up = new QToolButton(this);
up->setIcon(QIcon(":/images/libraryUp.png"));

View File

@ -1,12 +1,12 @@
#include "yacreader_titled_toolbar.h"
#include <QAction>
#include <QHBoxLayout>
#include <QLabel>
#include <QPixmap>
#include <QToolButton>
#include <QGraphicsDropShadowEffect>
#include <QPainter>
#include <QPixmap>
#include <QPushButton>
#include <QToolButton>
DropShadowLabel::DropShadowLabel(QWidget* parent) :
@ -95,14 +95,26 @@ void YACReaderTitledToolBar::addAction(QAction * action)
{
QHBoxLayout * mainLayout = dynamic_cast<QHBoxLayout *>(layout());
QToolButton * tb = new QToolButton(this);
//fix for QToolButton and retina support in OSX
#ifdef Q_OS_MAC
QPushButton * pb = new QPushButton(this);
pb->setCursor(QCursor(Qt::ArrowCursor));
pb->setIcon(action->icon());
pb->addAction(action);
connect(pb, SIGNAL(clicked(bool)), action, SIGNAL(triggered(bool)));
mainLayout->addWidget(pb);
#else
QToolButton * tb = new QToolButton(this);
tb->setCursor(QCursor(Qt::ArrowCursor));
tb->setDefaultAction(action);
tb->setIconSize(QSize(16,16));
tb->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
//tb->setStyleSheet("QToolButton:hover {background-color:#C5C5C5;}");
mainLayout->addWidget(tb);
mainLayout->addWidget(tb);
#endif
}
void YACReaderTitledToolBar::addSpacing(int spacing)

BIN
images/sidebar/addLabelIcon_osx.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 242 B

After

Width:  |  Height:  |  Size: 242 B

BIN
images/sidebar/addLabelIcon_osx@2x.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 364 B

After

Width:  |  Height:  |  Size: 342 B

BIN
images/sidebar/addNew_sidebar_osx.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 171 B

After

Width:  |  Height:  |  Size: 175 B

BIN
images/sidebar/addNew_sidebar_osx@2x.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 219 B

After

Width:  |  Height:  |  Size: 245 B

BIN
images/sidebar/colapse_osx.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 207 B

After

Width:  |  Height:  |  Size: 216 B

BIN
images/sidebar/colapse_osx@2x.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 298 B

After

Width:  |  Height:  |  Size: 319 B

BIN
images/sidebar/delete_sidebar_osx.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 187 B

After

Width:  |  Height:  |  Size: 195 B

BIN
images/sidebar/delete_sidebar_osx@2x.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 202 B

After

Width:  |  Height:  |  Size: 212 B

BIN
images/sidebar/expand_osx.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 168 B

After

Width:  |  Height:  |  Size: 183 B

BIN
images/sidebar/expand_osx@2x.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 208 B

After

Width:  |  Height:  |  Size: 245 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 B

BIN
images/sidebar/newLibraryIcon_osx.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 169 B

After

Width:  |  Height:  |  Size: 171 B

BIN
images/sidebar/newLibraryIcon_osx@2x.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 219 B

After

Width:  |  Height:  |  Size: 245 B

BIN
images/sidebar/openLibraryIcon_osx.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 232 B

After

Width:  |  Height:  |  Size: 244 B

BIN
images/sidebar/openLibraryIcon_osx@2x.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 335 B

After

Width:  |  Height:  |  Size: 331 B

BIN
images/sidebar/renameListIcon_osx.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 254 B

After

Width:  |  Height:  |  Size: 256 B

BIN
images/sidebar/renameListIcon_osx@2x.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 364 B

After

Width:  |  Height:  |  Size: 370 B

BIN
images/sidebar/setRoot_osx.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 271 B

After

Width:  |  Height:  |  Size: 276 B

BIN
images/sidebar/setRoot_osx@2x.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 421 B

After

Width:  |  Height:  |  Size: 438 B