forked from qt-creator/qt-creator
QmlDesigner: Fix disappearing plus states editor
* Fix issue the plus (Canvas) in the states editor is not drawn when the view was hidden before and comes back on * Improve paint method Task-number: QDS-8419 Change-Id: I959b4b6a418deba95380d8f5cafc7af09a0362e8 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
committed by
Henning Gründl
parent
ccbda4655e
commit
fd1864d678
@@ -45,6 +45,10 @@ Rectangle {
|
|||||||
onWidthChanged: root.responsiveResize(root.width, root.height)
|
onWidthChanged: root.responsiveResize(root.width, root.height)
|
||||||
onHeightChanged: root.responsiveResize(root.width, root.height)
|
onHeightChanged: root.responsiveResize(root.width, root.height)
|
||||||
|
|
||||||
|
function showEvent() {
|
||||||
|
addCanvas.requestPaint()
|
||||||
|
}
|
||||||
|
|
||||||
Component.onCompleted: root.responsiveResize(root.width, root.height)
|
Component.onCompleted: root.responsiveResize(root.width, root.height)
|
||||||
|
|
||||||
function numFit(overall, size, space) {
|
function numFit(overall, size, space) {
|
||||||
@@ -860,22 +864,22 @@ Rectangle {
|
|||||||
width: root.thumbWidth
|
width: root.thumbWidth
|
||||||
height: root.thumbHeight
|
height: root.thumbHeight
|
||||||
|
|
||||||
|
property int plusExtend: 20
|
||||||
|
property int halfWidth: addCanvas.width / 2
|
||||||
|
property int halfHeight: addCanvas.height / 2
|
||||||
|
|
||||||
onPaint: {
|
onPaint: {
|
||||||
var ctx = getContext("2d")
|
var ctx = getContext("2d")
|
||||||
|
|
||||||
ctx.strokeStyle = StudioTheme.Values.themeStateHighlight
|
ctx.strokeStyle = StudioTheme.Values.themeStateHighlight
|
||||||
ctx.lineWidth = 6
|
ctx.lineWidth = 6
|
||||||
|
|
||||||
var plusExtend = 20
|
|
||||||
var halfWidth = addCanvas.width / 2
|
|
||||||
var halfHeight = addCanvas.height / 2
|
|
||||||
|
|
||||||
ctx.beginPath()
|
ctx.beginPath()
|
||||||
ctx.moveTo(halfWidth, halfHeight - plusExtend)
|
ctx.moveTo(addCanvas.halfWidth, addCanvas.halfHeight - addCanvas.plusExtend)
|
||||||
ctx.lineTo(halfWidth, halfHeight + plusExtend)
|
ctx.lineTo(addCanvas.halfWidth, addCanvas.halfHeight + addCanvas.plusExtend)
|
||||||
|
|
||||||
ctx.moveTo(halfWidth - plusExtend, halfHeight)
|
ctx.moveTo(addCanvas.halfWidth - addCanvas.plusExtend, addCanvas.halfHeight)
|
||||||
ctx.lineTo(halfWidth + plusExtend, halfHeight)
|
ctx.lineTo(addCanvas.halfWidth + addCanvas.plusExtend, addCanvas.halfHeight)
|
||||||
ctx.stroke()
|
ctx.stroke()
|
||||||
|
|
||||||
ctx.save()
|
ctx.save()
|
||||||
|
|||||||
@@ -43,10 +43,10 @@
|
|||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
||||||
#include <QFileInfo>
|
|
||||||
#include <QShortcut>
|
|
||||||
#include <QBoxLayout>
|
#include <QBoxLayout>
|
||||||
|
#include <QFileInfo>
|
||||||
#include <QKeySequence>
|
#include <QKeySequence>
|
||||||
|
#include <QShortcut>
|
||||||
|
|
||||||
#include <QQmlContext>
|
#include <QQmlContext>
|
||||||
#include <QQmlEngine>
|
#include <QQmlEngine>
|
||||||
@@ -142,6 +142,7 @@ void StatesEditorWidget::showEvent(QShowEvent *event)
|
|||||||
{
|
{
|
||||||
QQuickWidget::showEvent(event);
|
QQuickWidget::showEvent(event);
|
||||||
update();
|
update();
|
||||||
|
QMetaObject::invokeMethod(rootObject(), "showEvent");
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatesEditorWidget::focusOutEvent(QFocusEvent *focusEvent)
|
void StatesEditorWidget::focusOutEvent(QFocusEvent *focusEvent)
|
||||||
|
|||||||
Reference in New Issue
Block a user