From d6295358a6d2e4be18edcdd9eaf374082ae506d0 Mon Sep 17 00:00:00 2001 From: Craig Watson Date: Wed, 6 Apr 2016 09:08:12 +0200 Subject: [PATCH] Fix text box title bar height/spacing when zooming --- src/domain/UBGraphicsDelegateFrame.cpp | 2 ++ src/domain/UBGraphicsDelegateFrame.h | 1 + src/domain/UBGraphicsItemDelegate.cpp | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/domain/UBGraphicsDelegateFrame.cpp b/src/domain/UBGraphicsDelegateFrame.cpp index 40a46074..90c0f4b0 100644 --- a/src/domain/UBGraphicsDelegateFrame.cpp +++ b/src/domain/UBGraphicsDelegateFrame.cpp @@ -66,6 +66,7 @@ UBGraphicsDelegateFrame::UBGraphicsDelegateFrame(UBGraphicsItemDelegate* pDelega , mMirrorX(false) , mMirrorY(false) , mTitleBarHeight(hasTitleBar ? 20 :0) + , mNominalTitleBarHeight(hasTitleBar ? 20:0) { mAngleTolerance = UBSettings::settings()->angleTolerance->get().toReal(); @@ -117,6 +118,7 @@ UBGraphicsDelegateFrame::~UBGraphicsDelegateFrame() void UBGraphicsDelegateFrame::setAntiScale(qreal pAntiScale) { mFrameWidth = mNominalFrameWidth * pAntiScale; + mTitleBarHeight = mNominalTitleBarHeight * pAntiScale; QTransform tr; tr.scale(pAntiScale, pAntiScale); diff --git a/src/domain/UBGraphicsDelegateFrame.h b/src/domain/UBGraphicsDelegateFrame.h index 599fca5e..8e16e2b2 100644 --- a/src/domain/UBGraphicsDelegateFrame.h +++ b/src/domain/UBGraphicsDelegateFrame.h @@ -143,6 +143,7 @@ class UBGraphicsDelegateFrame: public QGraphicsRectItem, public QObject bool mMirroredXAtStart; bool mMirroredYAtStart; qreal mTitleBarHeight; + qreal mNominalTitleBarHeight; QList mLinkedFrames; }; diff --git a/src/domain/UBGraphicsItemDelegate.cpp b/src/domain/UBGraphicsItemDelegate.cpp index 248f8c28..2d7caccb 100644 --- a/src/domain/UBGraphicsItemDelegate.cpp +++ b/src/domain/UBGraphicsItemDelegate.cpp @@ -790,7 +790,7 @@ void UBGraphicsItemDelegate::updateButtons(bool showUpdated) } else if (button->getSection() == Qt::TitleBarArea){ button->setParentItem(mFrame); - button->setPos(topXTitleBar + (k++ * (frameButtonHeight + 5)), topYTitleBar); + button->setPos(topXTitleBar + (k++ * (frameButtonHeight + 5) * mAntiScaleRatio), topYTitleBar); button->setTransform(tr); button->setTransform(QTransform::fromScale(0.8, 0.8), true); }