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

@@ -163,9 +163,32 @@ void Terminal::removeConductor(Conductor *f) {
@param options Les options de dessin
@param widget Le widget sur lequel on dessine
*/
void Terminal::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) {
void Terminal::paint(QPainter *p, const QStyleOptionGraphicsItem *options, QWidget *widget) {
p -> save();
#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 = 0.0;
if (Element *elt = qgraphicsitem_cast<Element *>(parentItem())) {
// orientations actuelle et par defaut de l'element
QET::Orientation ori_cur = elt -> orientation().current();
QET::Orientation ori_def = elt -> orientation().defaultOrientation();
applied_rotation = 90.0 * (ori_cur - ori_def);
while (applied_rotation < 360.0) applied_rotation += 360.0;
while (applied_rotation > 360.0) applied_rotation -= 360.0;
}
if (applied_rotation == 90.0) p -> translate(1.0, -1.0);
else if (applied_rotation == 180.0) p -> translate(-1.0, -1.0);
else if (applied_rotation == 270.0) p -> translate(-1.0, 1.0);
}
}
#endif
//annulation des renderhints
p -> setRenderHint(QPainter::Antialiasing, false);
p -> setRenderHint(QPainter::TextAntialiasing, false);