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, pasting image on linux, how does it work
Forum Updated to NodeBB v4.3 + New Features

QClipboard, pasting image on linux, how does it work

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 798 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.
  • G Offline
    G Offline
    G.o.D
    wrote on last edited by
    #1

    Hi there,

    i am trying to paste an image in my Qt 5.0.2 application with this code:

    [code]
    QClipboard *clipboard = QApplication::clipboard();
    const QMimeData *mimeData = clipboard->mimeData();

    if (mimeData->hasImage()) {
    qDebug() << mimeData->imageData();
    QImage image = qvariant_cast<QImage>(mimeData->imageData());
    qDebug() << "pasted " << image.width();
    }
    [/code]

    So on linux running xfce desktop, i open the gimp, open a image, ctrl+a, ctrl+c, then go to my application and paste. What happens is: Gimp suddenly closes and debug output says:

    [code]
    QVariant(QImage, QImage(QSize(0, 0) ) )
    pasted 0
    [/code]

    Also tried a screenshot tool instead of gimp, no image pasting, as the screenshot tool automatically closes when you say 'copy to clipboard', i can not say if it would crash too.

    What am i doing wrong?

    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