Results 1 to 3 of 3

Thread: copy-paste the content of a QTable

  1. #1
    Join Date
    Mar 2006
    Posts
    16
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default copy-paste the content of a QTable

    Hello!

    I would like to copy-paste the content of a QTable. For the moment, I'm using this code :
    //imprimer dans le clipbord
    QPixmap pixmap = QPixmap::grabWidget(this);
    QPainter p;
    p.begin(&pixmap);
    p.drawPixmap(0,0,pixmap);
    p.end();

    //Affectation de l'image au clipboard
    QClipboard *cb = QApplication::clipboard();
    cb->setPixmap(pixmap);
    but if you take a look at the result :



    I would like to see only the Qtable and not the buttons and the border for example.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: copy-paste the content of a QTable

    Quote Originally Posted by greencastor
    QPixmap pixmap = QPixmap::grabWidget(this);
    Just use a pointer to that table instead of "this".

    Quote Originally Posted by greencastor
    QPainter p;
    p.begin(&pixmap);
    p.drawPixmap(0,0,pixmap);
    p.end();
    Does this do anything useful?

  3. #3
    Join Date
    Mar 2006
    Posts
    16
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: copy-paste the content of a QTable

    Yes, it was just that...

    Thank you jacek!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.