This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Can't install custom icon for personal KDE app

Tags: None
(comma "," separated)
woki
Registered Member
Posts
11
Karma
0
OS
hi guys. I'm writing on this forum because I haven't managed to solve the issue via irc or on the web. Sorry to keep bugging you, but this problem is making me go bonkers! The problem may be simple for you, but for a first timer like me, it's not. I can't manage to get my app to install custom icons and use them ( the icons are named "hi<size>-app-<myappname>.png" ). Here are a few lines i used on my program
Code: Select all
MAIN CMAKE

project( urtcontroller )

find_package( KDE4 REQUIRED )
include( KDE4Defaults )
include_directories( ${KDE4_INCLUDES} )

add_subdirectory( icons )

set(urtcontroller_SRCS
    src/main.cpp
    src/mainwindow.cpp
)

kde4_add_executable( urtcontroller ${urtcontroller_SRCS} )

target_link_libraries( urtcontroller ${KDE4_KDEUI_LIBS} )
install( TARGETS urtcontroller DESTINATION ${BIN_INSTALL_DIR} )


then the icons cmake file ( all icons are named "hi<size>-app-<my app name>.png"
Code: Select all
kde4_install_icons( ${ICON_INSTALL_DIR} )


ande finally here is the source code line i use to load the icon
Code: Select all
MainWindow::MainWindow( KApplication *app, QWidget *parent )
    : KMainWindow( parent )
    , m_menuBar( 0 )
    , m_quitAction( 0 )
    , m_addServerAction( 0 )
    , m_app( app )
    , m_about( 0 )
{
    setWindowIcon( KIcon( "urtcontroller" ) );     // <- the incriminated line!
    setFixedSize( 600, 400 );
    setupMenu();
}


Anyone got a clue on why i can't set the icon on my application and why i get a "unknown" or blank icon?

Thanks
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
If you open "kdialog --geticon app" can you find your icon there? It will output the name you need to use in your app.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
woki
Registered Member
Posts
11
Karma
0
OS
bcooksley wrote:If you open "kdialog --geticon app" can you find your icon there? It will output the name you need to use in your app.


I did as said but couldn't find my icon under the "app" section.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Can you confirm that $PREFIX/share/icons/hicolor/<size>/apps/<iconname>.png
<size> can be 32x32, 64x64, etc.
<iconname> is your application's name.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
woki
Registered Member
Posts
11
Karma
0
OS
Yes i can confirm this. Here is the output of my "make install"
Code: Select all
Install the project...
-- Install configuration: "RelWithDebInfo"
-- Installing: /usr/local/bin/urtcontroller
-- Set runtime path of "/usr/local/bin/urtcontroller" to "/usr/local/lib"
-- Up-to-date: /usr/local/share/icons/hicolor/22x22/apps/./urtcontroller.png
-- Up-to-date: /usr/local/share/icons/hicolor/16x16/apps/./urtcontroller.png
-- Up-to-date: /usr/local/share/icons/hicolor/32x32/apps/./urtcontroller.png


p.s before writing this post i was on fluxbox and tried my program just to see what it was like under Flux, and here i can see the icon set correctly( still can't see it in the KAboutData though ).
Maybe something wrong with my kde?
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
The icon cache may not be picking it up. Try removing /var/tmp/kdecache-$USER/ outside KDE.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
woki
Registered Member
Posts
11
Karma
0
OS
Looks like everything is ok now. But it's behaviour was strange. Isn't kde supposed to cache the icons immediatley? How does it work?
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
The cache should usually be updated, I don't know why it didn't.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot], rockscient