How to add picture graphic image to gui qtpyvcp

  • aleksamc
  • aleksamc's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
15 Jan 2021 06:02 - 20 Jan 2021 18:08 #195404 by aleksamc
I want to add some help picture to gui linuxcnc in pyqtvcp.
I add it to recources file. Inside resources file I have
<RCC>
  <qresource lang="all" prefix="images">
    <file>help_stone.png</file>
  </qresource>
</RCC>

I tried 2 methods with Label:
1) In QSS stylesheet:
image: url(":/images/help_stone.png");
2) Rigth bottom press on label > Change rich text > chouse picture

Both ways picture adds to QT Designer and it seen. But When I run linuxcnc, place where picture should be is blank.
What I do wrong? I see other configurations has picture and they are even can rotate (for example tool change), but I'm stuck on so basic problem:side:
Last edit: 20 Jan 2021 18:08 by aleksamc.

Please Log in or Create an account to join the conversation.

  • aleksamc
  • aleksamc's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
21 Jan 2021 19:23 #196129 by aleksamc
It's realy nobody knows what problem is?
I saw a lot of QtPyVCP guis and they had graphic, I don't know what I'm doing wrong.

Please Log in or Create an account to join the conversation.

More
21 Jan 2021 20:20 - 21 Jan 2021 20:22 #196143 by Lcvette

It's realy nobody knows what problem is?
I saw a lot of QtPyVCP guis and they had graphic, I don't know what I'm doing wrong.

adding graphics requires the graphics to be in a directory specified for images with the correct path, you also need to add the image file path to the .qrc file, then you need to compile.





Attachments:
Last edit: 21 Jan 2021 20:22 by Lcvette.
The following user(s) said Thank You: tommylight

Please Log in or Create an account to join the conversation.

  • aleksamc
  • aleksamc's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
24 Jan 2021 18:03 - 24 Jan 2021 18:05 #196439 by aleksamc
Unfortunatly doesn't work:
I wrote in terminal:

qcompile stonecnc
Compiling .ui files in package 'stonecnc':
mainwindow.ui => mainwindow_ui.py ... ok

Compiling .qrc files in package 'stonecnc':
resources.qrc => resources_rc.py ... ok


My file qrc

File Attachment:

File Name: resources.qrc.txt
File Size:0 KB



But when I run linuxcnc I don't see any picture. Could be problem with Language settings?
Attachments:
Last edit: 24 Jan 2021 18:05 by aleksamc.
The following user(s) said Thank You: Lcvette

Please Log in or Create an account to join the conversation.

More
26 Jan 2021 04:44 #196603 by Lcvette

Unfortunatly doesn't work:
I wrote in terminal:

qcompile stonecnc
Compiling .ui files in package 'stonecnc':
mainwindow.ui => mainwindow_ui.py ... ok

Compiling .qrc files in package 'stonecnc':
resources.qrc => resources_rc.py ... ok


My file qrc

File Attachment:

File Name: resources.qrc.txt
File Size:0 KB



But when I run linuxcnc I don't see any picture. Could be problem with Language settings?


hmmm, not sure it should be working, how are you inserting the image into the ui?

Please Log in or Create an account to join the conversation.

  • aleksamc
  • aleksamc's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
02 Feb 2021 21:41 #197479 by aleksamc
I use QLabel, then I change it's QSS an there I add image: url(":/images/help_stone.png".
I explained it in the 1-st topic.

Please Log in or Create an account to join the conversation.

More
03 Feb 2021 02:53 #197519 by Lcvette
you need to place the label where you want it, then select it and in the property editor under QLabel/test/pixmap there is a drop down manu, select "choose resource" then in the new window that opens click on images, then select your image and click OK should be there, then you shouod run . qcompile and check your ui it should be there!

Please Log in or Create an account to join the conversation.

  • aleksamc
  • aleksamc's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
03 Feb 2021 10:06 #197533 by aleksamc
I think you will not believe me, but I did everything as you said. And I see image in qtdevelopper, and compilling finished witout errors. But linuxcnc still opens with blank image.

Please Log in or Create an account to join the conversation.

More
03 Feb 2021 14:53 #197553 by Lcvette
I just tested and it is working, im not sure why yours is not? what version of qtpyvcp do you have installed?

Please Log in or Create an account to join the conversation.

  • aleksamc
  • aleksamc's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
05 Feb 2021 05:47 #197706 by aleksamc
In Qt Designer is evrything fine, I see picture well.
But in Linuxcnc it's blank.
So linuxcnc is 2.8.1 version
and QtDesigner version is 5.11.3 as same as Qt.
All plugins are run except libpyqt5_py3.so

Could you add here some of yours picture that I could try to add and to see if problem is not in file?

Please Log in or Create an account to join the conversation.

Moderators: KCJLcvette
Time to create page: 0.154 seconds
Powered by Kunena Forum