In Qt6.4.2 I want to make a imageButton
-
OS: debian11
Target : android
Qt version : 6.4.2I want create a image Button.
QString testPath = ":/icons/play.png"; playButton = new QPushButton; { QPixmap buttonImage; if (buttonImage.load(testPath)) { QIcon icon(buttonImage); playButton->setIcon(icon); playButton->setIconSize(QSize(50, 50)); } else { label->setText("fail"); } }always fail.
my project path is "~/dev/qt/"
project name is "android"
and images are included in "icons" folder.I tried
":~/dev/qt/android/icons/play.png"
":/home/[account name]/dev/qt/android/icons/play.png"
":/icons/play.png"all is fail.
Could you tell me How to fix my code?
-
OS: debian11
Target : android
Qt version : 6.4.2I want create a image Button.
QString testPath = ":/icons/play.png"; playButton = new QPushButton; { QPixmap buttonImage; if (buttonImage.load(testPath)) { QIcon icon(buttonImage); playButton->setIcon(icon); playButton->setIconSize(QSize(50, 50)); } else { label->setText("fail"); } }always fail.
my project path is "~/dev/qt/"
project name is "android"
and images are included in "icons" folder.I tried
":~/dev/qt/android/icons/play.png"
":/home/[account name]/dev/qt/android/icons/play.png"
":/icons/play.png"all is fail.
Could you tell me How to fix my code?
@rhaps20 said in In Qt6.4.2 I want to make a imageButton:
and images are included in "icons" folder.
Did you add these images to a resource file (https://doc.qt.io/qt-5/resources.html)?
-
@rhaps20 said in In Qt6.4.2 I want to make a imageButton:
and images are included in "icons" folder.
Did you add these images to a resource file (https://doc.qt.io/qt-5/resources.html)?