mirror of
https://github.com/YACReader/yacreader
synced 2025-05-28 03:10:27 -04:00
corregida la drop shadow label
This commit is contained in:
parent
41af5cbab5
commit
ebdb21f5a2
@ -230,11 +230,11 @@ void LibraryWindow::doLayout()
|
||||
l->addWidget(librariesTitle);
|
||||
l->addWidget(selectedLibrary);
|
||||
|
||||
YACReaderTitledToolBar * foldersTitle = new YACReaderTitledToolBar(tr("FOLDERS"));
|
||||
YACReaderTitledToolBar * foldersTitle = new YACReaderTitledToolBar(tr("FOLDERS"));
|
||||
|
||||
foldersTitle->addAction(setRootIndexAction);
|
||||
foldersTitle->addAction(setRootIndexAction);
|
||||
foldersTitle->addAction(expandAllNodesAction);
|
||||
foldersTitle->addAction(colapseAllNodesAction);
|
||||
foldersTitle->addAction(colapseAllNodesAction);
|
||||
|
||||
l->addWidget(foldersTitle);
|
||||
l->addWidget(foldersView);
|
||||
|
@ -13,6 +13,16 @@ DropShadowLabel::DropShadowLabel(QWidget* parent) :
|
||||
QLabel(parent)
|
||||
{ }
|
||||
|
||||
void DropShadowLabel::drawText(QPainter *painter,
|
||||
QPoint offset)
|
||||
{
|
||||
Q_ASSERT(painter != 0);
|
||||
|
||||
// Draw shadow.
|
||||
painter->setPen(QPen(textColor));
|
||||
painter->drawText(rect().translated(offset),
|
||||
alignment(), text());
|
||||
}
|
||||
void DropShadowLabel::drawTextEffect(QPainter *painter,
|
||||
QPoint offset)
|
||||
{
|
||||
@ -26,11 +36,18 @@ void DropShadowLabel::drawTextEffect(QPainter *painter,
|
||||
|
||||
void DropShadowLabel::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
|
||||
QPainter painter(this);
|
||||
painter.setFont(font());
|
||||
//TODO find where is the '3' comming from?
|
||||
drawTextEffect(&painter, QPoint(contentsMargins().left()+3, 1));
|
||||
QLabel::paintEvent(event);
|
||||
//TODO find where is the '3' comming from?
|
||||
drawTextEffect(&painter, QPoint(contentsMargins().left(), 1));
|
||||
drawText(&painter, QPoint(contentsMargins().left(), 0));
|
||||
}
|
||||
|
||||
void DropShadowLabel::setColor(const QColor & color)
|
||||
{
|
||||
textColor = color;
|
||||
}
|
||||
|
||||
void DropShadowLabel::setDropShadowColor(const QColor & color)
|
||||
@ -50,13 +67,15 @@ YACReaderTitledToolBar::YACReaderTitledToolBar(const QString & title, QWidget *p
|
||||
QString styleSheet = "QWidget {border:0px;}";
|
||||
setStyleSheet(styleSheet);
|
||||
|
||||
DropShadowLabel * nameLabel = new DropShadowLabel(this);
|
||||
nameLabel = new DropShadowLabel(this);
|
||||
nameLabel->setText(title);
|
||||
#ifdef Q_OS_MAC
|
||||
QString nameLabelStyleSheet = "QLabel {color:#707E8C; padding:0 0 0 7px; margin:0px; font-size:11px; font-weight:bold;}";
|
||||
QString nameLabelStyleSheet = "QLabel {padding:0 0 0 10px; margin:0px; font-size:11px; font-weight:bold;}";
|
||||
nameLabel->setColor(QColor("#707E8C"));
|
||||
nameLabel->setDropShadowColor(QColor("#F9FAFB"));
|
||||
#else
|
||||
QString nameLabelStyleSheet = "QLabel {color:#BDBFBF; padding:0 0 0 7px; margin:0px; font-size:11px; font-weight:bold;}";
|
||||
QString nameLabelStyleSheet = "QLabel {padding:0 0 0 10px; margin:0px; font-size:11px; font-weight:bold;}";
|
||||
nameLabel->setColor(QColor("#BDBFBF"));
|
||||
nameLabel->setDropShadowColor(QColor("#000000"));
|
||||
#endif
|
||||
nameLabel->setStyleSheet(nameLabelStyleSheet);
|
||||
@ -82,5 +101,5 @@ void YACReaderTitledToolBar::addAction(QAction * action)
|
||||
tb->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
|
||||
//tb->setStyleSheet("QToolButton:hover {background-color:#C5C5C5;}");
|
||||
|
||||
mainLayout->addWidget(tb);
|
||||
mainLayout->addWidget(tb);
|
||||
}
|
||||
|
@ -17,10 +17,13 @@ public:
|
||||
|
||||
DropShadowLabel(QWidget* parent = 0);
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void setColor(const QColor & color);
|
||||
void setDropShadowColor(const QColor & color);
|
||||
private:
|
||||
|
||||
QColor dropShadowColor;
|
||||
QColor textColor;
|
||||
void drawText(QPainter *painter, QPoint offset);
|
||||
void drawTextEffect(QPainter* painter, QPoint offset);
|
||||
};
|
||||
|
||||
@ -34,6 +37,9 @@ signals:
|
||||
|
||||
public slots:
|
||||
void addAction(QAction * action);
|
||||
|
||||
private:
|
||||
DropShadowLabel * nameLabel;
|
||||
};
|
||||
|
||||
#endif // YACREADER_TITLED_TOOLBAR_H
|
||||
|
Loading…
Reference in New Issue
Block a user