Skip to content
  • 1 Votes
    12 Posts
    2k Views
    V

    @aha_1980
    ok, i understood what you said.

  • QPainter zero point bug

    Unsolved General and Desktop
    2
    0 Votes
    2 Posts
    512 Views
    Kent-DorfmanK

    kind of shooting in the dark here, but remember that the painter coordinate system can be scaled, rotated, and new origin set. Try explicitly defining the coordinate system...Also, if your coordinates are floating point then you have to deal with floating point roundoff error.

  • Align QPainterPath

    Unsolved General and Desktop
    2
    0 Votes
    2 Posts
    1k Views
    G

    UPD:
    I write this method for drawing, looks good

    { QLabel::paintEvent(event); QPainter painter (this); painter.setPen(Qt::green); painter.setBrush(palette().windowText()); painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing); painter.setFont(font()); QRect font_rect = painter.fontMetrics().boundingRect(text()); QRect label_rect = contentsRect(); label_rect.adjust(margin(), margin(), -margin(), -margin()); int dx = label_rect.width() - font_rect.width(); int dy = label_rect.height() - font_rect.height(); int x = 0; int y = 0; if (alignment() & Qt::AlignLeft) x = label_rect.left(); else if (alignment() & Qt::AlignHCenter) x = label_rect.left() + dx / 2; else if (alignment() & Qt::AlignRight) x = label_rect.right() - font_rect.width(); if (alignment() & Qt::AlignTop) y = label_rect.top() + font_rect.height(); else if (alignment() & Qt::AlignVCenter) y = label_rect.top() + dy / 2; else if (alignment() & Qt::AlignBottom) y = label_rect.bottom(); QPainterPath path; path.addText(x, y, font(), text()); painter.fillPath(path, palette().windowText()); painter.strokePath(path, QPen(QColor(255, 0, 0, 50), 2)); }

    0_1539696004806_StereoControlCenter 2018-10-16 16.19.04.png

    But i still dont understand the difference btw native paint event and my own

  • 0 Votes
    5 Posts
    2k Views
    G

    @JonB sorry for long reply
    debug size is 29.5M
    release size is 18.3M
    Free memory always a more than needed PC have 16Gb ram. Also i checked swap, swap is newer used for last days. So problem is not here.
    Next step i will check all dlls one by one in tes Win32 pure C application, maybe problem is here.

    no cpecific initial code ... but as u can see a lot of dependencies.. In linux exist LD_PRELOAD key but there is no solution for windows i found.

    Thanks for response, if i found any solution or reason i'll report it here.
    Cheers.

  • 0 Votes
    3 Posts
    815 Views
    G

    @VRonin said in QDomDocument toString() producing different results:

    This would also have licensing implications though

    Thanks for idea, i think we can build our own QDom* classes and make lib for application.
    Also possible solution is canonical serializer, that will save xml in right way, but both solutions require much more code than .toString() :)

    This link demonstrate canonical serializer
    https://stackoverflow.com/questions/27378143/qt-5-produce-random-attribute-order-in-xml