Issue with masking QWidgets
Hi, I've been experimenting masking my QWidgets for different shaped buttons, windows...etc. One thing I can't figure out though is how to smooth out the borders of my masked image. The edges are always very pixellated no matter what resolution I set my mask image at.
Is there some anti-aliasing effect I need to apply? Is such a thing even possible, or is this just the way it is...?
Thanks for any advice you can give, Daniel
Re: Issue with masking QWidgets
if you just want to use it under windows look at this:
http://wiki.qtcentre.org/index.php?title=ARGB-Widgets
Re: Issue with masking QWidgets
Hey, I'm trying to maintain cross-platform-ability for this app, but thanks for the article in any case. Great stuff.
Re: Issue with masking QWidgets
For widgets, instead of masking, just paint your own in the shape you want them. This gets you nice antialiased corners. For shaped windows, there is no simple solution with antialiasing, either hack it or put up with the jaggies.
Re: Issue with masking QWidgets
thanks pherthyl, can you clarify some things for me - do you mean I should override the paintEvent for the widget and do everything in there instead? What other methods would I need to override to say paint my QPushButton circular instead of a rectangle? I'm afraid I'm a little new at this...
Re: Issue with masking QWidgets
Quote:
Originally Posted by
JimDaniel
thanks pherthyl, can you clarify some things for me - do you mean I should override the paintEvent for the widget and do everything in there instead? What other methods would I need to override to say paint my QPushButton circular instead of a rectangle? I'm afraid I'm a little new at this...
Yes, you would need to override the paintevent and draw the button there. That should be all that is necessary. However I doubt this is actually the best idea now that I think about it. If you are serious about providing a customized UI, you might want to go whole hog and write your own QStyle. http://doc.trolltech.com/4.3/qstyle.html
Also look at the themes examples that come with Qt. This is probably the proper way to do it.
Re: Issue with masking QWidgets