PDA

View Full Version : copy-paste the content of a QTable



greencastor
13th September 2006, 11:30
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 :

http://img243.imageshack.us/img243/4323/copieqh0.jpg

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

jacek
13th September 2006, 12:05
QPixmap pixmap = QPixmap::grabWidget(this);
Just use a pointer to that table instead of "this".


QPainter p;
p.begin(&pixmap);
p.drawPixmap(0,0,pixmap);
p.end();
Does this do anything useful?

greencastor
13th September 2006, 13:20
Yes, it was just that... :o :o :o

Thank you jacek!