Merged luisangelsm/yacreader into default

This commit is contained in:
Felix Kauselmann
2015-08-27 10:34:33 +02:00
parent 23c33cef61
commit 14fed7aba0
95 changed files with 350 additions and 177 deletions

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) :
@ -40,8 +40,9 @@ void DropShadowLabel::paintEvent(QPaintEvent *event)
QPainter painter(this);
painter.setFont(font());
//TODO find where is the '3' comming from?
#ifndef Q_OS_MAC
drawTextEffect(&painter, QPoint(contentsMargins().left(), 1));
#endif
drawText(&painter, QPoint(contentsMargins().left(), 0));
}
@ -71,8 +72,8 @@ YACReaderTitledToolBar::YACReaderTitledToolBar(const QString & title, QWidget *p
nameLabel->setText(title);
#ifdef Q_OS_MAC
QString nameLabelStyleSheet = "QLabel {padding:0 0 0 10px; margin:0px; font-size:11px; font-weight:bold;}";
nameLabel->setColor(QColor("#707E8C"));
nameLabel->setDropShadowColor(QColor("#F9FAFB"));
nameLabel->setColor(QColor("#808080"));
//nameLabel->setDropShadowColor(QColor("#F9FAFB"));
#else
QString nameLabelStyleSheet = "QLabel {padding:0 0 0 10px; margin:0px; font-size:11px; font-weight:bold;}";
nameLabel->setColor(QColor("#BDBFBF"));
@ -95,14 +96,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)