snapToGrid disable as it leads to rounding errors

This commit is contained in:
Uwe Rathmann 2019-04-10 19:38:29 +02:00
parent 8058615c02
commit c539e3bb24
1 changed files with 4 additions and 8 deletions

View File

@ -79,16 +79,12 @@ namespace
} }
QskLayoutEngine::QskLayoutEngine() QskLayoutEngine::QskLayoutEngine()
: QGridLayoutEngine( Qt::AlignVCenter, true /*snapToPixelGrid*/ ) : QGridLayoutEngine( Qt::AlignVCenter, false /*snapToPixelGrid*/ )
{ {
/* /*
When centering something integer based like a QImage snapToPixelGrid rounds x/y, what might lead to losing a pixel.
inside an odd number of pixels, we end up at x.5 positions. F.e. when having a text in elideMode we end up with an elided text
Then snapToPixelGrid will ceil one side and we lose 0.5 because of this.
in height/width. For these type of situations it would be
good to be able to disable snapToPixelGrid. Unfortunately
this can't be done without recreating the QGridLayoutEngine.
TODO ...
*/ */
} }