Results 1 to 4 of 4

Thread: How to show two states of a rectangle in PyQt/PySide2

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,233
    Thanks
    303
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to show two states of a rectangle in PyQt/PySide2

    (as pixmaps are a possibility)
    Same principle as a brush. In Qt, QPixmap instances are reference-counted, so there is no overhead associated with changing the pixmap for a QGraphicsPixmapItem. QGraphicsPixmapItem::setPixmap() takes a const reference to a QPixmap, which implies that the graphics item stores a local copy, but that's not necessarily the case. Even when setting a pixmap is pass-by-value, the reference counting means that no actual copy is made unless the target of the copy modifies the original pixmap (ie. copy-on-write semantics apply).
    Last edited by d_stranz; 10th March 2020 at 04:25.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Replies: 5
    Last Post: 20th February 2020, 20:28
  2. Pyqt: How to show a QFileDialog?
    By robgeek in forum Qt Programming
    Replies: 3
    Last Post: 10th October 2016, 08:35
  3. QtPen draw wrong border for Rectangle (PyQt)
    By Goodwin in forum Qt Programming
    Replies: 4
    Last Post: 17th October 2014, 15:53
  4. QtQuick Rectangle control what borders show?
    By ricardodovalle in forum Qt Quick
    Replies: 3
    Last Post: 27th May 2014, 16:39
  5. gif files don't show after compiling with py2exe (using PyQt)
    By illuminatedwax in forum Installation and Deployment
    Replies: 4
    Last Post: 31st January 2011, 04:13

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.