Hi all guys,
I know there was a discussion in this forum in the past,
but even if I put the best of my attention I was not able to
get the goal
Can someone help?
Thank you in advance.
Roberto
Hi all guys,
I know there was a discussion in this forum in the past,
but even if I put the best of my attention I was not able to
get the goal
Can someone help?
Thank you in advance.
Roberto
Hi all,
How to print aQTableWidget?
I know there was a discussion in this forum in the past,
but even if I put the best of my attention I was not able to
get the goal
If someone has example code please can help?
Thank you in advance.
Roberto
Hi
about printing a QtableWidget,
I tried again the code suggested once by JPN,
but no success..
Attached you will find what I get
Any clue? any idead..?
What could be wrong?
Thank you,
Roberto
Thanks JPN
You might want to adjust the scaling a bit. Looks like the content is scaled to fit the page.[/QUOTE]
Which line of your suggested code should I modify?
regards
Oh sorry..
this is the link you posted once..
http://www.qtcentre.org/forum/f-qt-p...g-3796.html#10
..should I add something??
If so how to complete it?
Thanka a lot
Roby
It depends how you want it to be. Maybe drawing it without scaling suits your needs:
Or alternatively use HTML and QTextDocument as suggested by Jacek at the end of the thread.Qt Code:
// painter.drawPixmap(printer.pageRect(), pixmap, pixmap.rect()); painter.drawPixmap(printer.pageRect().topLeft(), pixmap);To copy to clipboard, switch view to plain text mode
J-P Nurmi
JPN,
following your suggestion it Prints the entire table ..in the top left corner of the page..
only a problem...
the table is extremely little...I can't even see it ..
How come?
is there a scaling problem?
Roby
Give it a try with QPrinter::ScreenResolution. Presumably the another option is to scale according to used resolution in case it doesn't look good enough.
J-P Nurmi
Indeed now it look grater but not all the columns fit on the page..
"Presumably the another option is to scale according to used resolution in case it doesn't look good enough"
Can you show me how to do it?
I tried the following:
QPrinter printer;
int dpi = printer.resolution();
printer.setResolution(dpi);
but it doesn't change the fact that the table is not entirely printed..
Roby
I'm sorry to say but this does nothing at all. One option is to go with QPainter::scale(). A scale factor of 0.5 makes it half of the original size, 2 makes it double.
J-P Nurmi
Many thanks JPN
for your help!
I tried what you suggested but it does not look good yet..
The problem is that if I choose "painter.scale(0.5,0.5); "
it prints the entire table but che characters inside the cells
are not visible because of bad resolution(maybe too small)
Further suggestions?
Thank again
Roby
I rolled back to
Qt Code:
To copy to clipboard, switch view to plain text mode
and I added
Qt Code:
painter.scale(4,4);To copy to clipboard, switch view to plain text mode
Now it fits the page...
but hey ...where is table bar titles??
How to get it ??
Thank for your reply
Roberto.
JPN,
I tried doing this, but nothing..yet
what is wrong with the following..
Qt Code:
// redirect table's painting on a pixmap // print scaled pixmap painter.scale(5,5); painter.drawPixmap(printer.pageRect().topLeft(), pixmap, pixmap.rect()); painter.drawPixmap(printer.pageRect().topRight(), pixmap1, pixmap1.rect());To copy to clipboard, switch view to plain text mode
Thanks for your patience,
Roby
Perhaps it would be easier to convert contents of the table to HTML and use QTextDocument::print()?
J-P Nurmi
rmagro (21st June 2007)
Please provide some examples,
Thank you
Roberto
What does the table contain? Plain text? Images? Could you provide a screenshot?
J-P Nurmi
Here it is..
Then, the following to show you how I fill in the table:
Qt Code:
tableWidget->item(row, 1)->setText(tr("Verifica corretta"));To copy to clipboard, switch view to plain text mode
many thanks..
Roby
Bookmarks