QPainter set render hits globally
Can I set render hits flags globaly, for entire qt application? I want next flags to set for all painting widgets:
pPainter->setRenderHints(QPainter::SmoothPixmapTransform | QPainter::Antialiasing, false); pPainter->setRenderHints(QPainter::TextAntialiasing , true);
Is it possible?
AFAIK, no, but you could create a small subclass of QPainter that sets them and re-use it through your application.
Hope it helps
@SGaist Thank you! But I not uderstand, how to change render hits in QTextBrowser for example.
I tried next code:
QPainter* pPainter = m_pTextBrowser->paintEngine().painter(); pPainter->setRenderHints(QPainter::SmoothPixmapTransform | QPainter::Antialiasing, false); pPainter->setRenderHints(QPainter::TextAntialiasing , true);
I recieved segmentation failt, because pPainter not valid. From other side, QTextBrowser also have viewport widget, but the same situation with him, I don't can get valid painter.
Once way, that I see, reimplement paintEvent and paint widget from zero. Because in other case, if I will use paintEvent from inherits class, he can use QPainter with custom render hits.
Is exist way for changing render hits for widget?
I am not aware of a setting like that.