Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Load image out of the resource files
Forum Updated to NodeBB v4.3 + New Features

Load image out of the resource files

Scheduled Pinned Locked Moved Unsolved Qt for Python
2 Posts 2 Posters 404 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Black CatB Offline
    Black CatB Offline
    Black Cat
    wrote on last edited by Black Cat
    #1

    It's possible to load images out of resource file?

    self.frame = QFrame(self.page_widgets)
    self.frame.setObjectName(u"frame")
    self.frame.setMinimumSize(QSize(122, 320))
    self.frame.setMaximumSize(QSize(16777215, 16777215))
    self.frame.setStyleSheet(u"background-color: rgb(27, 29, 35);\n"
    "border-radius: 5px;\n"
    "image: url(:/others/icons/printscreen.png);")
    

    Basically I'll need to change this "printscreen.png" file multiple times, but every time that I need to change this file I need to save the new file in resources and reload the resource file and this is inviable to me.

    1 - It's possible to load a image out of the resource file?
    2 - It's possible to load a image to resources without Qt Designer?

    Thanks

    JonBJ 1 Reply Last reply
    0
    • Black CatB Black Cat

      It's possible to load images out of resource file?

      self.frame = QFrame(self.page_widgets)
      self.frame.setObjectName(u"frame")
      self.frame.setMinimumSize(QSize(122, 320))
      self.frame.setMaximumSize(QSize(16777215, 16777215))
      self.frame.setStyleSheet(u"background-color: rgb(27, 29, 35);\n"
      "border-radius: 5px;\n"
      "image: url(:/others/icons/printscreen.png);")
      

      Basically I'll need to change this "printscreen.png" file multiple times, but every time that I need to change this file I need to save the new file in resources and reload the resource file and this is inviable to me.

      1 - It's possible to load a image out of the resource file?
      2 - It's possible to load a image to resources without Qt Designer?

      Thanks

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @Black-Cat
      You can read resources out of a resource file. But you cannot

      but every time that I need to change this file I need to save the new file in resources and reload the resource file and this is inviable to me.

      even if it's what you say you have to have! Resource files are read-only, generated at compile time. You can of course change which file you read in that string, if you have a variety of files saved in the resources. But you cannot write back anything to a resource file at runtime.

      Nor should you need to. Where are these "new file"s, how to you propose to generate them at runtime? If you do have to save to external file, you can save to the actual OS file system and then read that back as a png or whatever, but not as an embedded resource.

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved