Ajout d'un "workaround" pour eviter un bug ne se produisant que lors du rendu des schemas sur QGraphicsScene sous X11 au zoom par defaut

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@169 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
xavierqet
2007-10-11 12:34:53 +00:00
parent b91b418c95
commit 0d77b8154d
2 changed files with 42 additions and 2 deletions

View File

@@ -26,7 +26,24 @@ Element::~Element() {
@param options Les options de style a prendre en compte
@param widget Le widget sur lequel on dessine
*/
void Element::paint(QPainter *painter, const QStyleOptionGraphicsItem *options, QWidget *) {
void Element::paint(QPainter *painter, const QStyleOptionGraphicsItem *options, QWidget *widget) {
#ifdef Q_WS_X11
// corrige un bug de rendu ne se produisant que lors du rendu sur QGraphicsScene sous X11 au zoom par defaut
static bool must_correct_rendering_bug = !QString(qVersion()).startsWith("4.4");
if (must_correct_rendering_bug) {
Diagram *dia = diagram();
if (dia && options -> levelOfDetail == 1.0 && widget) {
// calcule la rotation qu'a subi l'element
qreal applied_rotation = 90.0 * (ori.current() - ori.defaultOrientation());
while (applied_rotation < 360.0) applied_rotation += 360.0;
while (applied_rotation > 360.0) applied_rotation -= 360.0;
if (applied_rotation == 90.0) painter -> translate(1.0, -1.0);
else if (applied_rotation == 180.0) painter -> translate(-1.0, -1.0);
else if (applied_rotation == 270.0) painter -> translate(-1.0, 1.0);
}
}
#endif
// Dessin de l'element lui-meme
paint(painter, options);