Icons from resource file not showing
-
wrote on 15 Nov 2017, 06:55 last edited by saber
I am in linux.And i am using Qt 5.9
I found this app's source code from git hub.
Creator of this app, include icon from the system theme .
In this app i included a resource file and select a push button's icon from the resource file that i include.
It shows in Qt creator ,but shwoing blank Pushbutton after build.I deleted every code that named theme and icon,but no change.
Icon from system theme shows after build .But icon selected from resource file are not showing.
What i can do to show icon from my resource file??
What code do i remove to not show icon from system theme? -
wrote on 15 Nov 2017, 07:06 last edited by
Delete your build folder. Clean your project, qmake and build and then run your project.
-
wrote on 15 Nov 2017, 07:10 last edited by saber
I did it .but no change.
I think it is in code to select the icon from theme.
the app is "lximage-qt" -
wrote on 15 Nov 2017, 10:39 last edited by Vinod Kuntoji
@saber ,
Show me your code -
@saber ,
Show me your codewrote on 15 Nov 2017, 12:46 last edited by saber@Vinod-Kuntoji
thanks for help.
as a new user in the forum ,i can't upload a zip folder.
here is the cmake file of it.
https://forum.qt.io/topic/85016/convert-cmake-file-to-qmakeand here is the original code.from github
https://github.com/lxde/lximage-qt -
Hi,
Please show the content of your .qrc file and the part of the code where you load the icons.
-
wrote on 16 Nov 2017, 03:26 last edited by saber
-
Here is the qrc file
I use this code first
QPixmap iu("<:/icons/before.png>"); ui.cNext->setIcon(iu);
But not showing the icon.
so i apply the icons from designer
and also see the output .the icon is not showing in after build.
thanks. -
wrote on 16 Nov 2017, 04:08 last edited by
-
as i am using qt 5 i used
ui.cPrevious->setIcon(QIcon("qrc:/icons/left.ico"));but no result.I don't understand .It should work with code and designer.
i think writer of this code made something to take only select the icone from system theme.wrote on 16 Nov 2017, 05:27 last edited by joeQ@saber hi, you use
cmake
. maybe some error incmake
. like source path not set right.if use
qmake
, my snippet code is ok. you can check the the path incmake
.or To try the
absolute path
. like following snippet:QPixmap pix; if(pix.load("absolute icon path")){ qDebug("icon load ok"); QIcon ico(pix); ui->btn->setIcon(ico); }
-
@saber hi, you use
cmake
. maybe some error incmake
. like source path not set right.if use
qmake
, my snippet code is ok. you can check the the path incmake
.or To try the
absolute path
. like following snippet:QPixmap pix; if(pix.load("absolute icon path")){ qDebug("icon load ok"); QIcon ico(pix); ui->btn->setIcon(ico); }
wrote on 16 Nov 2017, 08:01 last edited by saber@joeQ
nothing.
please can u see my post to convert it cmake file to qmake.
i think it will solve the problem.
https://forum.qt.io/topic/85016/convert-cmake-file-to-qmake
6/11