Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. What is the equivalent of qml's Image type in C++?

What is the equivalent of qml's Image type in C++?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 2 Posters 391 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.
  • S Offline
    S Offline
    sofiane
    wrote on last edited by
    #1

    How can I load an image to a window using c++ like we do with the Image type in qml.

    Image{
    id: image
    source: "image.png"
     }
    
    J.HilkJ 1 Reply Last reply
    0
    • S sofiane

      How can I load an image to a window using c++ like we do with the Image type in qml.

      Image{
      id: image
      source: "image.png"
       }
      
      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      @sofiane probably by using QLabel or you overwrite the paintEvent of any widget you want and paint it there using QPainter


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      S 1 Reply Last reply
      2
      • J.HilkJ J.Hilk

        @sofiane probably by using QLabel or you overwrite the paintEvent of any widget you want and paint it there using QPainter

        S Offline
        S Offline
        sofiane
        wrote on last edited by sofiane
        #3

        @J-Hilk Thank you, do you have an Idea how to implement it in a qt3DWindow ?

        J.HilkJ 1 Reply Last reply
        0
        • S sofiane

          @J-Hilk Thank you, do you have an Idea how to implement it in a qt3DWindow ?

          J.HilkJ Offline
          J.HilkJ Offline
          J.Hilk
          Moderators
          wrote on last edited by J.Hilk
          #4

          @sofiane Thats a different pig to slaughter!

          I have no idea, never used Qt3D, but looking at the documentation / examples, maybe by mapping a QTextureImage to a rectangle ?
          Similar to this example:
          https://doc.qt.io/qt-5.10/qt3d-materials-cpp-example.html


          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          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