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/QMimeData problem with transparent images

QClipboard/QMimeData problem with transparent images

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

    Hello,

    i want to display an image that is stored within the clipboard using a QGraphicsScene object. If i use the the imageData() method i get an image that has lost its alpha channel. The normally transparent background is displayed as black. I am using the following code:

    @QPixmap image(mimeData->imageData().value<QPixmap>());
    if (!image.isNull()) {
    QGraphicsPixmapItem * imageItem = m_gfxScene.addPixmap(image);
    ui->m_gfxView->show();
    }@

    Is there a way to avoid this behavior?

    Another problem occured as i tried to get access to the "plain" clipboard data. If i try to call mimeData->data() i get a segmentation fault (SIGSEGV):

    @ QString mf = mimeData->formats().at(0); // contains an image format string
    QByteArray arr = mimeData->data(mf); // Segmentation fault
    // or
    QByteArray arr(mimeData->data(mf)); // Segmentation fault@

    I use the Qt SDK 1.1 RC and built the code using MinGW 4.4 (Qt 4.7.3 for Desktop).

    Thanks in advance!

    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