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. Image Popup Animation
Forum Update on Monday, May 27th 2025

Image Popup Animation

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.0k 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.
  • E Offline
    E Offline
    elveatles
    wrote on last edited by
    #1

    I'm using PyQt to make a thumbnail image open into a full size image. I've been able to make this happen, but the animation looks all jerky and stupid for some reason. Also, mapToGlobal is giving me the wrong values. The image starts off about 30 pixels away vertically and 15 horizontally. Here's my popup class:

    @
    class ImagePopup(QLabel):
    def init(self, parent):
    super(ImagePopup, self).init(parent)

    self.setScaledContents(True)
    self.setPixmap(parent.pixmap())

    openWidth = parent.width() * 2
    openHeight = parent.height() * 2

    parentPosition = parent.mapToGlobal(parent.pos())
    openX = (parentPosition.x() + (parent.width() / 2) ) - (openWidth / 2)
    openY = (parentPosition.y() + (parent.height() / 2) ) - (openHeight / 2)

    self.openAnimation = QPropertyAnimation(self, "geometry")
    self.openAnimation.setDuration(500)
    self.openAnimation.setStartValue(QRect(parentPosition.x(), parentPosition.y(), parent.width(), parent.height()))
    self.openAnimation.setEndValue(QRect(openX, openY, openWidth, openHeight))
    self.openAnimation.setEasingCurve(QEasingCurve.InOutQuad)

    self.setWindowFlags(Qt.Popup | Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint | Qt.X11BypassWindowManagerHint)

    def open(self):
    self.openAnimation.start()

    def mousePressEvent(self, ev):
    super(ImagePopup, self).mousePressEvent(ev)

    self.openAnimation.stop()
    self.destroy()
    @

    Thank you for any help. I'm about to give up on this.

    1 Reply Last reply
    0

    • Login

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