From d4dff8809a5cc5a1868acedd3c543c511a517499 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Thu, 14 Jun 2012 08:44:36 +0200 Subject: [PATCH] * Added styleScrollBar method to TomahawkUtils. --- src/libtomahawk/utils/TomahawkUtilsGui.cpp | 25 ++++++++++++++++++++++ src/libtomahawk/utils/TomahawkUtilsGui.h | 4 +++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/libtomahawk/utils/TomahawkUtilsGui.cpp b/src/libtomahawk/utils/TomahawkUtilsGui.cpp index ccf8cdf2c..9a814a3e5 100644 --- a/src/libtomahawk/utils/TomahawkUtilsGui.cpp +++ b/src/libtomahawk/utils/TomahawkUtilsGui.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -441,4 +442,28 @@ prepareStyleOption( QStyleOptionViewItemV4* option, const QModelIndex& index, Pl } } + +void +styleScrollBar( QScrollBar* scrollBar ) +{ + scrollBar->setStyleSheet( + "QScrollBar:horizontal { background-color: transparent; }" + "QScrollBar::handle:horizontal { border-height: 9px; margin-bottom: 6px;" + "border-image: url(" RESPATH "images/scrollbar-horizontal-handle.png) 3 3 3 3 stretch stretch;" + "border-top: 3px transparent; border-bottom: 3px transparent; border-right: 3px transparent; border-left: 3px transparent; }" + "QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal { width: 0px; height: 0px; background: none; }" + "QScrollBar::add-line:horizontal, QScrollBar::sub-line:horizontal { width: 0px; height: 0px; background: none; }" + "QScrollBar:left-arrow:horizontal, QScrollBar::right-arrow:horizontal {" + "border: 0px; width: 0px; height: 0px; background: none; background-color: transparent; }" + + "QScrollBar:vertical { background-color: transparent; }" + "QScrollBar::handle:vertical { border-width: 9px; margin-right: 6px;" + "border-image: url(" RESPATH "images/scrollbar-vertical-handle.png) 3 3 3 3 stretch stretch;" + "border-top: 3px transparent; border-bottom: 3px transparent; border-right: 3px transparent; border-left: 3px transparent; }" + "QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { width: 0px; height: 0px; background: none; }" + "QScrollBar::add-line:vertical, QScrollBar::sub-line:vertical { width: 0px; height: 0px; background: none; }" + "QScrollBar:up-arrow:vertical, QScrollBar::down-arrow:vertical {" + "border: 0px; width: 0px; height: 0px; background: none; background-color: transparent; }" ); +} + } // ns diff --git a/src/libtomahawk/utils/TomahawkUtilsGui.h b/src/libtomahawk/utils/TomahawkUtilsGui.h index 1c89f8bce..df89d9bc8 100644 --- a/src/libtomahawk/utils/TomahawkUtilsGui.h +++ b/src/libtomahawk/utils/TomahawkUtilsGui.h @@ -35,6 +35,7 @@ class QPixmap; class QLayout; class QPalette; class QRect; +class QScrollBar; namespace TomahawkUtils { @@ -59,7 +60,8 @@ namespace TomahawkUtils DLLEXPORT QPixmap defaultPixmap( ImageType type, ImageMode mode = TomahawkUtils::Original, const QSize& size = QSize( 0, 0 ) ); DLLEXPORT void prepareStyleOption( QStyleOptionViewItemV4* option, const QModelIndex& index, PlayableItem* item ); - + + DLLEXPORT void styleScrollBar( QScrollBar* scrollBar ); } #endif // TOMAHAWKUTILSGUI_H