Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to invoke QBrush.setTexture() with QPixmap on QGraphicsRectItem?
Forum Updated to NodeBB v4.3 + New Features

How to invoke QBrush.setTexture() with QPixmap on QGraphicsRectItem?

Scheduled Pinned Locked Moved Solved General and Desktop
24 Posts 4 Posters 7.3k Views 2 Watching
  • 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.
  • mrjjM Offline
    mrjjM Offline
    mrjj
    Lifetime Qt Champion
    wrote on last edited by
    #21
    • But the png cannot be redraw immediately only I move the cursor or focus the window.

    That is the part i dont understand.
    It should trigger paint()!?!

    • So, is it possible to show the png in the GraphicsRectItem?
      Yes , same as with QGraphicsItem , but i be surprised if that alters anything.

    When calling update() it should draw the png. Else there is a bug in the code. or something im not aware of.
    You should looking to this. Using break points. etc.

    item->update() should trigger paint() , else i have no idea what is going on.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      Asperamanca
      wrote on last edited by
      #22

      Do not confuse paintEvent with paint.
      paintEvent is for Widgets
      paint is for GraphicsItems

      1 Reply Last reply
      0
      • K Offline
        K Offline
        Kevin Zhong
        wrote on last edited by Kevin Zhong
        #23

        Hi all,

        Finally, I solved this problems.
        @mrjj, as you mentioned that use

        item->update()
        

        WORKs.

        My code is a little bit complex, all the item were originated from a template:

        template <typename T, typename Event>
        class DeviceEventHandler : public Event, public QObject
        

        At the beginning, I try to update the from the template, it doesn't work.
        Then I move the

        update()
        

        method in the all the subclass, then the pixmap can be updated automatically.

        So, really thanks for your patience and kindly support.

        Have a nice weekend.

        PS: Be honest, I am newbie in Qt area and I got so kindly support. I really appreciate your kindness. :)

        BRs
        Kevin

        mrjjM 1 Reply Last reply
        2
        • K Kevin Zhong

          Hi all,

          Finally, I solved this problems.
          @mrjj, as you mentioned that use

          item->update()
          

          WORKs.

          My code is a little bit complex, all the item were originated from a template:

          template <typename T, typename Event>
          class DeviceEventHandler : public Event, public QObject
          

          At the beginning, I try to update the from the template, it doesn't work.
          Then I move the

          update()
          

          method in the all the subclass, then the pixmap can be updated automatically.

          So, really thanks for your patience and kindly support.

          Have a nice weekend.

          PS: Be honest, I am newbie in Qt area and I got so kindly support. I really appreciate your kindness. :)

          BRs
          Kevin

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #24

          @Kevin-Zhong

          Hi
          You are most welcome. we do like Qt newbies here :)

          It was a bit odd with update() but good you found the solution.
          Still not sure why it didn't trigger inside SetStatus :)
          Good weekend to you too

          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