Hi All,
Is there any way to hide/erase the border of the QRect.
Hi All,
Is there any way to hide/erase the border of the QRect.
Since a QRect is just a data class and has no visualization, how are you drawing the rectange?
Cheers,
_
I am drawing it on the pdf using QPainter on QPrinter.
I want to draw QRect rect without borders.Qt Code:To copy to clipboard, switch view to plain text mode
If you RTFM of QPainter::drawRect(), you will see that it uses the current pen and the current brush. The pen is what controls how the border is drawn. Just set the appropriate pen, then.
Thanks for the reply,
I have just written the below LOC for setting the width of the QPen just before the QRect,
Qt Code:
pen.setWidth(0); reportPainter.setPen(pen); //DRAWING RECTANGLE ON THE PDF reportPainter.drawRect(rect ); reportPainter.drawText(rect , Qt::AlignCenter | Qt::TextWordWrap, "SOME TEXT INSIDE");To copy to clipboard, switch view to plain text mode
But this isn't helping. It is drawing the rectangle with the same width (as it was before writing above LOC for setting the width of QPen).
Again, the doc for QPen says it all: "A line width of zero indicates a cosmetic pen. This means that the pen width is always drawn one pixel wide, independent of the transformation set on the painter."
Qt's documentation is great. I suggest you read the whole documentation of the classes you use before posting here. That is what I just did; I had never drawn a rectangle in a QPainter but I found the answers to your questions there.
Hi,
Are you sure that now have you readed all QPen Doc?
It tooks me only 30 seconds to discover that the pen have a style, and you can set it to "no pen".
Òscar Llarch i Galán
Bookmarks