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. setPixmap called with wrong arguments, but arent they the right arguments?
Qt 6.11 is out! See what's new in the release blog

setPixmap called with wrong arguments, but arent they the right arguments?

Scheduled Pinned Locked Moved Unsolved Qt for Python
3 Posts 3 Posters 1.7k Views 1 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.
  • I Offline
    I Offline
    IDontKnowHowToCode
    wrote on last edited by
    #1

    67b73087-67e3-4ca3-87b5-c8956504e6b5-image.png

    I'm trying to call setPixmap(pm) where pmis a QImage, however pyqt throws the following error. I dont understand whats wrong, it said it expected an of these: Union[QPixmap, QImage, str] and I provided a QImage.

    JonBJ CristianMaureiraC 2 Replies Last reply
    0
    • I IDontKnowHowToCode

      67b73087-67e3-4ca3-87b5-c8956504e6b5-image.png

      I'm trying to call setPixmap(pm) where pmis a QImage, however pyqt throws the following error. I dont understand whats wrong, it said it expected an of these: Union[QPixmap, QImage, str] and I provided a QImage.

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

      @IDontKnowHowToCode
      Trying to call setPixmap() on what? We don't know what your self.trackedImage is, and you don't say. From the tracebcak it looks like it is a QLabel. And in the Qt6 C++ documentation at https://doc.qt.io/qt-6/qlabel.html#pixmap-prop I see only setPixmap(const QPixmap &) and same at https://doc.qt.io/qtforpython-6/PySide6/QtWidgets/QLabel.html#PySide6.QtWidgets.PySide6.QtWidgets.QLabel.setPixmap, the PySide6 error message about Union notwithstanding.

      Try converting your QImage to a QPixmap and see?

      1 Reply Last reply
      1
      • I IDontKnowHowToCode

        67b73087-67e3-4ca3-87b5-c8956504e6b5-image.png

        I'm trying to call setPixmap(pm) where pmis a QImage, however pyqt throws the following error. I dont understand whats wrong, it said it expected an of these: Union[QPixmap, QImage, str] and I provided a QImage.

        CristianMaureiraC Offline
        CristianMaureiraC Offline
        CristianMaureira
        wrote on last edited by
        #3

        Which version of PySide6 are you using? we recently enable PathLike objects to the QClipboard.setPixmap and setImage https://codereview.qt-project.org/c/pyside/pyside-setup/+/491315 but QLabel.setPixmap should get a Pixmap, not an QImage. There might be a bug on the signature, so I encourage you to file a report https://wiki.qt.io/Qt_for_Python/Reporting_Bugs

        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