diff --git a/src/drivers/Qt/TasEditor/branches.cpp b/src/drivers/Qt/TasEditor/branches.cpp index 39633a40..a223f0ff 100644 --- a/src/drivers/Qt/TasEditor/branches.cpp +++ b/src/drivers/Qt/TasEditor/branches.cpp @@ -119,7 +119,8 @@ void BRANCHES::calcFontData(void) #else pxCharWidth = metrics.width(QLatin1Char('2')); #endif - pxCharHeight = metrics.capHeight(); + //pxCharHeight = metrics.capHeight(); + pxCharHeight = metrics.ascent(); pxLineSpacing = metrics.lineSpacing(); pxBoxWidth = pxLineSpacing; @@ -127,6 +128,9 @@ void BRANCHES::calcFontData(void) pxSelWidth = (pxBoxWidth * 7) / 8; pxSelHeight = (pxBoxHeight * 7) / 8; + pxTextOffsetX = -(pxBoxWidth/2 ) + (pxBoxWidth - pxCharWidth)/2; + pxTextOffsetY = (pxBoxHeight/2) - (pxBoxHeight - pxCharHeight)/2; + pxMinGridWidth = (pxBoxWidth + 2); pxMaxGridWidth = (pxBoxWidth * 2); pxGridWidth = pxMinGridWidth; @@ -926,23 +930,26 @@ void BRANCHES::paintEvent(QPaintEvent *event) // digits for (int i = 0; i < TOTAL_BOOKMARKS; ++i) { + x = branchCurrentX[i] + pxTextOffsetX; + y = branchCurrentY[i] + pxTextOffsetY; + txt[0] = i + '0'; txt[1] = 0; if (i == currentBranch) { painter.setPen( QColor( 58, 179, 255 ) ); - painter.drawText( box[i], Qt::AlignCenter, tr(txt) ); + painter.drawText( x, y, tr(txt) ); } else { painter.setPen( QColor( 0, 194, 64 ) ); - //if (!bookmarks->bookmarksArray[i].notEmpty && bookmarks->bookmarksArray[i].floatingPhase > 0) - //{ - // tempBranchX += bookmarks->bookmarksArray[i].floatingPhase; - //} - painter.drawText( box[i], Qt::AlignCenter, tr(txt) ); + if (!bookmarks->bookmarksArray[i].notEmpty && bookmarks->bookmarksArray[i].floatingPhase > 0) + { + x += bookmarks->bookmarksArray[i].floatingPhase; + } + painter.drawText( x, y, tr(txt) ); } } if (isSafeToShowBranchesData()) diff --git a/src/drivers/Qt/TasEditor/branches.h b/src/drivers/Qt/TasEditor/branches.h index aa78a6b3..2b943dcf 100644 --- a/src/drivers/Qt/TasEditor/branches.h +++ b/src/drivers/Qt/TasEditor/branches.h @@ -209,6 +209,8 @@ private: int pxMinGridWidth; int pxMaxGridWidth; int pxGridWidth; + int pxTextOffsetX; + int pxTextOffsetY; // temps std::vector gridX; // measured in grid units, not in pixels