KIconLoader

Aurélien Gâteau agateau at kde.org
Tue Apr 13 16:49:42 BST 2010


On 13/04/2010 16:34, Lynn Hazan wrote:
> This is a new attempt to get help on a KIconLoader issue.
> 
> I just want to specify my own cursors in KDE4 (the images are in a dedicated 
> directory.), doing something like:
> 
> QCursor(loader->loadIcon("zoom_cursor", KIconLoader::NoGroup),0,0);
> 
> I am using CMake, is there a specific macro?

Hi Lynn,

You can use this line in your CMakeLists.txt to install the icons:

install(
  FILES zoom_cursor.png
  DESTINATION ${DATA_INSTALL_DIR}/name_of_your_application
  )

You should then be able to load them with:

  QString path = KStandardDirs::locate("appdata", "zoom_cursor.png");
  QPixmap cursorPixmap = QPixmap(path);
  QCursor(cursorPixmap);

This is what I do to load a zoom cursor in Gwenview (you can have a look
at kdegraphics/gwenview/cursors/CMakeLists.txt and
kdegraphics/gwenview/lib/scrolltool.cpp)

Aurélien




More information about the kde-core-devel mailing list