Here is the rectangle frame:

And here is the rounded version (opacity of the frame and arc to round the corners can easily be made a setting, frame color is already a setting):

Not sure I can improve the corners paintings as I already use:
p->setRenderHint(QPainter::Antialiasing);
There are so many options in Qt classes that it's sometimes difficult to know where to look. For opacity for example I was looking at QBrush while QPainter has a setOpacity(int); method! #qt is a very good support channel. If you formulate your problem correctly, you're assured to get a smart answer.
6 comments:
Hi Annma,
How are you drawing the rounded corners on the frame? It looks like that is being done with QRegion-based clipping (same as the image). In which case QRegion doesn't support antialiasing.
One option would be to use QRegion to clip the paint area which drawing the image, then turn clipping off and use QPainter's drawRoundRect() method to draw the image border and frame border with antialiasing turned on. If the image border is opaque it will hide the jagged edge of the image itself.
I thought that with plasmoids you don't need to use clipping at all anymore. If you just paint with an antialiased painter and parts of your boundingrect are (semi) transparent then it will be composited correctly. At least thats how it works in QGV.
Well I use QRegion to make the pic painted with round corners thus the clipping. I am doing it with QPainter, maybe there's a QGraphicsViewItem which allows that more easily. Note: the pic originally has straight corners.
I tried Robert idea but the drawRoundRect() does not make the same round arc than the QRegion::Ellipse. It improves things but lacks practicality.
Outside of QGV it would be a simple matter of taking a QLabel, making it pretty with stylesheet magic and put the pic on it. In QGV, I am not sure what's the best.
Hi Annma,
A bit off-topic from the antialiasing problem... it would be great to be able to rotate a plasmoid like this.
I'm just a KDE user (at least for now :P ) so I don't know how much is difficult to implement the rotation for this plasmoid or for the plasma core itself...
...but to be able to put some photos on the desktop and rotate some of them, is a simple and very effective way to impress people.
It could be a great advertising for plasma and KDE4 itself :D
(thanks to all KDE developers, you are doing a great work, guys!)
Antonio:
The graphics view definitely allows for rotation (and skewing, and all related transforms). It's simply a matter of implementing it for her applet - or perhaps that will be implemented for all plasma applets, depending on what aaron plans I guess. Anyway, it's not a technical problem, it just has to be implemented :)
Anytime Anne-Marie. If there's anything else I can help with, let me know, it would be my pleasure :)
Post a Comment