Add a background to the sidebar
This commit is contained in:
parent
8b3972f447
commit
5d54d517ab
23
3rdparty/fancytabwidget/fancytabwidget.cpp
vendored
23
3rdparty/fancytabwidget/fancytabwidget.cpp
vendored
@ -477,14 +477,10 @@ void FancyTabWidget::removeTab(int index)
|
|||||||
m_tabBar->removeTab(index);
|
m_tabBar->removeTab(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FancyTabWidget::setBackgroundBrush(const QBrush &brush)
|
void FancyTabWidget::setBackgroundPixmap(const QPixmap& pixmap)
|
||||||
{
|
{
|
||||||
QPalette pal = m_tabBar->palette();
|
m_backgroundPixmap = pixmap;
|
||||||
pal.setBrush(QPalette::Mid, brush);
|
update();
|
||||||
m_tabBar->setPalette(pal);
|
|
||||||
pal = m_cornerWidgetContainer->palette();
|
|
||||||
pal.setBrush(QPalette::Mid, brush);
|
|
||||||
m_cornerWidgetContainer->setPalette(pal);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FancyTabWidget::paintEvent(QPaintEvent *event)
|
void FancyTabWidget::paintEvent(QPaintEvent *event)
|
||||||
@ -495,6 +491,19 @@ void FancyTabWidget::paintEvent(QPaintEvent *event)
|
|||||||
QRect rect = m_selectionWidget->rect().adjusted(0, 0, 1, 0);
|
QRect rect = m_selectionWidget->rect().adjusted(0, 0, 1, 0);
|
||||||
rect = style()->visualRect(layoutDirection(), geometry(), rect);
|
rect = style()->visualRect(layoutDirection(), geometry(), rect);
|
||||||
Utils::StyleHelper::verticalGradient(&painter, rect, rect);
|
Utils::StyleHelper::verticalGradient(&painter, rect, rect);
|
||||||
|
|
||||||
|
if (!m_backgroundPixmap.isNull()) {
|
||||||
|
QRect pixmap_rect(m_backgroundPixmap.rect());
|
||||||
|
pixmap_rect.moveTo(rect.topLeft());
|
||||||
|
|
||||||
|
while (pixmap_rect.top() < rect.bottom()) {
|
||||||
|
QRect source_rect(pixmap_rect.intersected(rect));
|
||||||
|
source_rect.moveTo(0, 0);
|
||||||
|
painter.drawPixmap(pixmap_rect.topLeft(), m_backgroundPixmap, source_rect);
|
||||||
|
pixmap_rect.moveTop(pixmap_rect.bottom() - 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
painter.setPen(Utils::StyleHelper::borderColor());
|
painter.setPen(Utils::StyleHelper::borderColor());
|
||||||
painter.drawLine(rect.topRight(), rect.bottomRight());
|
painter.drawLine(rect.topRight(), rect.bottomRight());
|
||||||
|
|
||||||
|
3
3rdparty/fancytabwidget/fancytabwidget.h
vendored
3
3rdparty/fancytabwidget/fancytabwidget.h
vendored
@ -140,7 +140,7 @@ public:
|
|||||||
void addTab(QWidget *tab, const QIcon &icon, const QString &label);
|
void addTab(QWidget *tab, const QIcon &icon, const QString &label);
|
||||||
void addSpacer(int size = 40);
|
void addSpacer(int size = 40);
|
||||||
void removeTab(int index);
|
void removeTab(int index);
|
||||||
void setBackgroundBrush(const QBrush &brush);
|
void setBackgroundPixmap(const QPixmap& pixmap);
|
||||||
void addCornerWidget(QWidget *widget);
|
void addCornerWidget(QWidget *widget);
|
||||||
void insertCornerWidget(int pos, QWidget *widget);
|
void insertCornerWidget(int pos, QWidget *widget);
|
||||||
int cornerWidgetCount() const;
|
int cornerWidgetCount() const;
|
||||||
@ -171,6 +171,7 @@ private:
|
|||||||
QStackedLayout *m_modesStack;
|
QStackedLayout *m_modesStack;
|
||||||
QWidget *m_selectionWidget;
|
QWidget *m_selectionWidget;
|
||||||
QStatusBar *m_statusBar;
|
QStatusBar *m_statusBar;
|
||||||
|
QPixmap m_backgroundPixmap;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@ -264,5 +264,6 @@
|
|||||||
<file>icons/32x32/wiimotedev.png</file>
|
<file>icons/32x32/wiimotedev.png</file>
|
||||||
<file>schema-17.sql</file>
|
<file>schema-17.sql</file>
|
||||||
<file>lyrics/ultimate_providers.xml</file>
|
<file>lyrics/ultimate_providers.xml</file>
|
||||||
|
<file>sidebar_background.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
BIN
data/sidebar_background.png
Normal file
BIN
data/sidebar_background.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
@ -189,6 +189,7 @@ MainWindow::MainWindow(NetworkAccessManager* network, Engine::Type engine, QWidg
|
|||||||
AddFancyTab(new QWidget, IconLoader::Load("view-media-lyrics"), tr("Artist info"));
|
AddFancyTab(new QWidget, IconLoader::Load("view-media-lyrics"), tr("Artist info"));
|
||||||
|
|
||||||
ui_->tabs->statusBar()->hide();
|
ui_->tabs->statusBar()->hide();
|
||||||
|
ui_->tabs->setBackgroundPixmap(QPixmap(":/sidebar_background.png"));
|
||||||
StyleHelper::setBaseColor(palette().color(QPalette::Highlight).darker());
|
StyleHelper::setBaseColor(palette().color(QPalette::Highlight).darker());
|
||||||
|
|
||||||
track_position_timer_->setInterval(1000);
|
track_position_timer_->setInterval(1000);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user