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. QClipboard: Image alpha channel support?
Forum Updated to NodeBB v4.3 + New Features

QClipboard: Image alpha channel support?

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

    On Windows 8, Qt 5.2.1, I have a QImage with alpha channel and I want to put this image into the system clipboard:

    QClipboard *clipboard =QApplication::clipboard();
    QImage image(w, h, QImage::Format_ARGB32);
    ...
    QMimeData *mimeData = new QMimeData();
    mimeData->setImageData(image);
    clipboard->setMimeData(mimeData);

    Can QClipboard support image with alpha channel in Qt 5.2.1?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      I know the question might sound silly but, did you try and it failed ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • 1 Offline
        1 Offline
        1Black1
        wrote on last edited by
        #3

        QClipboard *clipboard =QApplication::clipboard();
        QImage image(w, h, QImage::Format_ARGB32);
        QMimeData *mimeData = new QMimeData();
        mimeData->setImageData(image);
        clipboard->setMimeData(mimeData);

        I Use above code in program, and then paste this image into e.g. OpenOffice Draw or MS PowerPoint the background which is supposed to be fully transparent is black and everything is fully opaque.

        Can anyone confirm whether alpha channels in the clipboard are supported at all?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          If you are using it as is, then i won't work, you are copying an uninitialized image. At least fill it with transparency before putting it in the QMimeData

          On a side note, please enclose your code with coding tags (one @ at the beginning and one at the end) it will make it readable.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          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