Clean some code

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4269 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
scorpio810
2015-11-19 15:19:45 +00:00
parent fbef0af8d3
commit 4d63289388
2 changed files with 4 additions and 40 deletions

View File

@@ -93,24 +93,9 @@ void Element::displayHelpLine(bool b)
* @param options
* @param widget
*/
void Element::paint(QPainter *painter, const QStyleOptionGraphicsItem *options, QWidget *widget)
void Element::paint(QPainter *painter, const QStyleOptionGraphicsItem *options, QWidget *)
{
#ifndef Q_OS_WIN
//Fix visual bug on QGraphicsScene that occur only on X11 with default zoom.
QSettings settings;
static bool must_correct_rendering_bug = settings.value("correct-rendering", false).toBool();
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 * orientation();
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
if (must_highlight_) drawHighlight(painter, options);
//Draw the element himself

View File

@@ -221,33 +221,12 @@ void Terminal::removeConductor(Conductor *conductor)
@param options Les options de dessin
@param widget Le widget sur lequel on dessine
*/
void Terminal::paint(QPainter *p, const QStyleOptionGraphicsItem *options, QWidget *widget) {
void Terminal::paint(QPainter *p, const QStyleOptionGraphicsItem *options, QWidget *) {
// en dessous d'un certain zoom, les bornes ne sont plus dessinees
if (options && options -> levelOfDetail < 0.5) return;
p -> save();
#ifndef Q_OS_WIN
//Fix visual bug on QGraphicsScene that occur only on X11 with default zoom.
QSettings settings;
static bool must_correct_rendering_bug = settings.value("correct-rendering", false).toBool();
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
int ori_cur = elt -> orientation();
applied_rotation = QET::correctAngle(90.0 * ori_cur);
}
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);