forked from qt-creator/qt-creator
QmlDesigner: Fix SpinBox showing group separator
In Qt 6.7.3 the StudioControls SpinBoxes were showing group separators caused by the validator fixup function which takes the system locale to generated the presented string. We fix this with a design studio specific locale that is assigned to the controls that show numbers. Task-number: QDS-13536 Change-Id: I26682b08a8e29cd5dc09b3ff09212568bfa4fe52 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
committed by
Henning Gründl
parent
989eae1667
commit
e3842cf236
@@ -4,6 +4,7 @@
|
||||
import QtQuick
|
||||
import QtQuick.Templates as T
|
||||
import StudioTheme 1.0 as StudioTheme
|
||||
import StudioQuickUtils
|
||||
|
||||
T.SpinBox {
|
||||
id: control
|
||||
@@ -71,6 +72,8 @@ T.SpinBox {
|
||||
signal dragging
|
||||
signal indicatorPressed
|
||||
|
||||
locale: Utils.locale
|
||||
|
||||
// Use custom wheel handling due to bugs
|
||||
property bool __wheelEnabled: false
|
||||
wheelEnabled: false
|
||||
|
@@ -4,6 +4,7 @@
|
||||
import QtQuick
|
||||
import QtQuick.Templates as T
|
||||
import StudioTheme 1.0 as StudioTheme
|
||||
import StudioQuickUtils
|
||||
|
||||
T.SpinBox {
|
||||
id: control
|
||||
@@ -54,6 +55,8 @@ T.SpinBox {
|
||||
signal dragEnded
|
||||
signal dragging
|
||||
|
||||
locale: Utils.locale
|
||||
|
||||
// Use custom wheel handling due to bugs
|
||||
property bool __wheelEnabled: false
|
||||
wheelEnabled: false
|
||||
|
@@ -27,7 +27,6 @@
|
||||
#include <formeditor/transitiontool.h>
|
||||
#include <formeditor/view3dtool.h>
|
||||
#include <studioquickwidget.h>
|
||||
#include <windowmanager.h>
|
||||
#ifndef QDS_USE_PROJECTSTORAGE
|
||||
# include <metainfo.h>
|
||||
#endif
|
||||
@@ -311,7 +310,6 @@ bool QmlDesignerPlugin::initialize(const QStringList & /*arguments*/, QString *e
|
||||
//TODO Move registering those types out of the property editor, since they are used also in the states editor
|
||||
Quick2PropertyEditorView::registerQmlTypes();
|
||||
StudioQuickWidget::registerDeclarativeType();
|
||||
QmlDesignerBase::WindowManager::registerDeclarativeType();
|
||||
|
||||
Exception::setWarnAboutException(!QmlDesignerPlugin::instance()
|
||||
->settings()
|
||||
|
@@ -45,6 +45,7 @@ extend_qtc_plugin(QmlDesignerBase
|
||||
PUBLIC_INCLUDES studio
|
||||
SOURCES_PREFIX studio
|
||||
SOURCES
|
||||
studioquickutils.cpp studioquickutils.h
|
||||
studiostyle.cpp studiostyle.h
|
||||
studiostyle_p.cpp studiostyle_p.h
|
||||
studioquickwidget.cpp studioquickwidget.h
|
||||
|
@@ -8,6 +8,8 @@
|
||||
#include "studio/studiostyle.h"
|
||||
|
||||
#include <designersettings.h>
|
||||
#include <studioquickutils.h>
|
||||
#include <windowmanager.h>
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <utils/appinfo.h>
|
||||
@@ -89,6 +91,9 @@ bool QmlDesignerBasePlugin::initialize(const QStringList &arguments, QString *)
|
||||
if (arguments.contains("-qml-lite-designer"))
|
||||
enbableLiteMode();
|
||||
|
||||
WindowManager::registerDeclarativeType();
|
||||
StudioQuickUtils::registerDeclarativeType();
|
||||
|
||||
d = std::make_unique<Data>();
|
||||
if (Core::ICore::settings()->value("QML/Designer/StandAloneMode", false).toBool())
|
||||
d->studioConfigSettingsPage = std::make_unique<StudioConfigSettingsPage>();
|
||||
|
31
src/plugins/qmldesignerbase/studio/studioquickutils.cpp
Normal file
31
src/plugins/qmldesignerbase/studio/studioquickutils.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
// Copyright (C) 2023 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "studioquickutils.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
StudioQuickUtils::StudioQuickUtils()
|
||||
{
|
||||
m_locale = QLocale("DesignStudioLocale");
|
||||
m_locale.setNumberOptions(QLocale::OmitGroupSeparator);
|
||||
}
|
||||
|
||||
void StudioQuickUtils::registerDeclarativeType()
|
||||
{
|
||||
qmlRegisterSingletonType<StudioQuickUtils>(
|
||||
"StudioQuickUtils", 1, 0, "Utils", [](QQmlEngine *, QJSEngine *) {
|
||||
return new StudioQuickUtils();
|
||||
});
|
||||
}
|
||||
|
||||
const QLocale &StudioQuickUtils::locale() const
|
||||
{
|
||||
return m_locale;
|
||||
}
|
||||
|
||||
StudioQuickUtils::~StudioQuickUtils() {}
|
||||
|
||||
} // namespace QmlDesigner
|
39
src/plugins/qmldesignerbase/studio/studioquickutils.h
Normal file
39
src/plugins/qmldesignerbase/studio/studioquickutils.h
Normal file
@@ -0,0 +1,39 @@
|
||||
// Copyright (C) 2024 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../qmldesignerbase_global.h"
|
||||
|
||||
#include <QtQml/qqml.h>
|
||||
|
||||
#include <QLocale>
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
class QMLDESIGNERBASE_EXPORT StudioQuickUtils : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QLocale locale READ locale NOTIFY localeChanged)
|
||||
|
||||
public:
|
||||
~StudioQuickUtils();
|
||||
|
||||
StudioQuickUtils(const StudioQuickUtils &) = delete;
|
||||
void operator=(const StudioQuickUtils &) = delete;
|
||||
|
||||
static void registerDeclarativeType();
|
||||
|
||||
const QLocale &locale() const;
|
||||
|
||||
signals:
|
||||
void localeChanged();
|
||||
|
||||
private:
|
||||
StudioQuickUtils();
|
||||
|
||||
QLocale m_locale;
|
||||
};
|
||||
|
||||
} // namespace QmlDesigner
|
@@ -11,9 +11,7 @@
|
||||
#include <QScreen>
|
||||
#include <QWindow>
|
||||
|
||||
namespace QmlDesignerBase {
|
||||
|
||||
QPointer<WindowManager> WindowManager::m_instance = nullptr;
|
||||
namespace QmlDesigner {
|
||||
|
||||
WindowManager::WindowManager()
|
||||
{
|
||||
@@ -56,4 +54,4 @@ QRect WindowManager::getScreenGeometry(QPoint point)
|
||||
return screen->geometry();
|
||||
}
|
||||
|
||||
} // namespace QmlDesignerBase
|
||||
} // namespace QmlDesigner
|
||||
|
@@ -10,7 +10,7 @@
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QWindow)
|
||||
|
||||
namespace QmlDesignerBase {
|
||||
namespace QmlDesigner {
|
||||
|
||||
class QMLDESIGNERBASE_EXPORT WindowManager : public QObject
|
||||
{
|
||||
@@ -34,8 +34,6 @@ signals:
|
||||
|
||||
private:
|
||||
WindowManager();
|
||||
|
||||
static QPointer<WindowManager> m_instance;
|
||||
};
|
||||
|
||||
} // namespace QmlDesignerBase
|
||||
} // namespace QmlDesigner
|
||||
|
Reference in New Issue
Block a user