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. Is it ok to draw in a QPixmap from a background thread?
Forum Updated to NodeBB v4.3 + New Features

Is it ok to draw in a QPixmap from a background thread?

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 4 Posters 380 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.
  • A Offline
    A Offline
    Akshaya Shanker
    wrote on last edited by
    #1

    I am trying to create a QPixmap and draw inside the pixmap . Is it ok to do the same in worker thread . I tried and it seems to work fine . But documentation doesnot recommend to use it in worker thread.

    O S 2 Replies Last reply
    0
    • A Akshaya Shanker

      I am trying to create a QPixmap and draw inside the pixmap . Is it ok to do the same in worker thread . I tried and it seems to work fine . But documentation doesnot recommend to use it in worker thread.

      O Offline
      O Offline
      ollarch
      wrote on last edited by
      #2

      @Akshaya-Shanker use a QImage instead.

      A 1 Reply Last reply
      0
      • O ollarch

        @Akshaya-Shanker use a QImage instead.

        A Offline
        A Offline
        Akshaya Shanker
        wrote on last edited by
        #3

        @ollarch What difference does it make using a QImage instead of QPixmap ? My case is to draw a rect within an image.

        Christian EhrlicherC 1 Reply Last reply
        0
        • A Akshaya Shanker

          @ollarch What difference does it make using a QImage instead of QPixmap ? My case is to draw a rect within an image.

          Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Akshaya-Shanker said in Is it ok to draw in a QPixmap from a background thread?:

          What difference does it make using a QImage instead of QPixmap

          Why not look by yourself?

          https://doc.qt.io/qt-6/qpixmap.html#details

          https://doc.qt.io/qt-6/qimage.html#details

          --> you want to use a QImage

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          2
          • A Akshaya Shanker

            I am trying to create a QPixmap and draw inside the pixmap . Is it ok to do the same in worker thread . I tried and it seems to work fine . But documentation doesnot recommend to use it in worker thread.

            S Offline
            S Offline
            SimonSchroeder
            wrote on last edited by
            #5

            @Akshaya-Shanker said in Is it ok to draw in a QPixmap from a background thread?:

            I tried and it seems to work fine .

            Just because it works fine now on your computer does not mean that it will work fine in the future or on other computers. Please do respect the documentation and save yourself some headaches down the road. I am talking from experience. If the Qt documentation states that you shouldn't do something, you'll get a crash eventually. It's even worse when it is not reproducible and you cannot debug it.

            1 Reply Last reply
            2

            • Login

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