Merge remote-tracking branch 'origin/qds/dev'

Change-Id: I74bf2bfb1eacb60675640c47eb41ce51dd6eb99f
This commit is contained in:
Tim Jenssen
2022-11-16 19:12:59 +01:00
473 changed files with 18399 additions and 12437 deletions

View File

@@ -1,5 +0,0 @@
[Paths]
Prefix = ../../..
Imports = Imports/qtquick1
Qml2Imports = Imports/qtquick2
Plugins = PlugIns

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -9,7 +9,7 @@
\title Exporting Designs from Adobe Illustrator \title Exporting Designs from Adobe Illustrator
Even though \QDS does not provide a specific export bridge for Adobe Even though \QDS does not provide a specific export bridge for Adobe
Illustrator, you can desing UIs in it and export your designs to \QDS in Illustrator, you can design UIs in it and export your designs to \QDS in
the following ways: the following ways:
\list \list

View File

@@ -231,7 +231,7 @@
you specified. This might take a little while depending on the complexity of you specified. This might take a little while depending on the complexity of
your project. your project.
You can now create a project in \QDS and import the .atbrige archive to it, as You can now create a project in \QDS and import the .qtbridge archive to it, as
described in \l {Creating Projects} and \l{Importing Designs}. described in \l {Creating Projects} and \l{Importing Designs}.
\section1 Specifying Export Path and Asset Format \section1 Specifying Export Path and Asset Format

View File

@@ -36,8 +36,9 @@
\QB is available for the following design tools: \QB is available for the following design tools:
\list \list
\li Adobe Photoshop version 22.3.1 \li Adobe Photoshop version 24.0
\li Figma version 97.x \li Adobe XD version 55.0.12
\li Sketch version 72.2 \li Figma version 116.4
\li Sketch version 90.0
\endlist \endlist
*/ */

View File

@@ -180,7 +180,7 @@
Each state group has its own property changes and transitions. Each state group has its own property changes and transitions.
By default, there is one root state group. By default, there is one default state group.
\section1 Extending States \section1 Extending States

View File

@@ -74,12 +74,6 @@ if [ ! -f "$libexec_path/ios/qt.conf" ]; then
cp -f "$(dirname "${BASH_SOURCE[0]}")/../dist/installer/mac/ios_qt.conf" "$libexec_path/ios/qt.conf" || exit 1 cp -f "$(dirname "${BASH_SOURCE[0]}")/../dist/installer/mac/ios_qt.conf" "$libexec_path/ios/qt.conf" || exit 1
fi fi
# copy qml2puppet's qt.conf
if [ ! -f "$libexec_path/qmldesigner/qt.conf" ]; then
echo "- Copying libexec/qmldesigner/qt.conf"
cp -f "$(dirname "${BASH_SOURCE[0]}")/../dist/installer/mac/qmldesigner_qt.conf" "$libexec_path/qmldesigner/qt.conf" || exit 1
fi
# copy Qt translations # copy Qt translations
# check for known existing translation to avoid copying multiple times # check for known existing translation to avoid copying multiple times
if [ ! -f "$resource_path/translations/qt_de.qm" ]; then if [ ! -f "$resource_path/translations/qt_de.qm" ]; then
@@ -114,10 +108,7 @@ fi
if [ ! -d "$app_path/Contents/Frameworks/QtCore.framework" ]; then if [ ! -d "$app_path/Contents/Frameworks/QtCore.framework" ]; then
qml2puppetapp="$libexec_path/qmldesigner/qml2puppet" echo "- Running macdeployqt ($bin_src/macdeployqt)"
if [ -f "$qml2puppetapp" ]; then
qml2puppetArgument="-executable=$qml2puppetapp"
fi
qbsapp="$app_path/Contents/MacOS/qbs" qbsapp="$app_path/Contents/MacOS/qbs"
if [ -f "$qbsapp" ]; then if [ -f "$qbsapp" ]; then
@@ -131,7 +122,10 @@ if [ ! -d "$app_path/Contents/Frameworks/QtCore.framework" ]; then
"-executable=$libexec_path/qbs_processlauncher") "-executable=$libexec_path/qbs_processlauncher")
fi fi
echo "- Running macdeployqt ($bin_src/macdeployqt)" qml2puppetapp="$libexec_path/qml2puppet"
if [ -f "$qml2puppetapp" ]; then
qml2puppetArgument="-executable=$qml2puppetapp"
fi
"$bin_src/macdeployqt" "$app_path" \ "$bin_src/macdeployqt" "$app_path" \
"-executable=$app_path/Contents/MacOS/qtdiag" \ "-executable=$app_path/Contents/MacOS/qtdiag" \

View File

@@ -4,7 +4,6 @@ set(resource_directories
glsl glsl
indexer_preincludes indexer_preincludes
modeleditor modeleditor
qml
qmldesigner qmldesigner
qmlicons qmlicons
qml-type-descriptions qml-type-descriptions

View File

@@ -1,75 +0,0 @@
INCLUDEPATH += $$PWD $$PWD/../interfaces
HEADERS += $$PWD/synchronizecommand.h \ \
$$PWD/captureddatacommand.h \
$$PWD/changepreviewimagesizecommand.h \
$$PWD/changelanguagecommand.h \
$$PWD//debugoutputcommand.h \
$$PWD/endpuppetcommand.h \
$$PWD/scenecreatedcommand.h \
$$PWD/tokencommand.h \
$$PWD/componentcompletedcommand.h \
$$PWD/completecomponentcommand.h \
$$PWD/statepreviewimagechangedcommand.h \
$$PWD/childrenchangedcommand.h \
$$PWD/changebindingscommand.h \
$$PWD/changefileurlcommand.h \
$$PWD/changeidscommand.h \
$$PWD/changenodesourcecommand.h \
$$PWD/changestatecommand.h \
$$PWD/changevaluescommand.h \
$$PWD/createscenecommand.h \
$$PWD/clearscenecommand.h \
$$PWD/createinstancescommand.h \
$$PWD/informationchangedcommand.h \
$$PWD/nanotracecommand.h \
$$PWD/pixmapchangedcommand.h \
$$PWD/removeinstancescommand.h \
$$PWD/removepropertiescommand.h \
$$PWD/reparentinstancescommand.h \
$$PWD/valueschangedcommand.h \
$$PWD/changeauxiliarycommand.h \
$$PWD/removesharedmemorycommand.h \
$$PWD/puppetalivecommand.h \
$$PWD/changeselectioncommand.h \
$$PWD/update3dviewstatecommand.h \
$$PWD/puppettocreatorcommand.h \
$$PWD/inputeventcommand.h \
$$PWD/view3dactioncommand.h \
$$PWD/requestmodelnodepreviewimagecommand.h
SOURCES += \
$$PWD/changepreviewimagesizecommand.cpp \
$$PWD/changelanguagecommand.cpp \
$$PWD/debugoutputcommand.cpp \
$$PWD/endpuppetcommand.cpp \
$$PWD/tokencommand.cpp \
$$PWD/componentcompletedcommand.cpp \
$$PWD/completecomponentcommand.cpp \
$$PWD/statepreviewimagechangedcommand.cpp \
$$PWD/childrenchangedcommand.cpp \
$$PWD/changebindingscommand.cpp \
$$PWD/changefileurlcommand.cpp \
$$PWD/changeidscommand.cpp \
$$PWD/changenodesourcecommand.cpp \
$$PWD/changestatecommand.cpp \
$$PWD/changevaluescommand.cpp \
$$PWD/informationchangedcommand.cpp \
$$PWD/nanotracecommand.cpp \
$$PWD/removeinstancescommand.cpp \
$$PWD/removepropertiescommand.cpp \
$$PWD/reparentinstancescommand.cpp \
$$PWD/valueschangedcommand.cpp \
$$PWD/clearscenecommand.cpp \
$$PWD/createinstancescommand.cpp \
$$PWD/createscenecommand.cpp \
$$PWD/pixmapchangedcommand.cpp \
$$PWD/changeauxiliarycommand.cpp \
$$PWD/removesharedmemorycommand.cpp \
$$PWD/puppetalivecommand.cpp \
$$PWD/changeselectioncommand.cpp \
$$PWD/update3dviewstatecommand.cpp \
$$PWD/puppettocreatorcommand.cpp \
$$PWD/inputeventcommand.cpp \
$$PWD/view3dactioncommand.cpp \
$$PWD/requestmodelnodepreviewimagecommand.cpp

View File

@@ -1,26 +0,0 @@
INCLUDEPATH += $$PWD/
HEADERS += $$PWD/addimportcontainer.h
HEADERS += $$PWD/mockuptypecontainer.h
HEADERS += $$PWD/sharedmemory.h
HEADERS += $$PWD/imagecontainer.h
HEADERS += $$PWD/idcontainer.h
HEADERS += $$PWD/informationcontainer.h
HEADERS += $$PWD/instancecontainer.h
HEADERS += $$PWD/reparentcontainer.h
HEADERS += $$PWD/propertyabstractcontainer.h
HEADERS += $$PWD/propertybindingcontainer.h
HEADERS += $$PWD/propertyvaluecontainer.h
SOURCES += $$PWD/addimportcontainer.cpp
SOURCES += $$PWD/mockuptypecontainer.cpp
unix:SOURCES += $$PWD/sharedmemory_unix.cpp
!unix:SOURCES += $$PWD/sharedmemory_qt.cpp
SOURCES += $$PWD/imagecontainer.cpp
SOURCES += $$PWD/idcontainer.cpp
SOURCES += $$PWD/informationcontainer.cpp
SOURCES += $$PWD/instancecontainer.cpp
SOURCES += $$PWD/reparentcontainer.cpp
SOURCES += $$PWD/propertyabstractcontainer.cpp
SOURCES += $$PWD/propertybindingcontainer.cpp
SOURCES += $$PWD/propertyvaluecontainer.cpp

View File

@@ -1,8 +0,0 @@
INCLUDEPATH += $$PWD/
HEADERS += $$PWD/nodeinstanceclientinterface.h
HEADERS += $$PWD/nodeinstanceglobal.h
HEADERS += $$PWD/nodeinstanceserverinterface.h
HEADERS += $$PWD/commondefines.h
SOURCES += $$PWD/nodeinstanceserverinterface.cpp

View File

@@ -1,46 +0,0 @@
QT += core gui widgets qml quick network
QT += core-private qml-private quick-private gui-private
CONFIG += c++17
win32:!mingw: QMAKE_CXXFLAGS += /std:c++17
DEFINES -= QT_CREATOR
# This .pri file contains classes to enable a special multilanguage translator
MULTILANGUAGE_SUPPORT_PRI=$$(MULTILANGUAGE_SUPPORT_PRI)
!isEmpty(MULTILANGUAGE_SUPPORT_PRI) {
exists($$(MULTILANGUAGE_SUPPORT_PRI)): message(including \"$$(MULTILANGUAGE_SUPPORT_PRI)\")
else: error("MULTILANGUAGE_SUPPORT_PRI: \"$$(MULTILANGUAGE_SUPPORT_PRI)\" does not exist.")
include($$(MULTILANGUAGE_SUPPORT_PRI))
DEFINES += MULTILANGUAGE_TRANSLATIONPROVIDER
}
include (editor3d/editor3d.pri)
include (../instances/instances.pri)
include (instances/instances.pri)
include (../commands/commands.pri)
include (../container/container.pri)
include (../interfaces/interfaces.pri)
include (../types/types.pri)
include (../qmlprivategate/qmlprivategate.pri)
include (iconrenderer/iconrenderer.pri)
include (import3d/import3d.pri)
SOURCES += $$PWD/qml2puppetmain.cpp
RESOURCES += $$PWD/../qmlpuppet.qrc
versionAtLeast(QT_VERSION, 6.0.0): RESOURCES += $$PWD/../editor3d_qt6.qrc
else: RESOURCES += $$PWD/../editor3d_qt5.qrc
DISTFILES += Info.plist
unix:!openbsd:!osx: LIBS += -lrt # posix shared memory
osx {
CONFIG -= app_bundle
QMAKE_LFLAGS += -Wl,-sectcreate,__TEXT,__info_plist,$$system_quote($$PWD/Info.plist)
}
osx: target.path = $$INSTALL_LIBEXEC_PATH/qmldesigner
else: target.path = $$INSTALL_LIBEXEC_PATH
INSTALLS += target

View File

@@ -1,11 +0,0 @@
TARGET = qml2puppet
TEMPLATE = app
CONFIG += console
build_all:!build_pass {
CONFIG -= build_all
CONFIG += release
}
include(qml2puppet.pri)

View File

@@ -1,31 +0,0 @@
# Try to find location of Qt private headers (see README)
isEmpty(QT_PRIVATE_HEADERS) {
QT_PRIVATE_HEADERS = $$[QT_INSTALL_HEADERS]
} else {
INCLUDEPATH += \
$${QT_PRIVATE_HEADERS} \
$${QT_PRIVATE_HEADERS}/QtCore \
$${QT_PRIVATE_HEADERS}/QtGui \
$${QT_PRIVATE_HEADERS}/QtScript \
$${QT_PRIVATE_HEADERS}/QtDeclarative
}
defineTest(minQtVersion) {
maj = $$1
min = $$2
patch = $$3
isEqual(QT_MAJOR_VERSION, $$maj) {
isEqual(QT_MINOR_VERSION, $$min) {
isEqual(QT_PATCH_VERSION, $$patch) {
return(true)
}
greaterThan(QT_PATCH_VERSION, $$patch) {
return(true)
}
}
greaterThan(QT_MINOR_VERSION, $$min) {
return(true)
}
}
return(false)
}

View File

@@ -1,3 +0,0 @@
INCLUDEPATH += $$PWD/
HEADERS += $$PWD/enumeration.h

View File

@@ -0,0 +1,121 @@
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtQuickDesignerTheme
import HelperWidgets as HelperWidgets
import StudioControls as StudioControls
import StudioTheme as StudioTheme
Item {
id: root
// Called also from C++ to close context menu on focus out
function closeContextMenu()
{
materialsView.closeContextMenu()
texturesView.closeContextMenu()
environmentsView.closeContextMenu()
}
// Called from C++
function clearSearchFilter()
{
searchBox.clear();
}
Column {
id: col
y: 5
spacing: 5
StudioControls.SearchBox {
id: searchBox
width: root.width
enabled: !materialsModel.hasMaterialRoot && materialsModel.hasQuick3DImport
onSearchChanged: (searchText) => {
rootView.handleSearchFilterChanged(searchText)
// make sure categories with matches are expanded
materialsView.expandVisibleSections()
}
}
Text {
// TODO: only disable the materials section, textures should be available
text: {
if (materialsModel.hasMaterialRoot)
qsTr("<b>Content Library</b> is disabled inside a material component.")
else if (!materialsModel.hasQuick3DImport)
qsTr("To use <b>Content Library</b>, first add the QtQuick3D module in the <b>Components</b> view.")
else
""
}
textFormat: Text.RichText
color: StudioTheme.Values.themeTextColor
font.pixelSize: StudioTheme.Values.mediumFontSize
topPadding: 30
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.WordWrap
width: root.width
visible: text !== ""
}
UnimportBundleMaterialDialog {
id: confirmUnimportDialog
}
ContentLibraryTabBar {
id: tabBar
visible: materialsModel.hasQuick3DImport
// TODO: update icons
tabsModel: [{name: qsTr("Materials"), icon: StudioTheme.Constants.gradient},
{name: qsTr("Textures"), icon: StudioTheme.Constants.materialPreviewEnvironment},
{name: qsTr("Environments"), icon: StudioTheme.Constants.translationSelectLanguages}]
}
StackLayout {
width: root.width
height: root.height - y
currentIndex: tabBar.currIndex
visible: materialsModel.hasQuick3DImport
ContentLibraryMaterialsView {
id: materialsView
width: root.width
searchBox: searchBox
onUnimport: (bundleMat) => {
unimportBundleMaterialDialog.targetBundleMaterial = bundleMat
unimportBundleMaterialDialog.open()
}
}
ContentLibraryTexturesView {
id: texturesView
width: root.width
model: texturesModel
searchBox: searchBox
}
ContentLibraryTexturesView {
id: environmentsView
width: root.width
model: environmentsModel
searchBox: searchBox
}
}
}
}

View File

@@ -1,27 +1,5 @@
/**************************************************************************** // Copyright (C) 2022 The Qt Company Ltd.
** // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
import QtQuick 2.15 import QtQuick 2.15
import QtQuick.Layouts 1.15 import QtQuick.Layouts 1.15
@@ -45,8 +23,8 @@ Item {
acceptedButtons: Qt.LeftButton | Qt.RightButton acceptedButtons: Qt.LeftButton | Qt.RightButton
onPressed: (mouse) => { onPressed: (mouse) => {
if (mouse.button === Qt.LeftButton && !materialBrowserBundleModel.importerRunning) if (mouse.button === Qt.LeftButton && !materialsModel.importerRunning)
rootView.startDragBundleMaterial(modelData, mapToGlobal(mouse.x, mouse.y)) rootView.startDragMaterial(modelData, mapToGlobal(mouse.x, mouse.y))
else if (mouse.button === Qt.RightButton) else if (mouse.button === Qt.RightButton)
root.showContextMenu() root.showContextMenu()
} }
@@ -102,10 +80,10 @@ Item {
pressColor: Qt.hsla(c.hslHue, c.hslSaturation, c.hslLightness, .4) pressColor: Qt.hsla(c.hslHue, c.hslSaturation, c.hslLightness, .4)
anchors.right: img.right anchors.right: img.right
anchors.bottom: img.bottom anchors.bottom: img.bottom
enabled: !materialBrowserBundleModel.importerRunning enabled: !materialsModel.importerRunning
onClicked: { onClicked: {
materialBrowserBundleModel.addToProject(modelData) materialsModel.addToProject(modelData)
} }
} }
} }

View File

@@ -0,0 +1,52 @@
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
import QtQuick 2.15
import HelperWidgets 2.0
import StudioControls 1.0 as StudioControls
import StudioTheme 1.0 as StudioTheme
StudioControls.Menu {
id: root
property var targetMaterial: null
signal unimport(var bundleMat);
function popupMenu(targetMaterial = null)
{
this.targetMaterial = targetMaterial
popup()
}
closePolicy: StudioControls.Menu.CloseOnEscape | StudioControls.Menu.CloseOnPressOutside
StudioControls.MenuItem {
text: qsTr("Apply to selected (replace)")
enabled: root.targetMaterial && materialsModel.hasModelSelection
onTriggered: materialsModel.applyToSelected(root.targetMaterial, false)
}
StudioControls.MenuItem {
text: qsTr("Apply to selected (add)")
enabled: root.targetMaterial && materialsModel.hasModelSelection
onTriggered: materialsModel.applyToSelected(root.targetMaterial, true)
}
StudioControls.MenuSeparator {}
StudioControls.MenuItem {
enabled: !materialsModel.importerRunning
text: qsTr("Add an instance to project")
onTriggered: {
materialsModel.addToProject(root.targetMaterial)
}
}
StudioControls.MenuItem {
enabled: !materialsModel.importerRunning && root.targetMaterial && root.targetMaterial.bundleMaterialImported
text: qsTr("Remove from project")
onTriggered: root.unimport(root.targetMaterial);
}
}

View File

@@ -0,0 +1,91 @@
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
import QtQuick
import HelperWidgets as HelperWidgets
import StudioControls as StudioControls
import StudioTheme as StudioTheme
HelperWidgets.ScrollView {
id: root
clip: true
readonly property int cellWidth: 100
readonly property int cellHeight: 120
property var currMaterialItem: null
property var rootItem: null
required property var searchBox
signal unimport(var bundleMat);
function closeContextMenu()
{
ctxMenu.close()
}
function expandVisibleSections()
{
for (let i = 0; i < categoryRepeater.count; ++i) {
let cat = categoryRepeater.itemAt(i)
if (cat.visible && !cat.expanded)
cat.expanded = true
}
}
Column {
ContentLibraryMaterialContextMenu {
id: ctxMenu
onUnimport: (bundleMat) => root.unimport(bundleMat)
}
Repeater {
id: categoryRepeater
model: materialsModel
delegate: HelperWidgets.Section {
width: root.width
caption: bundleCategoryName
addTopPadding: false
sectionBackgroundColor: "transparent"
visible: bundleCategoryVisible
expanded: bundleCategoryExpanded
expandOnClick: false
onToggleExpand: bundleCategoryExpanded = !bundleCategoryExpanded
Grid {
width: root.width
leftPadding: 5
rightPadding: 5
bottomPadding: 5
columns: root.width / root.cellWidth
Repeater {
model: bundleCategoryMaterials
delegate: ContentLibraryMaterial {
width: root.cellWidth
height: root.cellHeight
onShowContextMenu: ctxMenu.popupMenu(modelData)
}
}
}
}
}
Text {
id: noMatchText
text: qsTr("No match found.");
color: StudioTheme.Values.themeTextColor
font.pixelSize: StudioTheme.Values.baseFontSize
topPadding: 10
leftPadding: 10
visible: materialsModel.isEmpty && !searchBox.isEmpty() && !materialsModel.hasMaterialRoot
}
}
}

View File

@@ -0,0 +1,33 @@
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
import QtQuick
import StudioTheme as StudioTheme
Rectangle {
id: root
width: parent.width
height: 50
color: StudioTheme.Values.themeSectionHeadBackground
property int currIndex: 0
property alias tabsModel: repeater.model
Row {
spacing: 1
Repeater {
id: repeater
ContentLibraryTabButton {
height: root.height
name: modelData.name
icon: modelData.icon
selected: root.currIndex === index
onClicked: root.currIndex = index
}
}
}
}

View File

@@ -0,0 +1,58 @@
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
import QtQuick
import StudioTheme as StudioTheme
Rectangle {
id: root
signal clicked()
property alias icon: icon.text
property alias name: name.text
property bool selected: false
width: 100
height: 100
color: root.selected ? StudioTheme.Values.themePanelBackground
: mouseArea.containsMouse ? Qt.lighter(StudioTheme.Values.themeSectionHeadBackground, 1.3)
: StudioTheme.Values.themeSectionHeadBackground
Text {
id: icon
color: root.selected ? StudioTheme.Values.themeInteraction : StudioTheme.Values.themeTextColor
font.family: StudioTheme.Constants.iconFont.family
font.pixelSize: StudioTheme.Values.mediumIconFontSize
anchors.horizontalCenter: parent.horizontalCenter
y: 8
}
Text {
id: name
font.weight: Font.DemiBold
font.pixelSize: StudioTheme.Values.baseFontSize
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: 6
color: root.selected ? StudioTheme.Values.themeInteraction : StudioTheme.Values.themeTextColor
}
Rectangle { // strip
width: root.width
height: 4
color: root.selected ? StudioTheme.Values.themeInteraction : "transparent"
anchors.bottom: parent.bottom
}
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
onClicked: root.clicked()
}
}

View File

@@ -0,0 +1,34 @@
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuickDesignerTheme 1.0
import HelperWidgets 2.0
import QtQuick.Controls
import StudioTheme 1.0 as StudioTheme
Image {
id: root
source: modelData.textureIcon
visible: modelData.textureVisible
cache: false
signal showContextMenu()
MouseArea {
id: mouseArea
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton
onPressed: (mouse) => {
if (mouse.button === Qt.LeftButton)
rootView.startDragTexture(modelData, mapToGlobal(mouse.x, mouse.y))
else if (mouse.button === Qt.RightButton)
root.showContextMenu()
}
}
}

View File

@@ -0,0 +1,40 @@
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
import QtQuick 2.15
import HelperWidgets 2.0
import StudioControls 1.0 as StudioControls
import StudioTheme 1.0 as StudioTheme
StudioControls.Menu {
id: root
property var targetTexture: null
property bool hasSceneEnv: false
function popupMenu(targetTexture = null)
{
this.targetTexture = targetTexture
popup()
}
closePolicy: StudioControls.Menu.CloseOnEscape | StudioControls.Menu.CloseOnPressOutside
StudioControls.MenuItem {
text: qsTr("Add image")
enabled: root.targetTexture
onTriggered: rootView.addImage(root.targetTexture)
}
StudioControls.MenuItem {
text: qsTr("Add texture")
enabled: root.targetTexture
onTriggered: rootView.addTexture(root.targetTexture)
}
StudioControls.MenuItem {
text: qsTr("Add light probe")
enabled: root.hasSceneEnv && root.targetTexture
onTriggered: rootView.addLightProbe(root.targetTexture)
}
}

View File

@@ -0,0 +1,92 @@
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
import QtQuick
import HelperWidgets as HelperWidgets
import StudioControls as StudioControls
import StudioTheme as StudioTheme
HelperWidgets.ScrollView {
id: root
clip: true
readonly property int cellWidth: 100
readonly property int cellHeight: 100
property var currMaterialItem: null
property var rootItem: null
required property var searchBox
required property var model
signal unimport(var bundleMat);
function closeContextMenu()
{
ctxMenu.close()
}
function expandVisibleSections()
{
for (let i = 0; i < categoryRepeater.count; ++i) {
let cat = categoryRepeater.itemAt(i)
if (cat.visible && !cat.expanded)
cat.expanded = true
}
}
Column {
ContentLibraryTextureContextMenu {
id: ctxMenu
hasSceneEnv: root.model.hasSceneEnv
}
Repeater {
id: categoryRepeater
model: root.model
delegate: HelperWidgets.Section {
width: root.width
caption: bundleCategoryName
addTopPadding: false
sectionBackgroundColor: "transparent"
visible: bundleCategoryVisible
expanded: bundleCategoryExpanded
expandOnClick: false
onToggleExpand: bundleCategoryExpanded = !bundleCategoryExpanded
Grid {
width: root.width
leftPadding: 5
rightPadding: 5
bottomPadding: 5
spacing: 5
columns: root.width / root.cellWidth
Repeater {
model: bundleCategoryTextures
delegate: ContentLibraryTexture {
width: root.cellWidth
height: root.cellHeight
onShowContextMenu: ctxMenu.popupMenu(modelData)
}
}
}
}
}
Text {
id: noMatchText
text: qsTr("No match found.");
color: StudioTheme.Values.themeTextColor
font.pixelSize: StudioTheme.Values.baseFontSize
topPadding: 10
leftPadding: 10
visible: root.model.isEmpty && !searchBox.isEmpty() && !root.model.hasMaterialRoot
}
}
}

View File

@@ -1,27 +1,5 @@
/**************************************************************************** // Copyright (C) 2022 The Qt Company Ltd.
** // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
import QtQuick import QtQuick
import QtQuick.Controls import QtQuick.Controls
@@ -69,7 +47,7 @@ Dialog {
text: qsTr("Remove") text: qsTr("Remove")
onClicked: { onClicked: {
materialBrowserBundleModel.removeFromProject(root.targetBundleMaterial) materialsModel.removeFromProject(root.targetBundleMaterial)
root.accept() root.accept()
} }
} }

View File

@@ -19,13 +19,12 @@ Item {
function closeContextMenu() function closeContextMenu()
{ {
ctxMenu.close() ctxMenu.close()
ctxMenuBundle.close()
} }
// Called from C++ to refresh a preview material after it changes // Called from C++ to refresh a preview material after it changes
function refreshPreview(idx) function refreshPreview(idx)
{ {
var item = gridRepeater.itemAt(idx); var item = materialRepeater.itemAt(idx);
if (item) if (item)
item.refreshPreview(); item.refreshPreview();
} }
@@ -36,6 +35,17 @@ Item {
searchBox.clear(); searchBox.clear();
} }
MouseArea {
id: focusGrabber
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton
onPressed: (mouse) => {
forceActiveFocus() // Steal focus from name edit
mouse.accepted = false
}
z: 1
}
MouseArea { MouseArea {
id: rootMouseArea id: rootMouseArea
@@ -44,12 +54,14 @@ Item {
acceptedButtons: Qt.RightButton acceptedButtons: Qt.RightButton
onClicked: (mouse) => { onClicked: (mouse) => {
// root context-menu works only for user materials if (materialBrowserModel.hasMaterialRoot || !materialBrowserModel.hasQuick3DImport)
var userMatsSecBottom = mapFromItem(userMaterialsSection, 0, userMaterialsSection.y).y return;
+ userMaterialsSection.height;
var matsSecBottom = mapFromItem(materialsSection, 0, materialsSection.y).y
+ materialsSection.height;
if (!materialBrowserModel.hasMaterialRoot && materialBrowserModel.hasQuick3DImport if (!materialBrowserModel.hasMaterialRoot && materialBrowserModel.hasQuick3DImport
&& (!materialBrowserBundleModel.matBundleExists || mouse.y < userMatsSecBottom)) { && mouse.y < matsSecBottom) {
ctxMenu.popupMenu() ctxMenu.popupMenu()
} }
} }
@@ -63,7 +75,7 @@ Item {
if (root.currMaterialItem) if (root.currMaterialItem)
root.currMaterialItem.commitRename(); root.currMaterialItem.commitRename();
root.currMaterialItem = gridRepeater.itemAt(materialBrowserModel.selectedIndex); root.currMaterialItem = materialRepeater.itemAt(materialBrowserModel.selectedIndex);
} }
} }
@@ -71,19 +83,6 @@ Item {
id: ctxMenu id: ctxMenu
} }
MaterialBundleContextMenu {
id: ctxMenuBundle
onUnimport: (bundleMat) => {
unimportBundleMaterialDialog.targetBundleMaterial = bundleMat
unimportBundleMaterialDialog.open()
}
}
UnimportBundleMaterialDialog {
id: unimportBundleMaterialDialog
}
Column { Column {
id: col id: col
y: 5 y: 5
@@ -100,19 +99,6 @@ Item {
onSearchChanged: (searchText) => { onSearchChanged: (searchText) => {
rootView.handleSearchFilterChanged(searchText) rootView.handleSearchFilterChanged(searchText)
// make sure searched categories that have matches are expanded
if (!materialBrowserModel.isEmpty && !userMaterialsSection.expanded)
userMaterialsSection.expanded = true
if (!materialBrowserBundleModel.isEmpty && !bundleMaterialsSection.expanded)
bundleMaterialsSection.expanded = true
for (let i = 0; i < bundleMaterialsSectionRepeater.count; ++i) {
let sec = bundleMaterialsSectionRepeater.itemAt(i)
if (sec.visible && !sec.expanded)
sec.expanded = true
}
} }
} }
@@ -156,29 +142,28 @@ Item {
height: root.height - searchBox.height height: root.height - searchBox.height
clip: true clip: true
visible: materialBrowserModel.hasQuick3DImport && !materialBrowserModel.hasMaterialRoot visible: materialBrowserModel.hasQuick3DImport && !materialBrowserModel.hasMaterialRoot
interactive: !ctxMenu.opened && !ctxMenuBundle.opened interactive: !ctxMenu.opened
Column { Column {
Section { Section {
id: userMaterialsSection id: materialsSection
width: root.width width: root.width
caption: qsTr("Materials") caption: qsTr("Materials")
hideHeader: !materialBrowserBundleModel.matBundleExists
dropEnabled: true dropEnabled: true
onDropEnter: (drag) => { onDropEnter: (drag) => {
drag.accepted = rootView.draggedBundleMaterial drag.accepted = drag.formats[0] === "application/vnd.qtdesignstudio.bundlematerial"
userMaterialsSection.highlight = rootView.draggedBundleMaterial materialsSection.highlight = drag.accepted
} }
onDropExit: { onDropExit: {
userMaterialsSection.highlight = false materialsSection.highlight = false
} }
onDrop: { onDrop: {
userMaterialsSection.highlight = false materialsSection.highlight = false
materialBrowserBundleModel.addToProject(rootView.draggedBundleMaterial) rootView.acceptBundleMaterialDrop()
} }
Grid { Grid {
@@ -191,7 +176,7 @@ Item {
columns: root.width / root.cellWidth columns: root.width / root.cellWidth
Repeater { Repeater {
id: gridRepeater id: materialRepeater
model: materialBrowserModel model: materialBrowserModel
delegate: MaterialItem { delegate: MaterialItem {
@@ -226,30 +211,10 @@ Item {
} }
Section { Section {
id: bundleMaterialsSection id: texturesSection
width: root.width width: root.width
caption: qsTr("Material Library") caption: qsTr("Textures")
addTopPadding: noMatchText.visible
visible: materialBrowserBundleModel.matBundleExists
Column {
Repeater {
id: bundleMaterialsSectionRepeater
model: materialBrowserBundleModel
delegate: Section {
width: root.width
caption: bundleCategoryName
addTopPadding: false
sectionBackgroundColor: "transparent"
visible: bundleCategoryVisible
expanded: bundleCategoryExpanded
expandOnClick: false
onToggleExpand: bundleCategoryExpanded = !bundleCategoryExpanded
onExpand: bundleCategoryExpanded = true
onCollapse: bundleCategoryExpanded = false
Grid { Grid {
width: scrollView.width width: scrollView.width
@@ -259,29 +224,37 @@ Item {
columns: root.width / root.cellWidth columns: root.width / root.cellWidth
Repeater { Repeater {
model: bundleCategoryMaterials id: texturesRepeater
delegate: BundleMaterialItem { model: materialBrowserTexturesModel
delegate: TextureItem {
width: root.cellWidth width: root.cellWidth
height: root.cellHeight height: root.cellWidth
onShowContextMenu: { onShowContextMenu: {
ctxMenuBundle.popupMenu(modelData) // ctxMenuTexture.popupMenu(this, model) // TODO: implement textures context menu
}
}
} }
} }
} }
} }
Text { Text {
id: noMatchText
text: qsTr("No match found."); text: qsTr("No match found.");
color: StudioTheme.Values.themeTextColor color: StudioTheme.Values.themeTextColor
font.pixelSize: StudioTheme.Values.baseFontSize font.pixelSize: StudioTheme.Values.baseFontSize
leftPadding: 10 leftPadding: 10
visible: materialBrowserBundleModel.isEmpty && !searchBox.isEmpty() && !materialBrowserModel.hasMaterialRoot visible: materialBrowserModel.isEmpty && !searchBox.isEmpty() && !materialBrowserModel.hasMaterialRoot
} }
Text {
text:qsTr("There are no texture in this project.")
visible: materialBrowserTexturesModel.isEmpty && searchBox.isEmpty()
textFormat: Text.RichText
color: StudioTheme.Values.themeTextColor
font.pixelSize: StudioTheme.Values.mediumFontSize
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.WordWrap
width: root.width
} }
} }
} }

View File

@@ -1,27 +1,5 @@
/**************************************************************************** // Copyright (C) 2022 The Qt Company Ltd.
** // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
import QtQuick import QtQuick
import HelperWidgets import HelperWidgets

View File

@@ -1,74 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
import QtQuick 2.15
import HelperWidgets 2.0
import StudioControls 1.0 as StudioControls
import StudioTheme 1.0 as StudioTheme
StudioControls.Menu {
id: root
property var targetMaterial: null
signal unimport(var bundleMat);
function popupMenu(targetMaterial = null)
{
this.targetMaterial = targetMaterial
popup()
}
closePolicy: StudioControls.Menu.CloseOnEscape | StudioControls.Menu.CloseOnPressOutside
StudioControls.MenuItem {
text: qsTr("Apply to selected (replace)")
enabled: root.targetMaterial && materialBrowserModel.hasModelSelection
onTriggered: materialBrowserBundleModel.applyToSelected(root.targetMaterial, false)
}
StudioControls.MenuItem {
text: qsTr("Apply to selected (add)")
enabled: root.targetMaterial && materialBrowserModel.hasModelSelection
onTriggered: materialBrowserBundleModel.applyToSelected(root.targetMaterial, true)
}
StudioControls.MenuSeparator {}
StudioControls.MenuItem {
enabled: !materialBrowserBundleModel.importerRunning
text: qsTr("Add an instance to project")
onTriggered: {
materialBrowserBundleModel.addToProject(root.targetMaterial)
}
}
StudioControls.MenuItem {
enabled: !materialBrowserBundleModel.importerRunning && root.targetMaterial.bundleMaterialImported
text: qsTr("Remove from project")
onTriggered: root.unimport(root.targetMaterial);
}
}

View File

@@ -23,6 +23,7 @@ Rectangle {
matName.readOnly = false matName.readOnly = false
matName.selectAll() matName.selectAll()
matName.forceActiveFocus() matName.forceActiveFocus()
matName.ensureVisible(matName.text.length)
nameMouseArea.enabled = false nameMouseArea.enabled = false
} }
@@ -31,10 +32,8 @@ Rectangle {
if (matName.readOnly) if (matName.readOnly)
return; return;
matName.readOnly = true
nameMouseArea.enabled = true
materialBrowserModel.renameMaterial(index, matName.text); materialBrowserModel.renameMaterial(index, matName.text);
mouseArea.forceActiveFocus()
} }
border.width: materialBrowserModel.selectedIndex === index ? 1 : 0 border.width: materialBrowserModel.selectedIndex === index ? 1 : 0
@@ -102,6 +101,16 @@ Rectangle {
onEditingFinished: root.commitRename() onEditingFinished: root.commitRename()
onActiveFocusChanged: {
if (!activeFocus) {
matName.readOnly = true
nameMouseArea.enabled = true
ensureVisible(0)
}
}
Component.onCompleted: ensureVisible(0)
MouseArea { MouseArea {
id: nameMouseArea id: nameMouseArea

View File

@@ -0,0 +1,46 @@
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
import QtQuick
import QtQuick.Layouts
import QtQuickDesignerTheme
import HelperWidgets
import StudioTheme as StudioTheme
Rectangle {
id: root
visible: textureVisible
color: "transparent"
border.width: materialBrowserTexturesModel.selectedIndex === index ? 1 : 0
border.color: materialBrowserTexturesModel.selectedIndex === index
? StudioTheme.Values.themeControlOutlineInteraction
: "transparent"
signal showContextMenu()
MouseArea {
id: mouseArea
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton
onPressed: (mouse) => {
materialBrowserTexturesModel.selectTexture(index)
if (mouse.button === Qt.LeftButton)
rootView.startDragTexture(index, mapToGlobal(mouse.x, mouse.y))
else if (mouse.button === Qt.RightButton)
root.showContextMenu()
}
}
Image {
source: textureSource
sourceSize.width: root.width - 10
sourceSize.height: root.height - 10
anchors.centerIn: parent
cache: false
}
}

View File

@@ -85,10 +85,11 @@ Column {
CheckBox { CheckBox {
text: backendValues.indeterminate.valueToString text: backendValues.indeterminate.valueToString
implicitWidth: StudioTheme.Values.twoControlColumnWidth implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidt + StudioTheme.Values.actionIndicatorWidth
backendValue: backendValues.indeterminate backendValue: backendValues.indeterminate
enabled: backendValue.isAvailable enabled: backendValue.isAvailable
} }
ExpandingSpacer {}
} }
} }
} }

View File

@@ -32,7 +32,7 @@ T.CheckBox {
implicitContentHeight + topPadding + bottomPadding, implicitContentHeight + topPadding + bottomPadding,
implicitIndicatorHeight + topPadding + bottomPadding) implicitIndicatorHeight + topPadding + bottomPadding)
spacing: StudioTheme.Values.checkBoxSpacing spacing: checkBoxLabel.visible ? StudioTheme.Values.checkBoxSpacing : 0
hoverEnabled: true hoverEnabled: true
activeFocusOnTab: false activeFocusOnTab: false
@@ -85,7 +85,7 @@ T.CheckBox {
text: myCheckBox.text text: myCheckBox.text
font: myCheckBox.font font: myCheckBox.font
color: StudioTheme.Values.themeTextColor color: StudioTheme.Values.themeTextColor
visible: text !== "" visible: checkBoxLabel.text !== ""
} }
states: [ states: [

View File

@@ -19,10 +19,14 @@ T.SpinBox {
property bool edit: spinBoxInput.activeFocus property bool edit: spinBoxInput.activeFocus
// This property is used to indicate the global hover state // This property is used to indicate the global hover state
property bool hover: (mySpinBox.hovered || actionIndicator.hover) && mySpinBox.enabled property bool hover: (spinBoxInput.hover || actionIndicator.hover || spinBoxIndicatorUp.hover
|| spinBoxIndicatorDown.hover || sliderIndicator.hover)
&& mySpinBox.enabled
property bool drag: false property bool drag: false
property bool sliderDrag: sliderPopup.drag property bool sliderDrag: sliderPopup.drag
property bool dirty: false // user modification flag
property alias actionIndicatorVisible: actionIndicator.visible property alias actionIndicatorVisible: actionIndicator.visible
property real __actionIndicatorWidth: StudioTheme.Values.actionIndicatorWidth property real __actionIndicatorWidth: StudioTheme.Values.actionIndicatorWidth
property real __actionIndicatorHeight: StudioTheme.Values.actionIndicatorHeight property real __actionIndicatorHeight: StudioTheme.Values.actionIndicatorHeight
@@ -35,12 +39,22 @@ T.SpinBox {
property real __sliderIndicatorWidth: StudioTheme.Values.sliderIndicatorWidth property real __sliderIndicatorWidth: StudioTheme.Values.sliderIndicatorWidth
property real __sliderIndicatorHeight: StudioTheme.Values.sliderIndicatorHeight property real __sliderIndicatorHeight: StudioTheme.Values.sliderIndicatorHeight
property alias __devicePixelRatio: spinBoxInput.devicePixelRatio
property alias pixelsPerUnit: spinBoxInput.pixelsPerUnit
property alias compressedValueTimer: myTimer
property string preFocusText: ""
signal compressedValueModified signal compressedValueModified
signal dragStarted
signal dragEnded
signal dragging
// Use custom wheel handling due to bugs // Use custom wheel handling due to bugs
property bool __wheelEnabled: false property bool __wheelEnabled: false
wheelEnabled: false wheelEnabled: false
hoverEnabled: true // TODO hoverEnabled: true
width: StudioTheme.Values.defaultControlWidth width: StudioTheme.Values.defaultControlWidth
height: StudioTheme.Values.defaultControlHeight height: StudioTheme.Values.defaultControlHeight
@@ -82,12 +96,11 @@ T.SpinBox {
myControl: mySpinBox myControl: mySpinBox
iconFlip: -1 iconFlip: -1
visible: mySpinBox.spinBoxIndicatorVisible visible: mySpinBox.spinBoxIndicatorVisible
//hover: mySpinBox.up.hovered // TODO QTBUG-74688
pressed: mySpinBox.up.pressed pressed: mySpinBox.up.pressed
x: actionIndicator.width + StudioTheme.Values.border x: actionIndicator.width + StudioTheme.Values.border
y: StudioTheme.Values.border y: StudioTheme.Values.border
width: spinBoxIndicatorVisible ? mySpinBox.__spinBoxIndicatorWidth : 0 width: mySpinBox.spinBoxIndicatorVisible ? mySpinBox.__spinBoxIndicatorWidth : 0
height: spinBoxIndicatorVisible ? mySpinBox.__spinBoxIndicatorHeight : 0 height: mySpinBox.spinBoxIndicatorVisible ? mySpinBox.__spinBoxIndicatorHeight : 0
enabled: (mySpinBox.from < mySpinBox.to) ? mySpinBox.value < mySpinBox.to enabled: (mySpinBox.from < mySpinBox.to) ? mySpinBox.value < mySpinBox.to
: mySpinBox.value > mySpinBox.to : mySpinBox.value > mySpinBox.to
@@ -97,12 +110,11 @@ T.SpinBox {
id: spinBoxIndicatorDown id: spinBoxIndicatorDown
myControl: mySpinBox myControl: mySpinBox
visible: mySpinBox.spinBoxIndicatorVisible visible: mySpinBox.spinBoxIndicatorVisible
//hover: mySpinBox.down.hovered // TODO QTBUG-74688
pressed: mySpinBox.down.pressed pressed: mySpinBox.down.pressed
x: actionIndicator.width + StudioTheme.Values.border x: actionIndicator.width + StudioTheme.Values.border
y: spinBoxIndicatorUp.y + spinBoxIndicatorUp.height y: spinBoxIndicatorUp.y + spinBoxIndicatorUp.height
width: spinBoxIndicatorVisible ? mySpinBox.__spinBoxIndicatorWidth : 0 width: mySpinBox.spinBoxIndicatorVisible ? mySpinBox.__spinBoxIndicatorWidth : 0
height: spinBoxIndicatorVisible ? mySpinBox.__spinBoxIndicatorHeight : 0 height: mySpinBox.spinBoxIndicatorVisible ? mySpinBox.__spinBoxIndicatorHeight : 0
enabled: (mySpinBox.from < mySpinBox.to) ? mySpinBox.value > mySpinBox.from enabled: (mySpinBox.from < mySpinBox.to) ? mySpinBox.value > mySpinBox.from
: mySpinBox.value < mySpinBox.from : mySpinBox.value < mySpinBox.from
@@ -111,6 +123,23 @@ T.SpinBox {
contentItem: SpinBoxInput { contentItem: SpinBoxInput {
id: spinBoxInput id: spinBoxInput
myControl: mySpinBox myControl: mySpinBox
function handleEditingFinished() {
mySpinBox.focus = false
// Keep the dirty state before calling setValueFromInput(),
// it will be set to false (cleared) internally
var valueModified = mySpinBox.dirty
mySpinBox.setValueFromInput()
myTimer.stop()
// Only trigger the signal, if the value was modified
if (valueModified)
mySpinBox.compressedValueModified()
}
onEditingFinished: spinBoxInput.handleEditingFinished()
} }
background: Rectangle { background: Rectangle {
@@ -216,7 +245,7 @@ T.SpinBox {
id: myTimer id: myTimer
repeat: false repeat: false
running: false running: false
interval: 100 interval: 400
onTriggered: mySpinBox.compressedValueModified() onTriggered: mySpinBox.compressedValueModified()
} }
@@ -224,9 +253,10 @@ T.SpinBox {
onFocusChanged: mySpinBox.setValueFromInput() onFocusChanged: mySpinBox.setValueFromInput()
onDisplayTextChanged: spinBoxInput.text = mySpinBox.displayText onDisplayTextChanged: spinBoxInput.text = mySpinBox.displayText
onActiveFocusChanged: { onActiveFocusChanged: {
if (mySpinBox.activeFocus) if (mySpinBox.activeFocus) { // QTBUG-75862 && mySpinBox.focusReason === Qt.TabFocusReason)
// QTBUG-75862 && mySpinBox.focusReason === Qt.TabFocusReason) mySpinBox.preFocusText = spinBoxInput.text
spinBoxInput.selectAll() spinBoxInput.selectAll()
}
if (sliderPopup.opened && !mySpinBox.activeFocus) if (sliderPopup.opened && !mySpinBox.activeFocus)
sliderPopup.close() sliderPopup.close()
@@ -265,8 +295,11 @@ T.SpinBox {
mySpinBox.stepSize = currStepSize mySpinBox.stepSize = currStepSize
} }
if (event.key === Qt.Key_Escape) if (event.key === Qt.Key_Escape) {
mySpinBox.focus = false spinBoxInput.text = mySpinBox.preFocusText
mySpinBox.dirty = true
spinBoxInput.handleEditingFinished()
}
// FIX: This is a temporary fix for QTBUG-74239 // FIX: This is a temporary fix for QTBUG-74239
if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter)
@@ -274,13 +307,13 @@ T.SpinBox {
} }
function clamp(v, lo, hi) { function clamp(v, lo, hi) {
if (v < lo || v > hi) return (v < lo || v > hi) ? Math.min(Math.max(lo, v), hi) : v
return Math.min(Math.max(lo, v), hi)
return v
} }
function setValueFromInput() { function setValueFromInput() {
if (!mySpinBox.dirty)
return
// FIX: This is a temporary fix for QTBUG-74239 // FIX: This is a temporary fix for QTBUG-74239
var currValue = mySpinBox.value var currValue = mySpinBox.value
@@ -298,5 +331,7 @@ T.SpinBox {
if (mySpinBox.value !== currValue) if (mySpinBox.value !== currValue)
mySpinBox.valueModified() mySpinBox.valueModified()
mySpinBox.dirty = false
} }
} }

View File

@@ -14,6 +14,9 @@ TextInput {
property bool drag: false property bool drag: false
property bool hover: mouseArea.containsMouse && textInput.enabled property bool hover: mouseArea.containsMouse && textInput.enabled
property int devicePixelRatio: 1
property int pixelsPerUnit: 10
z: 2 z: 2
font: myControl.font font: myControl.font
color: StudioTheme.Values.themeTextColor color: StudioTheme.Values.themeTextColor
@@ -75,38 +78,197 @@ TextInput {
} }
} }
TapHandler { Item {
id: tapHandler id: dragModifierWorkaround
acceptedDevices: PointerDevice.Mouse Keys.onPressed: function(event) {
enabled: true event.accepted = true
onTapped: {
textInput.forceActiveFocus() if (event.modifiers & Qt.ControlModifier) {
textInput.deselect() // QTBUG-75862 mouseArea.stepSize = myControl.minStepSize
mouseArea.calcValue()
} }
if (event.modifiers & Qt.ShiftModifier) {
mouseArea.stepSize = myControl.maxStepSize
mouseArea.calcValue()
}
}
Keys.onReleased: function(event) {
event.accepted = true
mouseArea.stepSize = myControl.realStepSize
mouseArea.calcValue()
}
}
// Ensure that we get Up and Down key press events first
Keys.onShortcutOverride: function(event) {
event.accepted = (event.key === Qt.Key_Up || event.key === Qt.Key_Down)
} }
MouseArea { MouseArea {
id: mouseArea id: mouseArea
property real stepSize: myControl.stepSize
// Properties to store the state of a drag operation
property bool dragging: false
property bool hasDragged: false
property bool potentialDragStart: false
property int initialValue: myControl.value // value on drag operation starts
property int pressStartX: 0
property int dragStartX: 0
property int translationX: 0
property int dragDirection: 0
property int totalUnits: 0 // total number of units dragged
property int units: 0
property real __pixelsPerUnit: textInput.devicePixelRatio * textInput.pixelsPerUnit
anchors.fill: parent anchors.fill: parent
enabled: true enabled: true
hoverEnabled: true hoverEnabled: true
propagateComposedEvents: true propagateComposedEvents: true
acceptedButtons: Qt.LeftButton acceptedButtons: Qt.LeftButton
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onPressed: function(mouse) { mouse.accepted = false } preventStealing: true
onWheel: function(wheel) {
if (!myControl.__wheelEnabled) onPositionChanged: function(mouse) {
if (!mouseArea.dragging
&& !myControl.edit
&& Math.abs(mouseArea.pressStartX - mouse.x) > StudioTheme.Values.dragThreshold
&& mouse.buttons === Qt.LeftButton
&& mouseArea.potentialDragStart) {
mouseArea.dragging = true
mouseArea.potentialDragStart = false
mouseArea.initialValue = myControl.value
mouseArea.cursorShape = Qt.ClosedHandCursor
mouseArea.dragStartX = mouse.x
myControl.drag = true
myControl.dragStarted()
// Force focus on the non visible component to receive key events
dragModifierWorkaround.forceActiveFocus()
textInput.deselect()
}
if (!mouseArea.dragging)
return return
mouse.accepted = true
var translationX = mouse.x - mouseArea.dragStartX
// Early return if mouse didn't move along x-axis
if (translationX === 0)
return
var currentDragDirection = Math.sign(translationX)
// Has drag direction changed
if (currentDragDirection !== mouseArea.dragDirection) {
mouseArea.translationX = 0
mouseArea.dragDirection = currentDragDirection
mouseArea.totalUnits = mouseArea.units
}
mouseArea.translationX += translationX
mouseArea.calcValue()
//myControl.realValueModified()
}
onClicked: function(mouse) {
if (textInput.edit)
mouse.accepted = false
if (mouseArea.hasDragged) {
mouseArea.hasDragged = false
return
}
textInput.forceActiveFocus()
textInput.deselect() // QTBUG-75862
}
onPressed: function(mouse) {
if (textInput.edit)
mouse.accepted = false
mouseArea.potentialDragStart = true
mouseArea.pressStartX = mouse.x
}
onReleased: function(mouse) {
if (textInput.edit)
mouse.accepted = false
mouseArea.endDrag()
}
function endDrag() {
if (!mouseArea.dragging)
return
mouseArea.dragging = false
mouseArea.hasDragged = true
if (myControl.compressedValueTimer.running) {
myControl.compressedValueTimer.stop()
mouseArea.calcValue()
myControl.compressedValueModified()
}
mouseArea.cursorShape = Qt.PointingHandCursor
myControl.drag = false
myControl.dragEnded()
// Avoid active focus on the component after dragging
dragModifierWorkaround.focus = false
textInput.focus = false
myControl.focus = false
mouseArea.translationX = 0
mouseArea.units = 0
mouseArea.totalUnits = 0
}
function calcValue() {
var minUnit = (myControl.from - mouseArea.initialValue) / mouseArea.stepSize
var maxUnit = (myControl.to - mouseArea.initialValue) / mouseArea.stepSize
var units = Math.trunc(mouseArea.translationX / mouseArea.__pixelsPerUnit)
mouseArea.units = Math.min(Math.max(mouseArea.totalUnits + units, minUnit), maxUnit)
myControl.value = mouseArea.initialValue + (mouseArea.units * mouseArea.stepSize)
if (mouseArea.dragging)
myControl.dragging()
}
onWheel: function(wheel) {
if (!myControl.__wheelEnabled) {
wheel.accepted = false
return
}
// Set stepSize according to used modifier key
if (wheel.modifiers & Qt.ControlModifier)
mouseArea.stepSize = myControl.minStepSize
if (wheel.modifiers & Qt.ShiftModifier)
mouseArea.stepSize = myControl.maxStepSize
var val = myControl.valueFromText(textInput.text, myControl.locale) var val = myControl.valueFromText(textInput.text, myControl.locale)
if (myControl.value !== val) if (myControl.value !== val)
myControl.value = val myControl.value = val
var currValue = myControl.value var currValue = myControl.value
myControl.value += wheel.angleDelta.y / 120 myControl.value += (wheel.angleDelta.y / 120 * mouseArea.stepSize)
if (currValue !== myControl.value) if (currValue !== myControl.value)
myControl.valueModified() myControl.valueModified()
// Reset stepSize
mouseArea.stepSize = myControl.stepSize
} }
} }
@@ -119,14 +281,6 @@ TextInput {
target: textInputBackground target: textInputBackground
color: StudioTheme.Values.themeControlBackground color: StudioTheme.Values.themeControlBackground
} }
PropertyChanges {
target: dragHandler
enabled: true
}
PropertyChanges {
target: tapHandler
enabled: true
}
PropertyChanges { PropertyChanges {
target: mouseArea target: mouseArea
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
@@ -156,14 +310,6 @@ TextInput {
target: textInputBackground target: textInputBackground
color: StudioTheme.Values.themeControlBackgroundInteraction color: StudioTheme.Values.themeControlBackgroundInteraction
} }
PropertyChanges {
target: dragHandler
enabled: false
}
PropertyChanges {
target: tapHandler
enabled: false
}
PropertyChanges { PropertyChanges {
target: mouseArea target: mouseArea
cursorShape: Qt.IBeamCursor cursorShape: Qt.IBeamCursor

View File

@@ -13,6 +13,7 @@ QtObject {
property real mediumFont: 14 property real mediumFont: 14
property real bigFont: 16 property real bigFont: 16
property real baseIconFont: 12 property real baseIconFont: 12
property real mediumIconFont: 18
property real bigIconFont: 26 property real bigIconFont: 26
property real scaleFactor: 1.0 property real scaleFactor: 1.0
@@ -24,6 +25,7 @@ QtObject {
property real bigFontSize: Math.round(values.bigFont * values.scaleFactor) property real bigFontSize: Math.round(values.bigFont * values.scaleFactor)
property real baseIconFontSize: Math.round(values.baseIconFont * values.scaleFactor) property real baseIconFontSize: Math.round(values.baseIconFont * values.scaleFactor)
property real myIconFontSize: values.baseIconFontSize; // TODO: rename all refs to myIconFontSize -> baseIconFontSize then remove myIconFontSize property real myIconFontSize: values.baseIconFontSize; // TODO: rename all refs to myIconFontSize -> baseIconFontSize then remove myIconFontSize
property real mediumIconFontSize: Math.round(values.mediumIconFont * values.scaleFactor)
property real bigIconFontSize: Math.round(values.bigIconFont * values.scaleFactor) property real bigIconFontSize: Math.round(values.bigIconFont * values.scaleFactor)
property real squareComponentWidth: values.height property real squareComponentWidth: values.height

File diff suppressed because it is too large Load Diff

View File

@@ -15,6 +15,7 @@ add_subdirectory(glsl)
add_subdirectory(languageserverprotocol) add_subdirectory(languageserverprotocol)
add_subdirectory(sqlite) add_subdirectory(sqlite)
add_subdirectory(tracing) add_subdirectory(tracing)
add_subdirectory(qmlpuppetcommunication)
add_subdirectory(qtcreatorcdbext) add_subdirectory(qtcreatorcdbext)

View File

@@ -0,0 +1 @@
include(QmlPuppetCommunication.cmake)

View File

@@ -0,0 +1,87 @@
add_qtc_library(QmlPuppetCommunication STATIC
PROPERTIES AUTOUIC OFF
DEPENDS Qt5::Core Qt5::CorePrivate Qt5::Gui
)
extend_qtc_library(QmlPuppetCommunication
CONDITION TARGET Nanotrace
PUBLIC_DEPENDS Nanotrace
)
extend_qtc_library(QmlPuppetCommunication
PUBLIC_INCLUDES ${CMAKE_CURRENT_LIST_DIR}/types
SOURCES_PREFIX ${CMAKE_CURRENT_LIST_DIR}/types
SOURCES
enumeration.h
)
extend_qtc_library(QmlPuppetCommunication
PUBLIC_INCLUDES ${CMAKE_CURRENT_LIST_DIR}/interfaces
SOURCES_PREFIX ${CMAKE_CURRENT_LIST_DIR}/interfaces
SOURCES
commondefines.h
nodeinstanceclientinterface.h
nodeinstanceserverinterface.cpp nodeinstanceserverinterface.h
nodeinstanceglobal.h
)
extend_qtc_library(QmlPuppetCommunication
PUBLIC_INCLUDES ${CMAKE_CURRENT_LIST_DIR}/container
SOURCES_PREFIX ${CMAKE_CURRENT_LIST_DIR}/container
SOURCES
addimportcontainer.cpp addimportcontainer.h
idcontainer.cpp idcontainer.h
imagecontainer.cpp imagecontainer.h
informationcontainer.cpp informationcontainer.h
instancecontainer.cpp instancecontainer.h
mockuptypecontainer.cpp mockuptypecontainer.h
propertyabstractcontainer.cpp propertyabstractcontainer.h
propertybindingcontainer.cpp propertybindingcontainer.h
propertyvaluecontainer.cpp propertyvaluecontainer.h
reparentcontainer.cpp reparentcontainer.h
sharedmemory.h
$<IF:$<BOOL:${UNIX}>,sharedmemory_unix.cpp,sharedmemory_qt.cpp>
)
extend_qtc_library(QmlPuppetCommunication
PUBLIC_INCLUDES ${CMAKE_CURRENT_LIST_DIR}/commands
SOURCES_PREFIX ${CMAKE_CURRENT_LIST_DIR}/commands
SOURCES
captureddatacommand.h
changeauxiliarycommand.cpp changeauxiliarycommand.h
changebindingscommand.cpp changebindingscommand.h
changefileurlcommand.cpp changefileurlcommand.h
changeidscommand.cpp changeidscommand.h
changelanguagecommand.cpp changelanguagecommand.h
changenodesourcecommand.cpp changenodesourcecommand.h
changepreviewimagesizecommand.cpp changepreviewimagesizecommand.h
changeselectioncommand.cpp changeselectioncommand.h
changestatecommand.cpp changestatecommand.h
changevaluescommand.cpp changevaluescommand.h
childrenchangedcommand.cpp childrenchangedcommand.h
clearscenecommand.cpp clearscenecommand.h
completecomponentcommand.cpp completecomponentcommand.h
componentcompletedcommand.cpp componentcompletedcommand.h
createinstancescommand.cpp createinstancescommand.h
createscenecommand.cpp createscenecommand.h
debugoutputcommand.cpp debugoutputcommand.h
endpuppetcommand.cpp endpuppetcommand.h
informationchangedcommand.cpp informationchangedcommand.h
inputeventcommand.cpp inputeventcommand.h
nanotracecommand.cpp nanotracecommand.h
pixmapchangedcommand.cpp pixmapchangedcommand.h
puppetalivecommand.cpp puppetalivecommand.h
puppettocreatorcommand.cpp puppettocreatorcommand.h
removeinstancescommand.cpp removeinstancescommand.h
removepropertiescommand.cpp removepropertiescommand.h
removesharedmemorycommand.cpp removesharedmemorycommand.h
reparentinstancescommand.cpp reparentinstancescommand.h
requestmodelnodepreviewimagecommand.cpp requestmodelnodepreviewimagecommand.h
scenecreatedcommand.h
statepreviewimagechangedcommand.cpp statepreviewimagechangedcommand.h
synchronizecommand.h
tokencommand.cpp tokencommand.h
update3dviewstatecommand.cpp update3dviewstatecommand.h
valueschangedcommand.cpp valueschangedcommand.h
view3dactioncommand.cpp view3dactioncommand.h
)

Some files were not shown because too many files have changed in this diff Show More