Re: Thumbnail Bar

"Ilya Konkov" <[email protected]> Wed, 2 Apr 2008 12:30:30 +0600
Newsgroups gmane.comp.kde.gwenview
Message-ID <[email protected]>
> > 1. Scrollbar's arrows.
> > Seems that I have to specify url for image. How and into what dir
> > should I put images of arrows?
>
> Hum... this is a bit tedious, because the Qt stylesheet system looks at
> relative urls from the current working directories. I suggest creating a
>   "pics" dir at the top level, and putting your images in it.
> Then you can create a CMakeLists.txt similar to the one in "cursors/" to
> get your images installed.
> Your code should use the full path to the images. Assuming you have a
> scroll-left.png file in pics, you can get its full path with:
> KStandardDirs::locate("appdata", "pics/scroll-left.png");

Screenshot:
http://img249.imageshack.us/img249/7686/gwenview02040lb9.png

--
Ilya Konkov

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

_______________________________________________
Gwenview-general mailing list
Gwenview-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/gwenview-general
arrows.patch (text/x-patch, 2.8 KB)
Index: app/thumbnailbarview.cpp
===================================================================
--- app/thumbnailbarview.cpp	(revision 792765)
+++ app/thumbnailbarview.cpp	(working copy)
@@ -31,6 +31,7 @@
 #include <QToolTip>
 #include <QWindowsStyle>
 // KDE
+#include <kstandarddirs.h>
 
 // Local
 #include "lib/paintutils.h"
@@ -342,13 +343,40 @@
 			"QScrollBar:horizontal {"
 			"	background-color: transparent;"
 			"	height: 8px;"
+			"	margin: 0 10px 0px 10px;"
 			"	padding: 0 2px 0px 2px;"
 			"}"
-			"QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal, "
-			"QScrollBar::add-line:horizontal, QScrollBar::sub-line:horizontal {"
+			"QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal { "
 			"	width: 0px;"
 			"	border: 0px;"
+			"}"
+			"QScrollBar::add-line:horizontal {"
+			"	width: 10px;"
+			"	border: 0px;"
+			"	background: transparent;"
+			"	subcontrol-position: right;"
+			"	subcontrol-origin: margin;"
+			"}"
+			"QScrollBar::sub-line:horizontal {"
+			"	width: 10px;"
+			"	border: 0px;"
+			"	background: transparent;"
+			"	subcontrol-position: left;"
+			"	subcontrol-origin: margin;"
+			"}"
+			"QScrollBar:left-arrow:horizontal {"
+			"	background: url(%1);"
+			"	height: 7px;"
+			"	width: 7px;"
+			"}"
+			"QScrollBar:right-arrow:horizontal {"
+			"	background: url(%2);"
+			"	height: 7px;"
+			"	width: 7px;"
 			"}";
+		scrollbarCss = scrollbarCss.arg(
+			KStandardDirs::locate("appdata", "pics/scroll-left.png"),
+			KStandardDirs::locate("appdata", "pics/scroll-right.png"));
 
 		QString handle =
 			"background:"
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt	(revision 792765)
+++ CMakeLists.txt	(working copy)
@@ -6,5 +6,6 @@
 subdirs(tests)
 subdirs(icons)
 subdirs(cursors)
+subdirs(pics)
 
 configure_file(config-gwenview.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-gwenview.h)
Index: pics/scroll-left.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: pics/scroll-left.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Index: pics/scroll-right.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: pics/scroll-right.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Index: pics/CMakeLists.txt
===================================================================
--- pics/CMakeLists.txt	(revision 0)
+++ pics/CMakeLists.txt	(revision 0)
@@ -0,0 +1,4 @@
+install(
+	FILES scroll-left.png scroll-right.png
+	DESTINATION ${DATA_INSTALL_DIR}/gwenview/pics/
+	)
scroll-left.png (image/png, 292 B) - not displayed
scroll-right.png (image/png, 292 B) - not displayed