forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/4.10'
Conflicts: qbs/modules/qtc/qtc.qbs qtcreator_ide_branding.pri src/libs/utils/synchronousprocess.cpp src/plugins/baremetal/iarewtoolchain.cpp src/plugins/cmakeprojectmanager/cmakeproject.cpp tests/unit/unittest/CMakeLists.txt Change-Id: I124ad492df403286751e175d27fe36487ddf6d07
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
#BINARY_ARTIFACTS_BRANCH = master
|
||||
#PROJECT_USER_FILE_EXTENSION = .user
|
||||
|
||||
set(IDE_VERSION "4.9.83") # The IDE version.
|
||||
set(IDE_VERSION_COMPAT "4.9.83") # The IDE Compatibility version.
|
||||
set(IDE_VERSION_DISPLAY "4.10.0-beta2") # The IDE display version.
|
||||
set(IDE_VERSION "4.10.82") # The IDE version.
|
||||
set(IDE_VERSION_COMPAT "4.10.82") # The IDE Compatibility version.
|
||||
set(IDE_VERSION_DISPLAY "4.11.0-beta1") # The IDE display version.
|
||||
set(IDE_COPYRIGHT_YEAR "2019") # The IDE copyright year.
|
||||
|
||||
set(IDE_SETTINGSVARIANT "QtProject") # The IDE settings variation.
|
||||
|
||||
@@ -19,7 +19,7 @@ imagedirs = ../images \
|
||||
../../src/plugins/qmldesigner/components/componentcore/images \
|
||||
../../src/plugins/qmldesigner/components/formeditor \
|
||||
../../src/plugins/qmldesigner/components/navigator \
|
||||
../../src/plugins/qmldesigner//qmldesignerextension/timelineeditor/images \
|
||||
../../src/plugins/qmldesigner/components/timelineeditor/images \
|
||||
../../src/plugins/scxmleditor/common/images \
|
||||
../../src/plugins/texteditor/images \
|
||||
../../src/plugins/valgrind/images
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Copyright (C) 2019 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the Qt Creator documentation.
|
||||
@@ -40,10 +40,20 @@
|
||||
To generate a compilation database from the information that the code model
|
||||
has, select \uicontrol Build > \uicontrol {Generate Compilation Database}.
|
||||
|
||||
You can add files, such as non-C files, to the project in
|
||||
\e {compile_database.json.files}.
|
||||
|
||||
You can use the experimental Compilation Database Project Manager to open
|
||||
the files in a compilation database with access to all the editing features
|
||||
provided by the Clang code model.
|
||||
|
||||
To switch between header and source files, select \uicontrol Tools >
|
||||
\uicontrol C++ > \uicontrol {Switch Header/Source}.
|
||||
|
||||
You can specify custom build steps and run settings for compilation
|
||||
database projects in the \uicontrol Projects mode. For more information,
|
||||
see \l{Adding Custom Build Steps} and \l {Specifying Run Settings}.
|
||||
|
||||
To enable the plugin, select \uicontrol Help > \uicontrol {About Plugins} >
|
||||
\uicontrol {Build Systems} > \uicontrol {Compilation Database Project Manager}.
|
||||
Then restart \QC to load the plugin.
|
||||
|
||||
@@ -31,10 +31,19 @@
|
||||
|
||||
\title Specifying Dynamic Properties
|
||||
|
||||
You can bind object properties to dynamic expressions to define global
|
||||
properties for an object that can be read by other objects. For example,
|
||||
you can specify global properties for the root object that you can use in
|
||||
the child objects.
|
||||
In addition to the properties predefined for QML types, you can specify
|
||||
\e {dynamic properties} to add properties that would not otherwise
|
||||
exist for a particular type. You bind the properties to dynamic expressions
|
||||
to define global properties for an object that can be read by other objects.
|
||||
For example, you can specify global properties for the root object that you
|
||||
can use in the child objects.
|
||||
|
||||
For example, to specify spacing between UI elements, you could define a
|
||||
margin for an object of a QML type that does not have a margin property,
|
||||
and then use bindings to refer to the value of the margin property from
|
||||
other objects.
|
||||
|
||||
Similarly, you can add dynamic properties at component level.
|
||||
|
||||
You can specify dynamic properties for objects in the
|
||||
\uicontrol Connections view.
|
||||
@@ -55,7 +64,7 @@
|
||||
\li Double-click the value in the \uicontrol {Property Type} column to
|
||||
specify the type of the property.
|
||||
\li Double-click the value in the \uicontrol {Property Value} column
|
||||
to specify the value of the property.
|
||||
to specify a dynamic expression as the value of the property.
|
||||
\endlist
|
||||
|
||||
*/
|
||||
|
||||
@@ -34,14 +34,18 @@ Product {
|
||||
// because conflicting scalar values would be reported (QBS-1225 would fix that).
|
||||
cpp.minimumMacosVersion: project.minimumMacosVersion
|
||||
|
||||
Properties {
|
||||
condition: qbs.toolchain.contains("gcc") && !qbs.toolchain.contains("clang")
|
||||
cpp.cxxFlags: base.concat(["-Wno-noexcept-type"])
|
||||
}
|
||||
Properties {
|
||||
condition: qbs.toolchain.contains("msvc")
|
||||
cpp.cxxFlags: base.concat(["/w44996"])
|
||||
cpp.cxxFlags: {
|
||||
var flags = [];
|
||||
if (qbs.toolchain.contains("gcc") && !qbs.toolchain.contains("clang")) {
|
||||
flags.push("-Wno-noexcept-type");
|
||||
if (Utilities.versionCompare(cpp.compilerVersion, "9") >= 0)
|
||||
flags.push("-Wno-deprecated-copy", "-Wno-init-list-lifetime");
|
||||
} else if (qbs.toolchain.contains("msvc")) {
|
||||
flags.push("/w44996");
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
cpp.cxxLanguageVersion: "c++14"
|
||||
cpp.defines: qtc.generalDefines
|
||||
cpp.minimumWindowsVersion: "6.1"
|
||||
|
||||
@@ -227,7 +227,10 @@ def qdump__QStandardItemData(d, value):
|
||||
|
||||
def qdump__QStandardItem(d, value):
|
||||
vtable, dptr = value.split('pp')
|
||||
vtable1, model, parent, values, children, rows, cols, item = d.split('pppPPIIp', dptr)
|
||||
if d.isMsvcTarget():
|
||||
model, parent, values, children, rows, cols, item = d.split('ppPPIIp', dptr)
|
||||
else:
|
||||
vtable1, model, parent, values, children, rows, cols, item = d.split('pppPPIIp', dptr)
|
||||
d.putValue(' ')
|
||||
d.putNumChild(1)
|
||||
if d.isExpanded():
|
||||
@@ -396,8 +399,7 @@ def qdump__QDateTime(d, value):
|
||||
|
||||
|
||||
def qdump__QDir(d, value):
|
||||
if not d.isMsvcTarget():
|
||||
d.putNumChild(1)
|
||||
d.putNumChild(1)
|
||||
privAddress = d.extractPointer(value)
|
||||
bit32 = d.ptrSize() == 4
|
||||
qt5 = d.qtVersion() >= 0x050000
|
||||
@@ -468,21 +470,22 @@ def qdump__QDir(d, value):
|
||||
absoluteDirEntryOffset = dirEntryOffset + fileSystemEntrySize
|
||||
|
||||
d.putStringValue(privAddress + dirEntryOffset)
|
||||
if d.isExpanded() and not d.isMsvcTarget():
|
||||
if d.isExpanded():
|
||||
with Children(d):
|
||||
ns = d.qtNamespace()
|
||||
d.call('int', value, 'count') # Fill cache.
|
||||
#d.putCallItem('absolutePath', '@QString', value, 'absolutePath')
|
||||
#d.putCallItem('canonicalPath', '@QString', value, 'canonicalPath')
|
||||
with SubItem(d, 'absolutePath'):
|
||||
typ = d.lookupType(ns + 'QString')
|
||||
d.putItem(d.createValue(privAddress + absoluteDirEntryOffset, typ))
|
||||
with SubItem(d, 'entryInfoList'):
|
||||
typ = d.lookupType(ns + 'QFileInfo')
|
||||
qdumpHelper_QList(d, privAddress + fileInfosOffset, typ)
|
||||
with SubItem(d, 'entryList'):
|
||||
typ = d.lookupType(ns + 'QStringList')
|
||||
d.putItem(d.createValue(privAddress + filesOffset, typ))
|
||||
if not d.isMsvcTarget():
|
||||
ns = d.qtNamespace()
|
||||
d.call('int', value, 'count') # Fill cache.
|
||||
#d.putCallItem('absolutePath', '@QString', value, 'absolutePath')
|
||||
#d.putCallItem('canonicalPath', '@QString', value, 'canonicalPath')
|
||||
with SubItem(d, 'absolutePath'):
|
||||
typ = d.lookupType(ns + 'QString')
|
||||
d.putItem(d.createValue(privAddress + absoluteDirEntryOffset, typ))
|
||||
with SubItem(d, 'entryInfoList'):
|
||||
typ = d.lookupType(ns + 'QFileInfo')
|
||||
qdumpHelper_QList(d, privAddress + fileInfosOffset, typ)
|
||||
with SubItem(d, 'entryList'):
|
||||
typ = d.lookupType(ns + 'QStringList')
|
||||
d.putItem(d.createValue(privAddress + filesOffset, typ))
|
||||
d.putFields(value)
|
||||
|
||||
|
||||
|
||||
@@ -340,11 +340,12 @@ def qdump__std__multimap(d, value):
|
||||
return qdump__std__map(d, value)
|
||||
|
||||
def qdumpHelper__std__tree__iterator(d, value, isSet=False):
|
||||
treeTypeName = None
|
||||
if value.type.name.endswith("::iterator"):
|
||||
treeTypeName = value.type.name[:-len("::iterator")]
|
||||
elif value.type.name.endswith("::const_iterator"):
|
||||
treeTypeName = value.type.name[:-len("::const_iterator")]
|
||||
treeType = d.lookupType(treeTypeName)
|
||||
treeType = d.lookupType(treeTypeName) if treeTypeName else value.type[0]
|
||||
keyType = treeType[0]
|
||||
valueType = treeType[1]
|
||||
node = value["_M_node"].dereference() # std::_Rb_tree_node_base
|
||||
|
||||
@@ -67,6 +67,8 @@
|
||||
#include <tokencommand.h>
|
||||
#include <removesharedmemorycommand.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QQmlEngine>
|
||||
#include <QQmlApplicationEngine>
|
||||
@@ -88,7 +90,10 @@
|
||||
#include <algorithm>
|
||||
|
||||
namespace {
|
||||
bool testImportStatements(const QStringList &importStatementList, const QUrl &url, QString *errorMessage = 0) {
|
||||
|
||||
bool testImportStatements(const QStringList &importStatementList,
|
||||
const QUrl &url, QString *errorMessage = nullptr)
|
||||
{
|
||||
if (importStatementList.isEmpty())
|
||||
return false;
|
||||
// ToDo: move engine outside of this function, this makes it expensive
|
||||
@@ -455,7 +460,7 @@ void NodeInstanceServer::setupImports(const QVector<AddImportContainer> &contain
|
||||
|
||||
delete m_importComponent.data();
|
||||
delete m_importComponentObject.data();
|
||||
const QStringList importStatementList(importStatementSet.toList());
|
||||
const QStringList importStatementList = Utils::toList(importStatementSet);
|
||||
const QStringList fullImportStatementList(QStringList(qtQuickImport) + importStatementList);
|
||||
|
||||
// check possible import statements combinations
|
||||
|
||||
+5
-2
@@ -60,6 +60,8 @@
|
||||
|
||||
#include <designersupportdelegate.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
Qt5InformationNodeInstanceServer::Qt5InformationNodeInstanceServer(NodeInstanceClientInterface *nodeInstanceClient) :
|
||||
@@ -166,13 +168,14 @@ void Qt5InformationNodeInstanceServer::collectItemChangesAndSendChangeCommands()
|
||||
sendTokenBack();
|
||||
|
||||
if (!informationChangedInstanceSet.isEmpty())
|
||||
nodeInstanceClient()->informationChanged(createAllInformationChangedCommand(informationChangedInstanceSet.toList()));
|
||||
nodeInstanceClient()->informationChanged(
|
||||
createAllInformationChangedCommand(Utils::toList(informationChangedInstanceSet)));
|
||||
|
||||
if (!propertyChangedList.isEmpty())
|
||||
nodeInstanceClient()->valuesChanged(createValuesChangedCommand(propertyChangedList));
|
||||
|
||||
if (!m_parentChangedSet.isEmpty()) {
|
||||
sendChildrenChangedCommand(m_parentChangedSet.toList());
|
||||
sendChildrenChangedCommand(Utils::toList(m_parentChangedSet));
|
||||
m_parentChangedSet.clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -60,6 +60,8 @@
|
||||
|
||||
#include <designersupportdelegate.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
Qt5RenderNodeInstanceServer::Qt5RenderNodeInstanceServer(NodeInstanceClientInterface *nodeInstanceClient) :
|
||||
@@ -94,7 +96,7 @@ void Qt5RenderNodeInstanceServer::collectItemChangesAndSendChangeCommands()
|
||||
clearChangedPropertyList();
|
||||
|
||||
if (!m_dirtyInstanceSet.isEmpty()) {
|
||||
nodeInstanceClient()->pixmapChanged(createPixmapChangedCommand(m_dirtyInstanceSet.toList()));
|
||||
nodeInstanceClient()->pixmapChanged(createPixmapChangedCommand(Utils::toList(m_dirtyInstanceSet)));
|
||||
m_dirtyInstanceSet.clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -62,6 +62,8 @@
|
||||
|
||||
#include <designersupportdelegate.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
Qt5TestNodeInstanceServer::Qt5TestNodeInstanceServer(NodeInstanceClientInterface *nodeInstanceClient)
|
||||
@@ -288,7 +290,8 @@ void QmlDesigner::Qt5TestNodeInstanceServer::collectItemChangesAndSendChangeComm
|
||||
clearChangedPropertyList();
|
||||
|
||||
if (!informationChangedInstanceSet.isEmpty()) {
|
||||
InformationChangedCommand command = createAllInformationChangedCommand(informationChangedInstanceSet.toList());
|
||||
InformationChangedCommand command
|
||||
= createAllInformationChangedCommand(Utils::toList(informationChangedInstanceSet));
|
||||
command.sort();
|
||||
nodeInstanceClient()->informationChanged(command);
|
||||
}
|
||||
@@ -299,7 +302,7 @@ void QmlDesigner::Qt5TestNodeInstanceServer::collectItemChangesAndSendChangeComm
|
||||
}
|
||||
|
||||
if (!parentChangedSet.isEmpty())
|
||||
sendChildrenChangedCommand(parentChangedSet.toList());
|
||||
sendChildrenChangedCommand(Utils::toList(parentChangedSet));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
@@ -1,5 +1,11 @@
|
||||
|
||||
Section {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
caption: "%1"
|
||||
|
||||
ColorEditor {
|
||||
backendValue: backendValues.%2
|
||||
supportGradient: false
|
||||
}
|
||||
}
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
|
||||
FontSection {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
caption: "%1"
|
||||
fontName: "%2"
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
Section {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
caption: qsTr("%2 Color")
|
||||
|
||||
ColorEditor {
|
||||
caption: qsTr("Color")
|
||||
backendValue: backendValues.%2_color
|
||||
supportGradient: true
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Section {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
caption: qsTr("%2 Border Color")
|
||||
|
||||
ColorEditor {
|
||||
caption: qsTr("Border Color")
|
||||
backendValue: backendValues.%2_border_color
|
||||
supportGradient: false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Section {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
caption: "%2 Rectangle"
|
||||
|
||||
SectionLayout {
|
||||
rows: 2
|
||||
Label {
|
||||
text: qsTr("Border")
|
||||
}
|
||||
SecondColumnLayout {
|
||||
SpinBox {
|
||||
backendValue: backendValues.%2_border_width
|
||||
hasSlider: true
|
||||
Layout.preferredWidth: 120
|
||||
}
|
||||
ExpandingSpacer {
|
||||
|
||||
}
|
||||
}
|
||||
Label {
|
||||
text: qsTr("Radius")
|
||||
}
|
||||
SecondColumnLayout {
|
||||
SpinBox {
|
||||
backendValue: backendValues.%2_radius
|
||||
hasSlider: true
|
||||
Layout.preferredWidth: 120
|
||||
minimumValue: 0
|
||||
maximumValue: Math.min(backendValues.height.value, backendValues.width.value) / 2
|
||||
}
|
||||
ExpandingSpacer {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+19
@@ -52,4 +52,23 @@ AutoTypes {
|
||||
sourceFile: "ColorEditorTemplate.template"
|
||||
separateSection: true
|
||||
}
|
||||
|
||||
Type {
|
||||
typeNames: ["Text"]
|
||||
sourceFile: "TextEditorTemplate.template"
|
||||
separateSection: true
|
||||
}
|
||||
|
||||
Type {
|
||||
typeNames: ["font", "QFont"]
|
||||
sourceFile: "FontEditorTemplate.template"
|
||||
separateSection: true
|
||||
}
|
||||
|
||||
Type {
|
||||
typeNames: ["Rectangle"]
|
||||
sourceFile: "RectangleEditorTemplate.template"
|
||||
separateSection: true
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
Section {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
caption: "%1"
|
||||
|
||||
SectionLayout {
|
||||
columns: 2
|
||||
rows: 3
|
||||
Label {
|
||||
text: qsTr("Text")
|
||||
}
|
||||
LineEdit {
|
||||
backendValue: backendValues.%2_text
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
Label {
|
||||
text: qsTr("Wrap mode")
|
||||
}
|
||||
|
||||
ComboBox {
|
||||
Layout.fillWidth: true
|
||||
backendValue: backendValues.%2_wrapMode
|
||||
scope: "Text"
|
||||
model: ["NoWrap", "WordWrap", "WrapAnywhere", "WrapAtWordBoundaryOrAnywhere"]
|
||||
}
|
||||
|
||||
Label {
|
||||
text: qsTr("Elide")
|
||||
}
|
||||
|
||||
ComboBox {
|
||||
Layout.fillWidth: true
|
||||
backendValue: backendValues.%2_elide
|
||||
scope: "Text"
|
||||
model: ["ElideNone", "ElideLeft", "ElideMiddle", "ElideRight"]
|
||||
}
|
||||
|
||||
Label {
|
||||
text: qsTr("Alignment")
|
||||
}
|
||||
|
||||
AligmentHorizontalButtons {
|
||||
backendValue: backendValues.%2_horizontalAlignment;
|
||||
|
||||
}
|
||||
|
||||
Label {
|
||||
text: ("")
|
||||
}
|
||||
|
||||
AligmentVerticalButtons {
|
||||
backendValue: backendValues.%2_verticalAlignment;
|
||||
}
|
||||
|
||||
|
||||
Label {
|
||||
text: qsTr("Format")
|
||||
}
|
||||
ComboBox {
|
||||
scope: "Text"
|
||||
model: ["PlainText", "RichText", "AutoText"]
|
||||
backendValue: backendValues.%2_textFormat
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
Label {
|
||||
text: qsTr("Render type")
|
||||
toolTip: qsTr("Override the default rendering type for this item.")
|
||||
}
|
||||
ComboBox {
|
||||
scope: "Text"
|
||||
model: ["QtRendering", "NativeRendering"]
|
||||
backendValue: backendValues.%2_renderType
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
Label {
|
||||
text: qsTr("Font size mode")
|
||||
toolTip: qsTr("Specifies how the font size of the displayed text is determined.")
|
||||
}
|
||||
ComboBox {
|
||||
scope: "Text"
|
||||
model: ["FixedSize", "HorizontalFit", "VerticalFit", "Fit"]
|
||||
backendValue: backendValues.%2_fontSizeMode
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
|
||||
Label {
|
||||
text: qsTr("Line height")
|
||||
tooltip: qsTr("Sets the line height for the text.")
|
||||
}
|
||||
|
||||
SpinBox {
|
||||
Layout.fillWidth: true
|
||||
backendValue: (backendValues.%2_lineHeight === undefined) ? dummyBackendValue : backendValues.lineHeight
|
||||
maximumValue: 500
|
||||
minimumValue: 0
|
||||
decimals: 2
|
||||
stepSize: 0.1
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+2
-3
@@ -2,8 +2,7 @@ Label {
|
||||
text: "%1"
|
||||
tooltip: "%1"
|
||||
}
|
||||
LineEdit {
|
||||
backendValue: backendValues.%2
|
||||
UrlChooser {
|
||||
Layout.fillWidth: true
|
||||
showTranslateCheckBox: false
|
||||
backendValue: backendValues.%2
|
||||
}
|
||||
@@ -27,6 +27,7 @@ import QtQuick 2.0
|
||||
import HelperWidgets 2.0
|
||||
import QtQuick.Layouts 1.0
|
||||
import QtQuick.Controls 1.0 as Controls
|
||||
import StudioControls 1.0 as StudioControls
|
||||
|
||||
SectionLayout {
|
||||
property bool isInModel: backendValue.isInModel;
|
||||
@@ -40,7 +41,7 @@ SectionLayout {
|
||||
onBackendValueChanged: evaluateAlignment()
|
||||
onValueFromBackendChanged: evaluateAlignment()
|
||||
|
||||
property int spinBoxWidth: 62
|
||||
property int spinBoxWidth: 82
|
||||
|
||||
Connections {
|
||||
target: modelNodeBackend
|
||||
@@ -129,40 +130,43 @@ SectionLayout {
|
||||
|
||||
SecondColumnLayout {
|
||||
|
||||
Controls.ComboBox {
|
||||
StudioControls.ComboBox {
|
||||
ColorLogic {
|
||||
id: colorLogic
|
||||
}
|
||||
Layout.fillWidth: true
|
||||
|
||||
ExtendedFunctionButton {
|
||||
x: 2
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
ExtendedFunctionLogic {
|
||||
id: extFuncLogic
|
||||
backendValue: backendValues.Layout_alignment
|
||||
visible: horizontalAlignmentComboBox.enabled
|
||||
onReseted: {
|
||||
horizontalAlignmentComboBox.currentIndex = 0
|
||||
verticalAlignmentComboBox.currentIndex = 0
|
||||
}
|
||||
}
|
||||
|
||||
actionIndicator.icon.color: extFuncLogic.color
|
||||
actionIndicator.icon.text: extFuncLogic.glyph
|
||||
actionIndicator.onClicked: extFuncLogic.show()
|
||||
|
||||
actionIndicator.visible: true
|
||||
|
||||
labelColor: horizontalAlignmentComboBox.currentIndex === 0 ? colorLogic.__defaultTextColor : colorLogic.__changedTextColor
|
||||
|
||||
id: horizontalAlignmentComboBox
|
||||
|
||||
property bool __isCompleted: false
|
||||
property color textColor: currentIndex === 0 ? colorLogic.__defaultTextColor : colorLogic.__changedTextColor
|
||||
|
||||
model: ["AlignLeft", "AlignHCenter", "AlignRight"]
|
||||
|
||||
onCurrentIndexChanged: {
|
||||
onActivated: {
|
||||
if (!horizontalAlignmentComboBox.__isCompleted)
|
||||
return;
|
||||
|
||||
horizontalAlignmentComboBox.currentIndex = index
|
||||
composeExpressionString();
|
||||
}
|
||||
|
||||
style: CustomComboBoxStyle {
|
||||
textColor: horizontalAlignmentComboBox.textColor
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
horizontalAlignmentComboBox.__isCompleted = true;
|
||||
}
|
||||
@@ -181,36 +185,30 @@ SectionLayout {
|
||||
|
||||
SecondColumnLayout {
|
||||
|
||||
Controls.ComboBox {
|
||||
StudioControls.ComboBox {
|
||||
id: verticalAlignmentComboBox
|
||||
Layout.fillWidth: true
|
||||
|
||||
ExtendedFunctionButton {
|
||||
x: 2
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
backendValue: backendValues.Layout_alignment
|
||||
visible: verticalAlignmentComboBox.enabled
|
||||
onReseted: {
|
||||
horizontalAlignmentComboBox.currentIndex = 0
|
||||
verticalAlignmentComboBox.currentIndex = 0
|
||||
}
|
||||
}
|
||||
actionIndicator.icon.color: extFuncLogic.color
|
||||
actionIndicator.icon.text: extFuncLogic.glyph
|
||||
actionIndicator.onClicked: extFuncLogic.show()
|
||||
|
||||
actionIndicator.visible: true
|
||||
|
||||
labelColor: verticalAlignmentComboBox.currentIndex === 0 ? colorLogic.__defaultTextColor : colorLogic.__changedTextColor
|
||||
|
||||
property bool __isCompleted: false
|
||||
property color textColor: currentIndex === 0 ? colorLogic.__defaultTextColor : colorLogic.__changedTextColor
|
||||
|
||||
model: ["AlignVCenter", "AlignTop","AlignBottom","AlignBaseline"]
|
||||
|
||||
onCurrentIndexChanged: {
|
||||
onActivated: {
|
||||
if (!verticalAlignmentComboBox.__isCompleted)
|
||||
return;
|
||||
|
||||
verticalAlignmentComboBox.currentIndex = index
|
||||
composeExpressionString();
|
||||
}
|
||||
|
||||
style: CustomComboBoxStyle {
|
||||
textColor: verticalAlignmentComboBox.textColor
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
verticalAlignmentComboBox.__isCompleted = true;
|
||||
}
|
||||
|
||||
@@ -100,6 +100,7 @@ Column {
|
||||
model: ["LeftToRight", "RightToLeft"]
|
||||
backendValue: backendValues.layoutDirection
|
||||
scope: "Qt"
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
ExpandingSpacer {
|
||||
@@ -117,6 +118,7 @@ Column {
|
||||
model: ["NoSnap", "SnapToItem", "SnapOneItem"]
|
||||
backendValue: backendValues.snapMode
|
||||
scope: "ListView"
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
ExpandingSpacer {
|
||||
|
||||
+29
-50
@@ -40,18 +40,14 @@ Item {
|
||||
|
||||
property int sliderMargins: 6
|
||||
|
||||
onHueChanged: {
|
||||
//hueSlider.value = hue;
|
||||
invalidateColor();
|
||||
}
|
||||
property bool block: false
|
||||
|
||||
signal clicked
|
||||
|
||||
onAlphaChanged: invalidateColor();
|
||||
|
||||
onSaturationChanged: invalidateColor();
|
||||
|
||||
onLightnessChanged: invalidateColor();
|
||||
onHueChanged: invalidateColor();
|
||||
|
||||
onColorChanged: {
|
||||
var myAlpha = color.a
|
||||
@@ -60,8 +56,6 @@ Item {
|
||||
colorButton.alpha = myAlpha
|
||||
}
|
||||
|
||||
property bool block: false
|
||||
|
||||
function invalidateColor() {
|
||||
if (block)
|
||||
return;
|
||||
@@ -145,14 +139,12 @@ Item {
|
||||
|
||||
onPaint: {
|
||||
var ctx = hubeBox.getContext('2d')
|
||||
|
||||
ctx.save()
|
||||
|
||||
ctx.clearRect(0, 0, hubeBox.width, hubeBox.height);
|
||||
|
||||
for (var row = 0; row < hubeBox.height; row++){
|
||||
var gradient = ctx.createLinearGradient(0, 0, hubeBox.width,0);
|
||||
var l = Math.abs(row - hubeBox.height) / hubeBox.height
|
||||
var l = Math.abs(row - hubeBox.height) / hubeBox.height
|
||||
|
||||
gradient.addColorStop(0, Qt.hsla(hubeBox.hue, 0, l, 1));
|
||||
gradient.addColorStop(1, Qt.hsla(hubeBox.hue, 1, l, 1));
|
||||
@@ -160,20 +152,15 @@ Item {
|
||||
ctx.fillStyle = gradient;
|
||||
ctx.fillRect(0, row, hubeBox.width, 1);
|
||||
}
|
||||
|
||||
ctx.restore()
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Canvas {
|
||||
id: canvas
|
||||
|
||||
opacity: 0.8
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
antialiasing: true
|
||||
|
||||
property real cavnasSaturation: colorButton.saturation
|
||||
@@ -197,7 +184,6 @@ Item {
|
||||
ctx.strokeStyle = canvas.strokeStyle
|
||||
ctx.lineWidth = 1
|
||||
|
||||
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(0, yy)
|
||||
ctx.lineTo(canvas.width, yy)
|
||||
@@ -210,7 +196,6 @@ Item {
|
||||
|
||||
ctx.restore()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
@@ -221,12 +206,11 @@ Item {
|
||||
var xx = Math.max(0, Math.min(mouse.x, parent.width))
|
||||
var yy = Math.max(0, Math.min(mouse.y, parent.height))
|
||||
|
||||
colorButton.lightness = 1.0 - yy / parent.height;
|
||||
colorButton.saturation = xx / parent.width;
|
||||
colorButton.lightness = 1.0 - yy / parent.height;
|
||||
colorButton.saturation = xx / parent.width;
|
||||
}
|
||||
}
|
||||
onPressed: positionChanged(mouse)
|
||||
|
||||
onReleased: colorButton.clicked()
|
||||
}
|
||||
Rectangle {
|
||||
@@ -238,7 +222,6 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
HueSlider {
|
||||
id: hueSlider
|
||||
anchors.left: surround.right
|
||||
@@ -250,7 +233,6 @@ Item {
|
||||
colorButton.hue = value
|
||||
}
|
||||
onClicked: colorButton.clicked()
|
||||
|
||||
}
|
||||
|
||||
Row {
|
||||
@@ -259,9 +241,7 @@ Item {
|
||||
spacing: 10
|
||||
|
||||
Column {
|
||||
|
||||
spacing: 10
|
||||
|
||||
Row {
|
||||
z: 3
|
||||
spacing: 1
|
||||
@@ -281,9 +261,10 @@ Item {
|
||||
maximumValue: 255
|
||||
decimals: 0
|
||||
|
||||
onCompressedValueModified: {
|
||||
if (color.r !== value && !colorButton.block) {
|
||||
color.r = (value / 255.0)
|
||||
onValueModified: {
|
||||
var tmp = redSlider.value / 255.0
|
||||
if (colorButton.color.r !== tmp && !colorButton.block) {
|
||||
colorButton.color.r = tmp
|
||||
colorButton.clicked()
|
||||
}
|
||||
}
|
||||
@@ -300,7 +281,6 @@ Item {
|
||||
elide: Text.ElideRight
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
DoubleSpinBox {
|
||||
id: greenSlider
|
||||
width: 64
|
||||
@@ -310,9 +290,10 @@ Item {
|
||||
maximumValue: 255
|
||||
decimals: 0
|
||||
|
||||
onCompressedValueModified: {
|
||||
if (color.g !== value && !colorButton.block) {
|
||||
color.g = (value / 255.0)
|
||||
onValueModified: {
|
||||
var tmp = greenSlider.value / 255.0
|
||||
if (colorButton.color.g !== tmp && !colorButton.block) {
|
||||
colorButton.color.g = tmp
|
||||
colorButton.clicked()
|
||||
}
|
||||
}
|
||||
@@ -338,9 +319,10 @@ Item {
|
||||
maximumValue: 255
|
||||
decimals: 0
|
||||
|
||||
onCompressedValueModified: {
|
||||
if (color.b !== value && !colorButton.block) {
|
||||
color.b = (value / 255.0)
|
||||
onValueModified: {
|
||||
var tmp = blueSlider.value / 255.0
|
||||
if (colorButton.color.b !== tmp && !colorButton.block) {
|
||||
colorButton.color.b = tmp
|
||||
colorButton.clicked()
|
||||
}
|
||||
}
|
||||
@@ -357,13 +339,12 @@ Item {
|
||||
elide: Text.ElideRight
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
DoubleSpinBox {
|
||||
id: alphaSlider
|
||||
width: 64
|
||||
onCompressedValueModified: {
|
||||
if (colorButton.alpha !== value && !colorButton.block) {
|
||||
colorButton.alpha = value
|
||||
onValueModified: {
|
||||
if (colorButton.alpha !== alphaSlider.value && !colorButton.block) {
|
||||
colorButton.alpha = alphaSlider.value
|
||||
colorButton.clicked()
|
||||
}
|
||||
}
|
||||
@@ -372,7 +353,6 @@ Item {
|
||||
}
|
||||
|
||||
Column {
|
||||
|
||||
spacing: 10
|
||||
Row {
|
||||
z: 3
|
||||
@@ -387,9 +367,9 @@ Item {
|
||||
DoubleSpinBox {
|
||||
id: hueSlider2
|
||||
width: 64
|
||||
onCompressedValueModified: {
|
||||
if (colorButton.hue !== value && !colorButton.block) {
|
||||
colorButton.hue = value
|
||||
onValueModified: {
|
||||
if (colorButton.hue !== hueSlider2.value && !colorButton.block) {
|
||||
colorButton.hue = hueSlider2.value
|
||||
colorButton.clicked()
|
||||
}
|
||||
}
|
||||
@@ -406,13 +386,12 @@ Item {
|
||||
elide: Text.ElideRight
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
DoubleSpinBox {
|
||||
id: saturationSlider
|
||||
width: 64
|
||||
onCompressedValueModified: {
|
||||
if (colorButton.saturation !== value && !colorButton.block) {
|
||||
colorButton.saturation = value
|
||||
onValueModified: {
|
||||
if (colorButton.saturation !== saturationSlider.value && !colorButton.block) {
|
||||
colorButton.saturation = saturationSlider.value
|
||||
colorButton.clicked()
|
||||
}
|
||||
}
|
||||
@@ -432,9 +411,9 @@ Item {
|
||||
DoubleSpinBox {
|
||||
id: lightnessSlider
|
||||
width: 64
|
||||
onCompressedValueModified: {
|
||||
if (colorButton.lightness !== value && !colorButton.block) {
|
||||
colorButton.lightness = value
|
||||
onValueModified: {
|
||||
if (colorButton.lightness !== lightnessSlider.value && !colorButton.block) {
|
||||
colorButton.lightness = lightnessSlider.value
|
||||
colorButton.clicked()
|
||||
}
|
||||
}
|
||||
|
||||
+13
-42
@@ -33,61 +33,32 @@ Item {
|
||||
property alias decimals: spinBox.decimals
|
||||
property alias hasSlider: spinBox.hasSlider
|
||||
|
||||
property real minimumValue: 0.0
|
||||
property real maximumValue: 1.0
|
||||
property real stepSize: 0.1
|
||||
property alias value: spinBox.realValue
|
||||
|
||||
property alias minimumValue: spinBox.realFrom
|
||||
property alias maximumValue: spinBox.realTo
|
||||
property alias stepSize: spinBox.realStepSize
|
||||
|
||||
property alias sliderIndicatorVisible: spinBox.sliderIndicatorVisible
|
||||
|
||||
property real value
|
||||
|
||||
onValueChanged: spinBox.value = wrapper.value * spinBox.factor
|
||||
|
||||
signal compressedValueModified
|
||||
signal valueModified
|
||||
|
||||
width: 90
|
||||
implicitHeight: spinBox.height
|
||||
|
||||
onStepSizeChanged: spinBox.convert("stepSize", wrapper.stepSize)
|
||||
onMinimumValueChanged: spinBox.convert("from", wrapper.minimumValue)
|
||||
onMaximumValueChanged: spinBox.convert("to", wrapper.maximumValue)
|
||||
|
||||
StudioControls.SpinBox {
|
||||
StudioControls.RealSpinBox {
|
||||
id: spinBox
|
||||
|
||||
onValueModified: wrapper.valueModified()
|
||||
onCompressedValueModified: wrapper.compressedValueModified()
|
||||
|
||||
onValueChanged: {
|
||||
if (spinBox.__initialized)
|
||||
wrapper.value = spinBox.value / spinBox.factor
|
||||
}
|
||||
|
||||
width: wrapper.width
|
||||
decimals: 2
|
||||
|
||||
actionIndicatorVisible: false
|
||||
|
||||
property bool __initialized: false
|
||||
|
||||
property bool hasSlider: spinBox.sliderIndicatorVisible
|
||||
|
||||
Component.onCompleted: {
|
||||
spinBox.__initialized = true
|
||||
width: wrapper.width
|
||||
actionIndicatorVisible: false
|
||||
|
||||
spinBox.convert("stepSize", wrapper.stepSize)
|
||||
spinBox.convert("from", wrapper.minimumValue)
|
||||
spinBox.convert("to", wrapper.maximumValue)
|
||||
|
||||
spinBox.value = wrapper.value * spinBox.factor
|
||||
}
|
||||
|
||||
function convert(target, value) {
|
||||
if (!spinBox.__initialized)
|
||||
return
|
||||
spinBox[target] = Math.round(value * spinBox.factor)
|
||||
}
|
||||
realFrom: 0.0
|
||||
realTo: 1.0
|
||||
realStepSize: 0.1
|
||||
decimals: 2
|
||||
|
||||
onRealValueModified: wrapper.valueModified()
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -34,7 +34,7 @@ Section {
|
||||
|
||||
id: root
|
||||
|
||||
property int spinBoxWidth: 62
|
||||
property int spinBoxWidth: 96
|
||||
|
||||
SectionLayout {
|
||||
|
||||
@@ -71,7 +71,7 @@ Section {
|
||||
|
||||
Label {
|
||||
text: qsTr("Movement")
|
||||
tooltip: qsTr("Determines whether the flickable will give a feeling that the edges of the view are soft, rather than a hard physical boundary.")
|
||||
tooltip: qsTr("Determines whether the Flickable will give a feeling that the edges of the view are soft, rather than a hard physical boundary.")
|
||||
}
|
||||
|
||||
SecondColumnLayout {
|
||||
|
||||
+25
-13
@@ -35,16 +35,24 @@ Section {
|
||||
anchors.right: parent.right
|
||||
caption: qsTr("Font")
|
||||
|
||||
property string fontName: "font"
|
||||
|
||||
property bool showStyle: false
|
||||
|
||||
property variant fontFamily: backendValues.font_family
|
||||
property variant pointSize: backendValues.font_pointSize
|
||||
property variant pixelSize: backendValues.font_pixelSize
|
||||
function getBackendValue(name)
|
||||
{
|
||||
print(fontSection.fontName + "_" + name)
|
||||
return backendValues[fontSection.fontName + "_" + name]
|
||||
}
|
||||
|
||||
property variant boldStyle: backendValues.font_bold
|
||||
property variant italicStyle: backendValues.font_italic
|
||||
property variant underlineStyle: backendValues.font_underline
|
||||
property variant strikeoutStyle: backendValues.font_strikeout
|
||||
property variant fontFamily: getBackendValue("family")
|
||||
property variant pointSize: getBackendValue("pointSize")
|
||||
property variant pixelSize: getBackendValue("pixelSize")
|
||||
|
||||
property variant boldStyle: getBackendValue("bold")
|
||||
property variant italicStyle: getBackendValue("italic")
|
||||
property variant underlineStyle: getBackendValue("underline")
|
||||
property variant strikeoutStyle: getBackendValue("strikeout")
|
||||
|
||||
onPointSizeChanged: {
|
||||
sizeWidget.setPointPixelSize();
|
||||
@@ -140,6 +148,10 @@ Section {
|
||||
}
|
||||
FontStyleButtons {
|
||||
|
||||
bold: fontSection.boldStyle
|
||||
italic: fontSection.italicStyle
|
||||
underline: fontSection.underlineStyle
|
||||
strikeout: fontSection.strikeoutStyle
|
||||
}
|
||||
|
||||
Label {
|
||||
@@ -149,7 +161,7 @@ Section {
|
||||
|
||||
ComboBox {
|
||||
Layout.fillWidth: true
|
||||
backendValue: backendValues.font_capitalization
|
||||
backendValue: getBackendValue("capitalization")
|
||||
model: ["MixedCase", "AllUppercase", "AllLowercase", "SmallCaps", "Capitalize"]
|
||||
scope: "Font"
|
||||
}
|
||||
@@ -161,7 +173,7 @@ Section {
|
||||
|
||||
ComboBox {
|
||||
Layout.fillWidth: true
|
||||
backendValue: backendValues.font_weight
|
||||
backendValue: getBackendValue("weight")
|
||||
model: ["Normal", "Light", "ExtraLight", "Thin", "Medium", "DemiBold", "Bold", "ExtraBold", "Black"]
|
||||
scope: "Font"
|
||||
}
|
||||
@@ -193,7 +205,7 @@ Section {
|
||||
maximumValue: 500
|
||||
minimumValue: -500
|
||||
decimals: 2
|
||||
backendValue: backendValues.font_wordSpacing
|
||||
backendValue: getBackendValue("wordSpacing")
|
||||
Layout.fillWidth: true
|
||||
Layout.minimumWidth: 60
|
||||
stepSize: 0.1
|
||||
@@ -212,7 +224,7 @@ Section {
|
||||
maximumValue: 500
|
||||
minimumValue: -500
|
||||
decimals: 2
|
||||
backendValue: backendValues.font_letterSpacing
|
||||
backendValue: getBackendValue("letterSpacing")
|
||||
Layout.fillWidth: true
|
||||
Layout.minimumWidth: 60
|
||||
stepSize: 0.1
|
||||
@@ -230,7 +242,7 @@ Section {
|
||||
CheckBox {
|
||||
text: qsTr("Kerning")
|
||||
Layout.fillWidth: true
|
||||
backendValue: (backendValues.font_kerning === undefined) ? dummyBackendValue : backendValues.font_kerning
|
||||
backendValue: getBackendValue("kerning")
|
||||
tooltip: qsTr("Enables or disables the kerning OpenType feature when shaping the text. Disabling this may " +
|
||||
"improve performance when creating or changing the text, at the expense of some cosmetic features. The default value is true.")
|
||||
}
|
||||
@@ -238,7 +250,7 @@ Section {
|
||||
CheckBox {
|
||||
text: qsTr("Prefer shaping")
|
||||
Layout.fillWidth: true
|
||||
backendValue: (backendValues.font_preferShaping === undefined) ? dummyBackendValue : backendValues.font_preferShaping
|
||||
backendValue: getBackendValue("preferShaping")
|
||||
tooltip: qsTr("Sometimes, a font will apply complex rules to a set of characters in order to display them correctly.\n" +
|
||||
"In some writing systems, such as Brahmic scripts, this is required in order for the text to be legible, whereas in " +
|
||||
"Latin script,\n it is merely a cosmetic feature. Setting the preferShaping property to false will disable all such features\nwhen they are not required, which will improve performance in most cases.")
|
||||
|
||||
+10
-29
@@ -34,9 +34,9 @@ Item {
|
||||
property alias decimals: spinBox.decimals
|
||||
property alias hasSlider: spinBox.hasSlider
|
||||
|
||||
property real minimumValue: 0.0
|
||||
property real maximumValue: 99
|
||||
property real stepSize: 1.0
|
||||
property alias minimumValue: spinBox.realFrom
|
||||
property alias maximumValue: spinBox.realTo
|
||||
property alias stepSize: spinBox.realStepSize
|
||||
|
||||
property alias backendValue: spinBox.backendValue
|
||||
property alias sliderIndicatorVisible: spinBox.sliderIndicatorVisible
|
||||
@@ -44,35 +44,15 @@ Item {
|
||||
width: 96
|
||||
implicitHeight: spinBox.height
|
||||
|
||||
property bool __initialized: false
|
||||
|
||||
Component.onCompleted: {
|
||||
wrapper.__initialized = true
|
||||
|
||||
convert("stepSize", stepSize)
|
||||
convert("from", minimumValue)
|
||||
convert("to", maximumValue)
|
||||
}
|
||||
|
||||
onStepSizeChanged: convert("stepSize", stepSize)
|
||||
onMinimumValueChanged: convert("from", minimumValue)
|
||||
onMaximumValueChanged: convert("to", maximumValue)
|
||||
|
||||
function convert(target, value) {
|
||||
if (!wrapper.__initialized)
|
||||
return
|
||||
spinBox[target] = Math.round(value * spinBox.factor)
|
||||
}
|
||||
|
||||
StudioControls.SpinBox {
|
||||
StudioControls.RealSpinBox {
|
||||
id: spinBox
|
||||
|
||||
property real realValue: value / factor
|
||||
onDragStarted: hideCursor();
|
||||
onDragEnded: restoreCursor();
|
||||
|
||||
property variant backendValue
|
||||
property bool hasSlider: wrapper.sliderIndicatorVisible
|
||||
|
||||
from: minimumValue * factor
|
||||
to: maximumValue * factor
|
||||
width: wrapper.width
|
||||
|
||||
ExtendedFunctionLogic {
|
||||
@@ -88,13 +68,14 @@ Item {
|
||||
id: colorLogic
|
||||
backendValue: spinBox.backendValue
|
||||
onValueFromBackendChanged: {
|
||||
spinBox.value = valueFromBackend * spinBox.factor;
|
||||
if (valueFromBackend !== undefined)
|
||||
spinBox.realValue = valueFromBackend
|
||||
}
|
||||
}
|
||||
|
||||
labelColor: edit ? StudioTheme.Values.themeTextColor : colorLogic.textColor
|
||||
|
||||
onCompressedValueModified: {
|
||||
onCompressedRealValueModified: {
|
||||
if (backendValue.value !== realValue)
|
||||
backendValue.value = realValue;
|
||||
}
|
||||
|
||||
+17
-13
@@ -65,6 +65,7 @@ T.CheckBox {
|
||||
text: myCheckBox.text
|
||||
font: myCheckBox.font
|
||||
color: StudioTheme.Values.themeTextColor
|
||||
visible: text !== ""
|
||||
}
|
||||
|
||||
ActionIndicator {
|
||||
@@ -90,9 +91,9 @@ T.CheckBox {
|
||||
border.width: StudioTheme.Values.border
|
||||
|
||||
T.Label {
|
||||
id: checkBoxIcon
|
||||
x: (parent.width - width) / 2
|
||||
y: (parent.height - height) / 2
|
||||
id: checkedIcon
|
||||
x: (parent.width - checkedIcon.width) / 2
|
||||
y: (parent.height - checkedIcon.height) / 2
|
||||
text: StudioTheme.Constants.tickIcon
|
||||
visible: myCheckBox.checkState === Qt.Checked
|
||||
color: StudioTheme.Values.themeTextColor
|
||||
@@ -100,17 +101,16 @@ T.CheckBox {
|
||||
font.family: StudioTheme.Constants.iconFont.family
|
||||
}
|
||||
|
||||
/*
|
||||
// Tristate only
|
||||
Rectangle {
|
||||
x: (parent.width - width) / 2
|
||||
y: (parent.height - height) / 2
|
||||
width: 16
|
||||
height: 3
|
||||
color: myCheckBox.palette.text
|
||||
T.Label {
|
||||
id: partiallyCheckedIcon
|
||||
x: (parent.width - checkedIcon.width) / 2
|
||||
y: (parent.height - checkedIcon.height) / 2
|
||||
text: StudioTheme.Constants.triState
|
||||
visible: myCheckBox.checkState === Qt.PartiallyChecked
|
||||
color: StudioTheme.Values.themeTextColor
|
||||
font.pixelSize: StudioTheme.Values.sliderControlSizeMulti
|
||||
font.family: StudioTheme.Constants.iconFont.family
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
states: [
|
||||
@@ -150,7 +150,11 @@ T.CheckBox {
|
||||
border.color: StudioTheme.Values.themeControlOutlineDisabled
|
||||
}
|
||||
PropertyChanges {
|
||||
target: checkBoxIcon
|
||||
target: checkedIcon
|
||||
color: StudioTheme.Values.themeTextColorDisabled
|
||||
}
|
||||
PropertyChanges {
|
||||
target: partiallyCheckedIcon
|
||||
color: StudioTheme.Values.themeTextColorDisabled
|
||||
}
|
||||
PropertyChanges {
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ T.ComboBox {
|
||||
wheelEnabled: false
|
||||
|
||||
onFocusChanged: {
|
||||
if (!focus)
|
||||
if (!myComboBox.focus)
|
||||
comboBoxPopup.close()
|
||||
}
|
||||
|
||||
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2019 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.12
|
||||
import QtQuick.Templates 2.12 as T
|
||||
import StudioTheme 1.0 as StudioTheme
|
||||
|
||||
T.Popup {
|
||||
id: sliderPopup
|
||||
|
||||
property T.Control myControl
|
||||
|
||||
dim: false
|
||||
closePolicy: T.Popup.CloseOnEscape | T.Popup.CloseOnPressOutsideParent
|
||||
|
||||
background: Rectangle {
|
||||
color: StudioTheme.Values.themeControlBackground
|
||||
border.color: StudioTheme.Values.themeInteraction
|
||||
}
|
||||
|
||||
contentItem: T.Slider {
|
||||
id: slider
|
||||
anchors.fill: parent
|
||||
|
||||
bottomPadding: 0
|
||||
topPadding: 0
|
||||
rightPadding: 3
|
||||
leftPadding: 3
|
||||
|
||||
from: myControl.realFrom
|
||||
value: myControl.realValue
|
||||
to: myControl.realTo
|
||||
|
||||
focusPolicy: Qt.NoFocus
|
||||
|
||||
handle: Rectangle {
|
||||
x: slider.leftPadding + slider.visualPosition * (slider.availableWidth - width)
|
||||
y: slider.topPadding + (slider.availableHeight / 2) - (height / 2)
|
||||
width: StudioTheme.Values.sliderHandleWidth
|
||||
height: StudioTheme.Values.sliderHandleHeight
|
||||
radius: 0
|
||||
color: slider.pressed ? StudioTheme.Values.themeInteraction : StudioTheme.Values.themeControlOutline
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
x: slider.leftPadding
|
||||
y: slider.topPadding + (slider.availableHeight / 2) - (height / 2)
|
||||
width: slider.availableWidth
|
||||
height: StudioTheme.Values.sliderTrackHeight
|
||||
radius: 0
|
||||
color: StudioTheme.Values.themeSliderInactiveTrack
|
||||
|
||||
Rectangle {
|
||||
width: slider.visualPosition * parent.width
|
||||
height: parent.height
|
||||
color: StudioTheme.Values.themeSliderActiveTrack
|
||||
radius: 0
|
||||
}
|
||||
}
|
||||
|
||||
onMoved: {
|
||||
var currValue = myControl.value
|
||||
myControl.realValue = slider.value
|
||||
|
||||
if (currValue !== myControl.realValue)
|
||||
myControl.realValueModified()
|
||||
}
|
||||
}
|
||||
}
|
||||
+346
@@ -0,0 +1,346 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2019 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.12
|
||||
import QtQuick.Templates 2.12 as T
|
||||
import StudioTheme 1.0 as StudioTheme
|
||||
|
||||
T.SpinBox {
|
||||
id: mySpinBox
|
||||
|
||||
property real realFrom: 0.0
|
||||
property real realTo: 99.0
|
||||
property real realValue: 1.0
|
||||
property real realStepSize: 1.0
|
||||
|
||||
property alias labelColor: spinBoxInput.color
|
||||
property alias actionIndicator: actionIndicator
|
||||
|
||||
property int decimals: 0
|
||||
|
||||
property real minStepSize: 1
|
||||
property real maxStepSize: 10
|
||||
|
||||
property bool edit: spinBoxInput.activeFocus
|
||||
property bool hover: false // This property is used to indicate the global hover state
|
||||
property bool drag: false
|
||||
|
||||
property alias actionIndicatorVisible: actionIndicator.visible
|
||||
property real __actionIndicatorWidth: StudioTheme.Values.squareComponentWidth
|
||||
property real __actionIndicatorHeight: StudioTheme.Values.height
|
||||
|
||||
property bool spinBoxIndicatorVisible: true
|
||||
property real __spinBoxIndicatorWidth: StudioTheme.Values.smallRectWidth - 2
|
||||
* StudioTheme.Values.border
|
||||
property real __spinBoxIndicatorHeight: StudioTheme.Values.height / 2
|
||||
- StudioTheme.Values.border
|
||||
|
||||
property alias sliderIndicatorVisible: sliderIndicator.visible
|
||||
property real __sliderIndicatorWidth: StudioTheme.Values.squareComponentWidth
|
||||
property real __sliderIndicatorHeight: StudioTheme.Values.height
|
||||
|
||||
signal realValueModified
|
||||
signal compressedRealValueModified
|
||||
signal dragStarted
|
||||
signal dragEnded
|
||||
|
||||
// Use custom wheel handling due to bugs
|
||||
property bool __wheelEnabled: false
|
||||
wheelEnabled: false
|
||||
|
||||
width: StudioTheme.Values.squareComponentWidth * 5
|
||||
height: StudioTheme.Values.height
|
||||
|
||||
leftPadding: spinBoxIndicatorDown.x + spinBoxIndicatorDown.width
|
||||
- (spinBoxIndicatorVisible ? 0 : StudioTheme.Values.border)
|
||||
rightPadding: sliderIndicator.width - (sliderIndicatorVisible ? StudioTheme.Values.border : 0)
|
||||
|
||||
font.pixelSize: StudioTheme.Values.myFontSize
|
||||
editable: true
|
||||
|
||||
// Leave this in for now
|
||||
from: -99
|
||||
value: 0
|
||||
to: 99
|
||||
|
||||
validator: DoubleValidator {
|
||||
id: doubleValidator
|
||||
locale: mySpinBox.locale.name
|
||||
notation: DoubleValidator.StandardNotation
|
||||
decimals: mySpinBox.decimals
|
||||
bottom: Math.min(mySpinBox.realFrom, mySpinBox.realTo)
|
||||
top: Math.max(mySpinBox.realFrom, mySpinBox.realTo)
|
||||
}
|
||||
|
||||
ActionIndicator {
|
||||
id: actionIndicator
|
||||
myControl: mySpinBox
|
||||
x: 0
|
||||
y: 0
|
||||
width: actionIndicator.visible ? __actionIndicatorWidth : 0
|
||||
height: actionIndicator.visible ? __actionIndicatorHeight : 0
|
||||
}
|
||||
|
||||
up.indicator: RealSpinBoxIndicator {
|
||||
id: spinBoxIndicatorUp
|
||||
myControl: mySpinBox
|
||||
iconFlip: -1
|
||||
visible: spinBoxIndicatorVisible
|
||||
onRealReleased: mySpinBox.realIncrease()
|
||||
onRealPressAndHold: mySpinBox.realIncrease()
|
||||
x: actionIndicator.width + (actionIndicatorVisible ? 0 : StudioTheme.Values.border)
|
||||
y: StudioTheme.Values.border
|
||||
width: spinBoxIndicatorVisible ? __spinBoxIndicatorWidth : 0
|
||||
height: spinBoxIndicatorVisible ? __spinBoxIndicatorHeight : 0
|
||||
|
||||
realEnabled: (mySpinBox.realFrom < mySpinBox.realTo) ? (mySpinBox.realValue < mySpinBox.realTo) : (mySpinBox.realValue > mySpinBox.realTo)
|
||||
}
|
||||
|
||||
down.indicator: RealSpinBoxIndicator {
|
||||
id: spinBoxIndicatorDown
|
||||
myControl: mySpinBox
|
||||
visible: spinBoxIndicatorVisible
|
||||
onRealReleased: mySpinBox.realDecrease()
|
||||
onRealPressAndHold: mySpinBox.realDecrease()
|
||||
x: actionIndicator.width + (actionIndicatorVisible ? 0 : StudioTheme.Values.border)
|
||||
y: spinBoxIndicatorUp.y + spinBoxIndicatorUp.height
|
||||
width: spinBoxIndicatorVisible ? __spinBoxIndicatorWidth : 0
|
||||
height: spinBoxIndicatorVisible ? __spinBoxIndicatorHeight : 0
|
||||
|
||||
realEnabled: (mySpinBox.realFrom < mySpinBox.realTo) ? (mySpinBox.realValue > mySpinBox.realFrom) : (mySpinBox.realValue < mySpinBox.realFrom)
|
||||
}
|
||||
|
||||
contentItem: RealSpinBoxInput {
|
||||
id: spinBoxInput
|
||||
myControl: mySpinBox
|
||||
validator: doubleValidator
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
id: spinBoxBackground
|
||||
color: StudioTheme.Values.themeControlOutline
|
||||
border.color: StudioTheme.Values.themeControlOutline
|
||||
border.width: StudioTheme.Values.border
|
||||
width: mySpinBox.width
|
||||
height: mySpinBox.height
|
||||
}
|
||||
|
||||
CheckIndicator {
|
||||
id: sliderIndicator
|
||||
myControl: mySpinBox
|
||||
myPopup: sliderPopup
|
||||
x: spinBoxInput.x + spinBoxInput.width - StudioTheme.Values.border
|
||||
width: sliderIndicator.visible ? __sliderIndicatorWidth : 0
|
||||
height: sliderIndicator.visible ? __sliderIndicatorHeight : 0
|
||||
visible: false // reasonable default
|
||||
}
|
||||
|
||||
RealSliderPopup {
|
||||
id: sliderPopup
|
||||
myControl: mySpinBox
|
||||
x: spinBoxInput.x
|
||||
y: StudioTheme.Values.height - StudioTheme.Values.border
|
||||
width: spinBoxInput.width + sliderIndicator.width - StudioTheme.Values.border
|
||||
height: StudioTheme.Values.sliderHeight
|
||||
|
||||
enter: Transition {
|
||||
}
|
||||
exit: Transition {
|
||||
}
|
||||
}
|
||||
|
||||
textFromValue: function (value, locale) {
|
||||
return Number(mySpinBox.realValue).toLocaleString(locale, 'f', mySpinBox.decimals)
|
||||
}
|
||||
|
||||
valueFromText: function (text, locale) {
|
||||
mySpinBox.setRealValue(Number.fromLocaleString(locale, spinBoxInput.text))
|
||||
return 0
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "default"
|
||||
when: mySpinBox.enabled && !mySpinBox.hover
|
||||
&& !mySpinBox.edit && !mySpinBox.drag
|
||||
PropertyChanges {
|
||||
target: mySpinBox
|
||||
__wheelEnabled: false
|
||||
}
|
||||
PropertyChanges {
|
||||
target: spinBoxInput
|
||||
selectByMouse: false
|
||||
}
|
||||
PropertyChanges {
|
||||
target: spinBoxBackground
|
||||
color: StudioTheme.Values.themeControlOutline
|
||||
border.color: StudioTheme.Values.themeControlOutline
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "edit"
|
||||
when: mySpinBox.edit
|
||||
PropertyChanges {
|
||||
target: mySpinBox
|
||||
__wheelEnabled: true
|
||||
}
|
||||
PropertyChanges {
|
||||
target: spinBoxInput
|
||||
selectByMouse: true
|
||||
}
|
||||
PropertyChanges {
|
||||
target: spinBoxBackground
|
||||
color: StudioTheme.Values.themeInteraction
|
||||
border.color: StudioTheme.Values.themeInteraction
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "drag"
|
||||
when: mySpinBox.drag
|
||||
PropertyChanges {
|
||||
target: spinBoxBackground
|
||||
color: StudioTheme.Values.themeInteraction
|
||||
border.color: StudioTheme.Values.themeInteraction
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "disabled"
|
||||
when: !mySpinBox.enabled
|
||||
PropertyChanges {
|
||||
target: spinBoxBackground
|
||||
color: StudioTheme.Values.themeControlOutlineDisabled
|
||||
border.color: StudioTheme.Values.themeControlOutlineDisabled
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
Timer {
|
||||
id: myTimer
|
||||
repeat: false
|
||||
running: false
|
||||
interval: 200
|
||||
onTriggered: mySpinBox.compressedRealValueModified()
|
||||
}
|
||||
|
||||
onRealValueChanged: {
|
||||
spinBoxInput.text = mySpinBox.textFromValue(mySpinBox.realValue, mySpinBox.locale)
|
||||
mySpinBox.value = 0 // Without setting value back to 0, it can occur that one of
|
||||
// the indicator will be disabled due to range logic.
|
||||
}
|
||||
onRealValueModified: myTimer.restart()
|
||||
|
||||
onFocusChanged: mySpinBox.setValueFromInput()
|
||||
onDisplayTextChanged: spinBoxInput.text = mySpinBox.displayText
|
||||
onActiveFocusChanged: {
|
||||
if (mySpinBox.activeFocus)
|
||||
// QTBUG-75862 && mySpinBox.focusReason === Qt.TabFocusReason)
|
||||
spinBoxInput.selectAll()
|
||||
|
||||
if (sliderPopup.opened && !mySpinBox.activeFocus)
|
||||
sliderPopup.close()
|
||||
}
|
||||
|
||||
Keys.onPressed: {
|
||||
if (event.key === Qt.Key_Up || event.key === Qt.Key_Down) {
|
||||
event.accepted = true
|
||||
|
||||
// Store current step size
|
||||
var currStepSize = mySpinBox.realStepSize
|
||||
|
||||
// Set stepSize according to used modifier key
|
||||
if (event.modifiers & Qt.ControlModifier)
|
||||
mySpinBox.realStepSize = mySpinBox.minStepSize
|
||||
|
||||
if (event.modifiers & Qt.ShiftModifier)
|
||||
mySpinBox.realStepSize = mySpinBox.maxStepSize
|
||||
|
||||
if (event.key === Qt.Key_Up)
|
||||
mySpinBox.realIncrease()
|
||||
else
|
||||
mySpinBox.realDecrease()
|
||||
|
||||
// Reset step size
|
||||
mySpinBox.realStepSize = currStepSize
|
||||
}
|
||||
|
||||
if (event.key === Qt.Key_Escape)
|
||||
mySpinBox.focus = false
|
||||
|
||||
// FIX: This is a temporary fix for QTBUG-74239
|
||||
if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter)
|
||||
mySpinBox.setValueFromInput()
|
||||
}
|
||||
|
||||
function clamp(v, lo, hi) {
|
||||
return (v < lo || v > hi) ? Math.min(Math.max(lo, v), hi) : v
|
||||
}
|
||||
|
||||
function setValueFromInput() {
|
||||
// FIX: This is a temporary fix for QTBUG-74239
|
||||
var currValue = mySpinBox.realValue
|
||||
|
||||
// Call the function but don't use return value. The realValue property
|
||||
// will be implicitly set inside the function/procedure.
|
||||
mySpinBox.valueFromText(spinBoxInput.text, mySpinBox.locale)
|
||||
|
||||
if (mySpinBox.realValue !== currValue) {
|
||||
mySpinBox.realValueModified()
|
||||
} else {
|
||||
// Check if input text differs in format from the current value
|
||||
var tmpInputValue = mySpinBox.textFromValue(mySpinBox.realValue, mySpinBox.locale)
|
||||
|
||||
if (tmpInputValue !== spinBoxInput.text)
|
||||
spinBoxInput.text = tmpInputValue
|
||||
}
|
||||
}
|
||||
|
||||
function setRealValue(value) {
|
||||
mySpinBox.realValue = clamp(value,
|
||||
mySpinBox.validator.bottom,
|
||||
mySpinBox.validator.top)
|
||||
}
|
||||
|
||||
function realDecrease() {
|
||||
// Store the current value for comparison
|
||||
var currValue = mySpinBox.realValue
|
||||
mySpinBox.valueFromText(spinBoxInput.text, mySpinBox.locale)
|
||||
|
||||
setRealValue(mySpinBox.realValue - realStepSize)
|
||||
|
||||
if (mySpinBox.realValue !== currValue)
|
||||
mySpinBox.realValueModified()
|
||||
}
|
||||
|
||||
function realIncrease() {
|
||||
// Store the current value for comparison
|
||||
var currValue = mySpinBox.realValue
|
||||
mySpinBox.valueFromText(spinBoxInput.text, mySpinBox.locale)
|
||||
|
||||
setRealValue(mySpinBox.realValue + realStepSize)
|
||||
|
||||
if (mySpinBox.realValue !== currValue)
|
||||
mySpinBox.realValueModified()
|
||||
}
|
||||
}
|
||||
+196
@@ -0,0 +1,196 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2019 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.12
|
||||
import QtQuick.Templates 2.12 as T
|
||||
import StudioTheme 1.0 as StudioTheme
|
||||
|
||||
Rectangle {
|
||||
id: spinBoxIndicator
|
||||
|
||||
property T.Control myControl
|
||||
|
||||
property bool hover: false
|
||||
property bool pressed: false
|
||||
property bool released: false
|
||||
property bool realEnabled: true
|
||||
|
||||
signal realPressed
|
||||
signal realPressAndHold
|
||||
signal realReleased
|
||||
|
||||
property alias iconFlip: spinBoxIndicatorIconScale.yScale
|
||||
|
||||
color: StudioTheme.Values.themeControlBackground
|
||||
border.width: 0
|
||||
|
||||
onEnabledChanged: invalidateEnabled()
|
||||
onRealEnabledChanged: {
|
||||
invalidateEnabled()
|
||||
if (spinBoxIndicator.realEnabled === false)
|
||||
pressAndHoldTimer.stop()
|
||||
}
|
||||
|
||||
// This function is meant to synchronize enabled with realEnable to avoid
|
||||
// the internal logic messing with the actual state.
|
||||
function invalidateEnabled() {
|
||||
spinBoxIndicator.enabled = spinBoxIndicator.realEnabled
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: pressAndHoldTimer
|
||||
repeat: true
|
||||
running: false
|
||||
interval: 100
|
||||
onTriggered: spinBoxIndicator.realPressAndHold()
|
||||
}
|
||||
|
||||
// This MouseArea is a workaround to avoid some hover state related bugs
|
||||
// when using the actual signal 'up.hovered'. QTBUG-74688
|
||||
MouseArea {
|
||||
id: spinBoxIndicatorMouseArea
|
||||
|
||||
property bool pressedAndHeld: false
|
||||
|
||||
anchors.fill: parent
|
||||
// Shift the MouseArea down by 1 pixel due to potentially overlapping areas
|
||||
anchors.topMargin: iconFlip < 0 ? 0 : 1
|
||||
anchors.bottomMargin: iconFlip < 0 ? 1 : 0
|
||||
hoverEnabled: true
|
||||
pressAndHoldInterval: 500
|
||||
onContainsMouseChanged: spinBoxIndicator.hover = containsMouse
|
||||
onContainsPressChanged: spinBoxIndicator.pressed = containsPress
|
||||
onPressed: {
|
||||
myControl.forceActiveFocus()
|
||||
spinBoxIndicator.realPressed()
|
||||
mouse.accepted = true
|
||||
}
|
||||
onPressAndHold: {
|
||||
pressAndHoldTimer.restart()
|
||||
pressedAndHeld = true
|
||||
}
|
||||
onReleased: {
|
||||
// Only trigger real released when pressAndHold isn't active
|
||||
if (!pressAndHoldTimer.running && containsMouse)
|
||||
spinBoxIndicator.realReleased()
|
||||
pressAndHoldTimer.stop()
|
||||
mouse.accepted = true
|
||||
pressedAndHeld = false
|
||||
}
|
||||
onEntered: {
|
||||
if (pressedAndHeld)
|
||||
pressAndHoldTimer.restart()
|
||||
}
|
||||
onExited: {
|
||||
if (pressAndHoldTimer.running)
|
||||
pressAndHoldTimer.stop()
|
||||
}
|
||||
}
|
||||
|
||||
T.Label {
|
||||
id: spinBoxIndicatorIcon
|
||||
text: StudioTheme.Constants.upDownSquare2
|
||||
color: StudioTheme.Values.themeTextColor
|
||||
renderType: Text.NativeRendering
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
font.pixelSize: StudioTheme.Values.spinControlIconSizeMulti
|
||||
font.family: StudioTheme.Constants.iconFont.family
|
||||
anchors.fill: parent
|
||||
transform: Scale {
|
||||
id: spinBoxIndicatorIconScale
|
||||
origin.x: 0
|
||||
origin.y: spinBoxIndicatorIcon.height / 2
|
||||
yScale: 1
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "default"
|
||||
when: myControl.enabled && spinBoxIndicator.enabled
|
||||
PropertyChanges {
|
||||
target: spinBoxIndicatorIcon
|
||||
color: StudioTheme.Values.themeTextColor
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "disabled"
|
||||
when: !myControl.enabled || !spinBoxIndicator.enabled
|
||||
PropertyChanges {
|
||||
target: spinBoxIndicatorIcon
|
||||
color: StudioTheme.Values.themeTextColorDisabled
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "default"
|
||||
when: myControl.enabled && !(spinBoxIndicator.hover
|
||||
|| myControl.hover)
|
||||
&& !spinBoxIndicator.pressed && !myControl.edit
|
||||
&& !myControl.drag
|
||||
PropertyChanges {
|
||||
target: spinBoxIndicator
|
||||
color: StudioTheme.Values.themeControlBackground
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "hovered"
|
||||
when: (spinBoxIndicator.hover || myControl.hover)
|
||||
&& !spinBoxIndicator.pressed && !myControl.edit
|
||||
&& !myControl.drag
|
||||
PropertyChanges {
|
||||
target: spinBoxIndicator
|
||||
color: StudioTheme.Values.themeHoverHighlight
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "pressed"
|
||||
when: spinBoxIndicator.pressed
|
||||
PropertyChanges {
|
||||
target: spinBoxIndicator
|
||||
color: StudioTheme.Values.themeInteraction
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "edit"
|
||||
when: myControl.edit
|
||||
PropertyChanges {
|
||||
target: spinBoxIndicator
|
||||
color: StudioTheme.Values.themeFocusEdit
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "drag"
|
||||
when: myControl.drag
|
||||
PropertyChanges {
|
||||
target: spinBoxIndicator
|
||||
color: StudioTheme.Values.themeFocusDrag
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
+211
@@ -0,0 +1,211 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2019 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.12
|
||||
import QtQuick.Templates 2.12 as T
|
||||
import StudioTheme 1.0 as StudioTheme
|
||||
|
||||
TextInput {
|
||||
id: textInput
|
||||
|
||||
property T.Control myControl
|
||||
|
||||
property bool edit: textInput.activeFocus
|
||||
property bool drag: false
|
||||
|
||||
z: 2
|
||||
font: myControl.font
|
||||
color: StudioTheme.Values.themeTextColor
|
||||
selectionColor: StudioTheme.Values.themeTextSelectionColor
|
||||
selectedTextColor: StudioTheme.Values.themeTextSelectedTextColor
|
||||
|
||||
horizontalAlignment: Qt.AlignRight
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
leftPadding: StudioTheme.Values.inputHorizontalPadding
|
||||
rightPadding: StudioTheme.Values.inputHorizontalPadding
|
||||
|
||||
readOnly: !myControl.editable
|
||||
validator: myControl.validator
|
||||
inputMethodHints: myControl.inputMethodHints
|
||||
selectByMouse: false
|
||||
activeFocusOnPress: false
|
||||
clip: true
|
||||
|
||||
// TextInput focus needs to be set to activeFocus whenever it changes,
|
||||
// otherwise TextInput will get activeFocus whenever the parent SpinBox gets
|
||||
// activeFocus. This will lead to weird side effects.
|
||||
onActiveFocusChanged: textInput.focus = activeFocus
|
||||
|
||||
Rectangle {
|
||||
id: textInputArea
|
||||
color: StudioTheme.Values.themeControlBackground
|
||||
border.color: StudioTheme.Values.themeControlOutline
|
||||
border.width: StudioTheme.Values.border
|
||||
x: 0
|
||||
y: 0
|
||||
z: -1
|
||||
width: textInput.width
|
||||
height: StudioTheme.Values.height
|
||||
}
|
||||
|
||||
DragHandler {
|
||||
id: dragHandler
|
||||
target: null
|
||||
acceptedDevices: PointerDevice.Mouse
|
||||
enabled: true
|
||||
|
||||
property real initialValue: 0
|
||||
|
||||
onActiveChanged: {
|
||||
if (dragHandler.active) {
|
||||
dragHandler.initialValue = myControl.realValue
|
||||
mouseArea.cursorShape = Qt.ClosedHandCursor
|
||||
myControl.drag = true
|
||||
myControl.dragStarted()
|
||||
} else {
|
||||
mouseArea.cursorShape = Qt.PointingHandCursor
|
||||
myControl.drag = false
|
||||
myControl.dragEnded()
|
||||
}
|
||||
}
|
||||
onTranslationChanged: {
|
||||
var currValue = myControl.realValue
|
||||
myControl.setRealValue(dragHandler.initialValue + (translation.x * myControl.realStepSize))
|
||||
if (currValue !== myControl.realValue)
|
||||
myControl.realValueModified()
|
||||
}
|
||||
}
|
||||
|
||||
TapHandler {
|
||||
id: tapHandler
|
||||
acceptedDevices: PointerDevice.Mouse
|
||||
enabled: true
|
||||
onTapped: {
|
||||
textInput.forceActiveFocus()
|
||||
textInput.deselect() // QTBUG-75862
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
anchors.fill: parent
|
||||
enabled: true
|
||||
hoverEnabled: true
|
||||
propagateComposedEvents: true
|
||||
acceptedButtons: Qt.LeftButton
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
// Sets the global hover
|
||||
onContainsMouseChanged: myControl.hover = containsMouse
|
||||
onPressed: mouse.accepted = false
|
||||
onWheel: {
|
||||
if (!myControl.__wheelEnabled)
|
||||
return
|
||||
|
||||
var currValue = myControl.realValue
|
||||
myControl.valueFromText(textInput.text, myControl.locale)
|
||||
myControl.setRealValue(myControl.realValue + (wheel.angleDelta.y / 120.0 * myControl.realStepSize))
|
||||
|
||||
if (currValue !== myControl.realValue)
|
||||
myControl.realValueModified()
|
||||
}
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "default"
|
||||
when: myControl.enabled && !textInput.edit
|
||||
&& !mouseArea.containsMouse && !myControl.drag
|
||||
PropertyChanges {
|
||||
target: textInputArea
|
||||
color: StudioTheme.Values.themeControlBackground
|
||||
border.color: StudioTheme.Values.themeControlOutline
|
||||
}
|
||||
PropertyChanges {
|
||||
target: dragHandler
|
||||
enabled: true
|
||||
}
|
||||
PropertyChanges {
|
||||
target: tapHandler
|
||||
enabled: true
|
||||
}
|
||||
PropertyChanges {
|
||||
target: mouseArea
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "hovered"
|
||||
when: myControl.hover && !textInput.edit && !myControl.drag
|
||||
PropertyChanges {
|
||||
target: textInputArea
|
||||
color: StudioTheme.Values.themeHoverHighlight
|
||||
border.color: StudioTheme.Values.themeControlOutline
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "edit"
|
||||
when: textInput.edit
|
||||
PropertyChanges {
|
||||
target: textInputArea
|
||||
color: StudioTheme.Values.themeFocusEdit
|
||||
border.color: StudioTheme.Values.themeInteraction
|
||||
}
|
||||
PropertyChanges {
|
||||
target: dragHandler
|
||||
enabled: false
|
||||
}
|
||||
PropertyChanges {
|
||||
target: tapHandler
|
||||
enabled: false
|
||||
}
|
||||
PropertyChanges {
|
||||
target: mouseArea
|
||||
cursorShape: Qt.IBeamCursor
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "drag"
|
||||
when: myControl.drag
|
||||
PropertyChanges {
|
||||
target: textInputArea
|
||||
color: StudioTheme.Values.themeFocusDrag
|
||||
border.color: StudioTheme.Values.themeInteraction
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "disabled"
|
||||
when: !myControl.enabled
|
||||
PropertyChanges {
|
||||
target: textInputArea
|
||||
color: StudioTheme.Values.themeControlBackgroundDisabled
|
||||
border.color: StudioTheme.Values.themeControlOutlineDisabled
|
||||
}
|
||||
PropertyChanges {
|
||||
target: textInput
|
||||
color: StudioTheme.Values.themeTextColorDisabled
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
+6
-6
@@ -43,10 +43,10 @@ T.ScrollView {
|
||||
ScrollBar.vertical: ScrollBar {
|
||||
id: verticalScrollBar
|
||||
parent: control
|
||||
x: control.width - width - StudioTheme.Values.border
|
||||
x: control.width - verticalScrollBar.width - StudioTheme.Values.border
|
||||
y: StudioTheme.Values.border
|
||||
height: control.availableHeight - 2 * StudioTheme.Values.border
|
||||
- (bothVisible ? horizontalThickness : 0)
|
||||
height: control.availableHeight - (2 * StudioTheme.Values.border)
|
||||
- (control.bothVisible ? control.horizontalThickness : 0)
|
||||
active: control.ScrollBar.horizontal.active
|
||||
}
|
||||
|
||||
@@ -54,9 +54,9 @@ T.ScrollView {
|
||||
id: horizontalScrollBar
|
||||
parent: control
|
||||
x: StudioTheme.Values.border
|
||||
y: control.height - height - StudioTheme.Values.border
|
||||
width: control.availableWidth - 2 * StudioTheme.Values.border
|
||||
- (bothVisible ? verticalThickness : 0)
|
||||
y: control.height - horizontalScrollBar.height - StudioTheme.Values.border
|
||||
width: control.availableWidth - (2 * StudioTheme.Values.border)
|
||||
- (control.bothVisible ? control.verticalThickness : 0)
|
||||
active: control.ScrollBar.vertical.active
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -77,8 +77,8 @@ T.Slider {
|
||||
handle: Rectangle {
|
||||
id: sliderHandle
|
||||
x: slider.leftPadding + (slider.visualPosition * slider.availableWidth)
|
||||
- sliderHandle.width / 2
|
||||
y: slider.topPadding + slider.availableHeight / 2 - sliderHandle.height / 2
|
||||
- (sliderHandle.width / 2)
|
||||
y: slider.topPadding + (slider.availableHeight / 2) - (sliderHandle.height / 2)
|
||||
z: 20
|
||||
implicitWidth: StudioTheme.Values.sliderHandleWidth
|
||||
implicitHeight: StudioTheme.Values.sliderHandleHeight
|
||||
|
||||
+16
-3
@@ -57,7 +57,7 @@ T.Popup {
|
||||
|
||||
handle: Rectangle {
|
||||
x: slider.leftPadding + slider.visualPosition * (slider.availableWidth - width)
|
||||
y: slider.topPadding + slider.availableHeight / 2 - height / 2
|
||||
y: slider.topPadding + (slider.availableHeight / 2) - (height / 2)
|
||||
width: StudioTheme.Values.sliderHandleWidth
|
||||
height: StudioTheme.Values.sliderHandleHeight
|
||||
radius: 0
|
||||
@@ -66,7 +66,7 @@ T.Popup {
|
||||
|
||||
background: Rectangle {
|
||||
x: slider.leftPadding
|
||||
y: slider.topPadding + slider.availableHeight / 2 - height / 2
|
||||
y: slider.topPadding + (slider.availableHeight / 2) - (height / 2)
|
||||
width: slider.availableWidth
|
||||
height: StudioTheme.Values.sliderTrackHeight
|
||||
radius: 0
|
||||
@@ -81,7 +81,20 @@ T.Popup {
|
||||
}
|
||||
|
||||
onMoved: {
|
||||
myControl.value = value
|
||||
var currValue = myControl.value
|
||||
myControl.value = slider.value
|
||||
|
||||
if (currValue !== myControl.value)
|
||||
myControl.valueModified()
|
||||
}
|
||||
}
|
||||
|
||||
onOpened: {
|
||||
// Check if value is in sync with text input, if not sync it!
|
||||
var val = myControl.valueFromText(myControl.contentItem.text,
|
||||
myControl.locale)
|
||||
if (myControl.value !== val) {
|
||||
myControl.value = val
|
||||
myControl.valueModified()
|
||||
}
|
||||
}
|
||||
|
||||
+55
-65
@@ -36,7 +36,6 @@ T.SpinBox {
|
||||
property int decimals: 0
|
||||
property int factor: Math.pow(10, decimals)
|
||||
|
||||
property real defaultStepSize: 1
|
||||
property real minStepSize: 1
|
||||
property real maxStepSize: 10
|
||||
|
||||
@@ -49,9 +48,9 @@ T.SpinBox {
|
||||
property real __actionIndicatorHeight: StudioTheme.Values.height
|
||||
|
||||
property bool spinBoxIndicatorVisible: true
|
||||
property real __spinBoxIndicatorWidth: StudioTheme.Values.smallRectWidth - 2
|
||||
* StudioTheme.Values.border
|
||||
property real __spinBoxIndicatorHeight: StudioTheme.Values.height / 2
|
||||
property real __spinBoxIndicatorWidth: StudioTheme.Values.smallRectWidth - (2
|
||||
* StudioTheme.Values.border)
|
||||
property real __spinBoxIndicatorHeight: (StudioTheme.Values.height / 2)
|
||||
- StudioTheme.Values.border
|
||||
|
||||
property alias sliderIndicatorVisible: sliderIndicator.visible
|
||||
@@ -80,8 +79,8 @@ T.SpinBox {
|
||||
locale: mySpinBox.locale.name
|
||||
notation: DoubleValidator.StandardNotation
|
||||
decimals: mySpinBox.decimals
|
||||
bottom: Math.min(mySpinBox.from, mySpinBox.to) / factor
|
||||
top: Math.max(mySpinBox.from, mySpinBox.to) / factor
|
||||
bottom: Math.min(mySpinBox.from, mySpinBox.to) / mySpinBox.factor
|
||||
top: Math.max(mySpinBox.from, mySpinBox.to) / mySpinBox.factor
|
||||
}
|
||||
|
||||
IntValidator {
|
||||
@@ -110,10 +109,12 @@ T.SpinBox {
|
||||
pressed: mySpinBox.up.pressed
|
||||
iconFlip: -1
|
||||
|
||||
x: actionIndicator.width + (actionIndicator.visible ? 0 : StudioTheme.Values.border)
|
||||
x: actionIndicator.width + (actionIndicatorVisible ? 0 : StudioTheme.Values.border)
|
||||
y: StudioTheme.Values.border
|
||||
width: spinBoxIndicatorVisible ? __spinBoxIndicatorWidth : 0
|
||||
height: spinBoxIndicatorVisible ? __spinBoxIndicatorHeight : 0
|
||||
|
||||
enabled: (mySpinBox.from < mySpinBox.to) ? mySpinBox.value < mySpinBox.to : mySpinBox.value > mySpinBox.to
|
||||
}
|
||||
|
||||
down.indicator: SpinBoxIndicator {
|
||||
@@ -128,6 +129,8 @@ T.SpinBox {
|
||||
y: spinBoxIndicatorUp.y + spinBoxIndicatorUp.height
|
||||
width: spinBoxIndicatorVisible ? __spinBoxIndicatorWidth : 0
|
||||
height: spinBoxIndicatorVisible ? __spinBoxIndicatorHeight : 0
|
||||
|
||||
enabled: (mySpinBox.from < mySpinBox.to) ? mySpinBox.value > mySpinBox.from : mySpinBox.value < mySpinBox.from
|
||||
}
|
||||
|
||||
contentItem: SpinBoxInput {
|
||||
@@ -171,12 +174,12 @@ T.SpinBox {
|
||||
}
|
||||
|
||||
textFromValue: function (value, locale) {
|
||||
return Number(value / factor).toLocaleString(locale, 'f',
|
||||
mySpinBox.decimals)
|
||||
return Number(value / mySpinBox.factor).toLocaleString(locale, 'f',
|
||||
mySpinBox.decimals)
|
||||
}
|
||||
|
||||
valueFromText: function (text, locale) {
|
||||
return Number.fromLocaleString(locale, text) * factor
|
||||
return Number.fromLocaleString(locale, text) * mySpinBox.factor
|
||||
}
|
||||
|
||||
states: [
|
||||
@@ -235,38 +238,6 @@ T.SpinBox {
|
||||
}
|
||||
]
|
||||
|
||||
onActiveFocusChanged: {
|
||||
if (mySpinBox.activeFocus)
|
||||
// QTBUG-75862 && mySpinBox.focusReason === Qt.TabFocusReason)
|
||||
spinBoxInput.selectAll()
|
||||
|
||||
if (sliderPopup.opened && !mySpinBox.activeFocus)
|
||||
sliderPopup.close()
|
||||
}
|
||||
|
||||
onFocusChanged: {
|
||||
// FIX: This is a temporary fix for QTBUG-74239
|
||||
var currValue = mySpinBox.value
|
||||
|
||||
if (!spinBoxInput.acceptableInput)
|
||||
mySpinBox.value = clamp(valueFromText(spinBoxInput.text,
|
||||
mySpinBox.locale),
|
||||
mySpinBox.validator.bottom * factor,
|
||||
mySpinBox.validator.top * factor)
|
||||
else
|
||||
mySpinBox.value = valueFromText(spinBoxInput.text, mySpinBox.locale)
|
||||
|
||||
if (spinBoxInput.text !== mySpinBox.displayText)
|
||||
spinBoxInput.text = mySpinBox.displayText
|
||||
|
||||
if (mySpinBox.value !== currValue)
|
||||
mySpinBox.valueModified()
|
||||
}
|
||||
|
||||
onDisplayTextChanged: {
|
||||
spinBoxInput.text = mySpinBox.displayText
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: myTimer
|
||||
repeat: false
|
||||
@@ -276,57 +247,56 @@ T.SpinBox {
|
||||
}
|
||||
|
||||
onValueModified: myTimer.restart()
|
||||
onFocusChanged: mySpinBox.setValueFromInput()
|
||||
onDisplayTextChanged: spinBoxInput.text = mySpinBox.displayText
|
||||
onActiveFocusChanged: {
|
||||
if (mySpinBox.activeFocus)
|
||||
// QTBUG-75862 && mySpinBox.focusReason === Qt.TabFocusReason)
|
||||
spinBoxInput.selectAll()
|
||||
|
||||
if (sliderPopup.opened && !mySpinBox.activeFocus)
|
||||
sliderPopup.close()
|
||||
}
|
||||
|
||||
Keys.onPressed: {
|
||||
if (event.key === Qt.Key_Up || event.key === Qt.Key_Down) {
|
||||
event.accepted = true
|
||||
|
||||
mySpinBox.stepSize = defaultStepSize
|
||||
// Store current step size
|
||||
var currStepSize = mySpinBox.stepSize
|
||||
|
||||
if (event.modifiers & Qt.ControlModifier)
|
||||
mySpinBox.stepSize = minStepSize
|
||||
mySpinBox.stepSize = mySpinBox.minStepSize
|
||||
|
||||
if (event.modifiers & Qt.ShiftModifier)
|
||||
mySpinBox.stepSize = maxStepSize
|
||||
mySpinBox.stepSize = mySpinBox.maxStepSize
|
||||
|
||||
// Check if value is in sync with text input, if not sync it!
|
||||
var val = mySpinBox.valueFromText(spinBoxInput.text,
|
||||
mySpinBox.locale)
|
||||
if (mySpinBox.value !== val)
|
||||
mySpinBox.value = val
|
||||
|
||||
var curValue = mySpinBox.value
|
||||
var currValue = mySpinBox.value
|
||||
|
||||
if (event.key === Qt.Key_Up)
|
||||
mySpinBox.increase()
|
||||
else
|
||||
mySpinBox.decrease()
|
||||
|
||||
if (curValue !== mySpinBox.value)
|
||||
if (currValue !== mySpinBox.value)
|
||||
mySpinBox.valueModified()
|
||||
|
||||
// Reset step size
|
||||
mySpinBox.stepSize = currStepSize
|
||||
}
|
||||
|
||||
if (event.key === Qt.Key_Escape)
|
||||
mySpinBox.focus = false
|
||||
|
||||
// FIX: This is a temporary fix for QTBUG-74239
|
||||
if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) {
|
||||
var currValue = mySpinBox.value
|
||||
|
||||
if (!spinBoxInput.spinBoxInput)
|
||||
mySpinBox.value = clamp(valueFromText(spinBoxInput.text,
|
||||
mySpinBox.locale),
|
||||
mySpinBox.validator.bottom * factor,
|
||||
mySpinBox.validator.top * factor)
|
||||
else
|
||||
mySpinBox.value = valueFromText(spinBoxInput.text,
|
||||
mySpinBox.locale)
|
||||
|
||||
if (spinBoxInput.text !== mySpinBox.displayText)
|
||||
spinBoxInput.text = mySpinBox.displayText
|
||||
|
||||
if (mySpinBox.value !== currValue)
|
||||
mySpinBox.valueModified()
|
||||
}
|
||||
if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter)
|
||||
mySpinBox.setValueFromInput()
|
||||
}
|
||||
|
||||
function clamp(v, lo, hi) {
|
||||
@@ -335,4 +305,24 @@ T.SpinBox {
|
||||
|
||||
return v
|
||||
}
|
||||
|
||||
function setValueFromInput() {
|
||||
// FIX: This is a temporary fix for QTBUG-74239
|
||||
var currValue = mySpinBox.value
|
||||
|
||||
if (!spinBoxInput.acceptableInput)
|
||||
mySpinBox.value = clamp(valueFromText(spinBoxInput.text,
|
||||
mySpinBox.locale),
|
||||
mySpinBox.validator.bottom * mySpinBox.factor,
|
||||
mySpinBox.validator.top * mySpinBox.factor)
|
||||
else
|
||||
mySpinBox.value = valueFromText(spinBoxInput.text,
|
||||
mySpinBox.locale)
|
||||
|
||||
if (spinBoxInput.text !== mySpinBox.displayText)
|
||||
spinBoxInput.text = mySpinBox.displayText
|
||||
|
||||
if (mySpinBox.value !== currValue)
|
||||
mySpinBox.valueModified()
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -77,7 +77,7 @@ Rectangle {
|
||||
when: myControl.enabled && !(spinBoxIndicator.hover
|
||||
|| myControl.hover)
|
||||
&& !spinBoxIndicator.pressed && !myControl.edit
|
||||
&& !myControl.drag
|
||||
&& !myControl.drag && spinBoxIndicator.enabled
|
||||
PropertyChanges {
|
||||
target: spinBoxIndicator
|
||||
color: StudioTheme.Values.themeControlBackground
|
||||
@@ -87,7 +87,7 @@ Rectangle {
|
||||
name: "hovered"
|
||||
when: (spinBoxIndicator.hover || myControl.hover)
|
||||
&& !spinBoxIndicator.pressed && !myControl.edit
|
||||
&& !myControl.drag
|
||||
&& !myControl.drag && spinBoxIndicator.enabled
|
||||
PropertyChanges {
|
||||
target: spinBoxIndicator
|
||||
color: StudioTheme.Values.themeHoverHighlight
|
||||
@@ -95,7 +95,7 @@ Rectangle {
|
||||
},
|
||||
State {
|
||||
name: "pressed"
|
||||
when: spinBoxIndicator.pressed
|
||||
when: spinBoxIndicator.pressed && spinBoxIndicator.enabled
|
||||
PropertyChanges {
|
||||
target: spinBoxIndicator
|
||||
color: StudioTheme.Values.themeInteraction
|
||||
@@ -103,7 +103,7 @@ Rectangle {
|
||||
},
|
||||
State {
|
||||
name: "edit"
|
||||
when: myControl.edit
|
||||
when: myControl.edit && spinBoxIndicator.enabled
|
||||
PropertyChanges {
|
||||
target: spinBoxIndicator
|
||||
color: StudioTheme.Values.themeFocusEdit
|
||||
@@ -111,7 +111,7 @@ Rectangle {
|
||||
},
|
||||
State {
|
||||
name: "drag"
|
||||
when: myControl.drag
|
||||
when: myControl.drag && spinBoxIndicator.enabled
|
||||
PropertyChanges {
|
||||
target: spinBoxIndicator
|
||||
color: StudioTheme.Values.themeFocusDrag
|
||||
@@ -119,7 +119,7 @@ Rectangle {
|
||||
},
|
||||
State {
|
||||
name: "disabled"
|
||||
when: !myControl.enabled
|
||||
when: !myControl.enabled || !spinBoxIndicator.enabled
|
||||
PropertyChanges {
|
||||
target: spinBoxIndicator
|
||||
color: StudioTheme.Values.themeControlBackgroundDisabled
|
||||
|
||||
+4
-4
@@ -91,10 +91,10 @@ TextInput {
|
||||
}
|
||||
}
|
||||
onTranslationChanged: {
|
||||
var curValue = myControl.value
|
||||
var currValue = myControl.value
|
||||
myControl.value = initialValue + translation.x
|
||||
|
||||
if (curValue !== myControl.value)
|
||||
if (currValue !== myControl.value)
|
||||
myControl.valueModified()
|
||||
}
|
||||
}
|
||||
@@ -128,10 +128,10 @@ TextInput {
|
||||
if (myControl.value !== val)
|
||||
myControl.value = val
|
||||
|
||||
var curValue = myControl.value
|
||||
var currValue = myControl.value
|
||||
myControl.value += wheel.angleDelta.y / 120
|
||||
|
||||
if (curValue !== myControl.value)
|
||||
if (currValue !== myControl.value)
|
||||
myControl.valueModified()
|
||||
}
|
||||
}
|
||||
|
||||
+4
-8
@@ -38,9 +38,9 @@ TextField {
|
||||
|
||||
T.Popup {
|
||||
id: popup
|
||||
x: relativePopupX
|
||||
x: myTextField.relativePopupX
|
||||
y: myTextField.height - StudioTheme.Values.border
|
||||
width: popupWidth
|
||||
width: myTextField.popupWidth
|
||||
height: scrollView.height
|
||||
background: Rectangle {
|
||||
color: StudioTheme.Values.themeFocusEdit
|
||||
@@ -128,12 +128,8 @@ TextField {
|
||||
}
|
||||
|
||||
Keys.onPressed: {
|
||||
if (event.key === Qt.Key_Escape) {
|
||||
if (popup.opened)
|
||||
popup.close()
|
||||
else
|
||||
myTextField.focus = false
|
||||
}
|
||||
if (event.key === Qt.Key_Escape)
|
||||
popup.opened ? popup.close() : myTextField.focus = false
|
||||
|
||||
if ((event.key === Qt.Key_Return || event.key === Qt.Key_Enter)
|
||||
&& !popup.opened) {
|
||||
|
||||
@@ -13,6 +13,10 @@ ItemDelegate 1.0 ItemDelegate.qml
|
||||
Menu 1.0 Menu.qml
|
||||
MenuItem 1.0 MenuItem.qml
|
||||
MenuSeparator 1.0 MenuSeparator.qml
|
||||
RealSliderPopup 1.0 RealSliderPopup.qml
|
||||
RealSpinBox 1.0 RealSpinBox.qml
|
||||
RealSpinBoxIndicator 1.0 RealSpinBoxIndicator.qml
|
||||
RealSpinBoxInput 1.0 RealSpinBoxInput.qml
|
||||
ScrollBar 1.0 ScrollBar.qml
|
||||
ScrollView 1.0 ScrollView.qml
|
||||
SecondColumnLayout 1.0 SecondColumnLayout.qml
|
||||
|
||||
@@ -33,7 +33,7 @@ QtObject {
|
||||
property real baseFont: 12
|
||||
property real baseIconFont: 10
|
||||
|
||||
property real scaleFactor: 1
|
||||
property real scaleFactor: 1.1
|
||||
|
||||
property real height: Math.round(values.baseHeight * values.scaleFactor)
|
||||
property real myFontSize: Math.round(values.baseFont * values.scaleFactor)
|
||||
@@ -47,10 +47,10 @@ QtObject {
|
||||
property real sliderHeight: values.height / 2 * 1.5 // TODO:Have a look at -> sliderAreaHeight: Data.Values.height/2*1.5
|
||||
|
||||
property real sliderControlSize: 12
|
||||
property real sliderControlSizeMulti: sliderControlSize * scaleFactor
|
||||
property real sliderControlSizeMulti: values.sliderControlSize * values.scaleFactor
|
||||
|
||||
property real spinControlIconSize: 8
|
||||
property real spinControlIconSizeMulti: spinControlIconSize * scaleFactor
|
||||
property real spinControlIconSizeMulti: values.spinControlIconSize * values.scaleFactor
|
||||
|
||||
property real sliderTrackHeight: values.height / 4
|
||||
property real sliderHandleHeight: values.sliderTrackHeight * 2
|
||||
@@ -62,18 +62,18 @@ QtObject {
|
||||
property real sliderPointerWidth: Math.round(7 * values.scaleFactor)
|
||||
property real sliderPointerHeight: Math.round(2 * values.scaleFactor)
|
||||
|
||||
property real checkBoxSpacing: 6 // TODO Does look strange with scale factor applied
|
||||
property real checkBoxSpacing: Math.round(6 * values.scaleFactor)
|
||||
|
||||
property real columnWidth: 225 + (175 * (values.scaleFactor * 2))
|
||||
|
||||
property real marginTopBottom: 4
|
||||
property real border: 1
|
||||
|
||||
property real maxComboBoxPopupHeight: 300
|
||||
property real maxTextAreaPopupHeight: 150
|
||||
property real maxComboBoxPopupHeight: Math.round(300 * values.scaleFactor)
|
||||
property real maxTextAreaPopupHeight: Math.round(150 * values.scaleFactor)
|
||||
|
||||
property real contextMenuLabelSpacing: 30
|
||||
property real contextMenuHorizontalPadding: 6
|
||||
property real contextMenuLabelSpacing: Math.round(30 * values.scaleFactor)
|
||||
property real contextMenuHorizontalPadding: Math.round(6 * values.scaleFactor)
|
||||
|
||||
property real inputHorizontalPadding: Math.round(4 * values.scaleFactor)
|
||||
|
||||
@@ -87,7 +87,7 @@ QtObject {
|
||||
property string themePanelBackground: "#2a2a2a"
|
||||
property string themeHoverHighlight: "#313131"
|
||||
property string themeColumnBackground: "#363636"
|
||||
property string themeFocusEdit: "#606060"
|
||||
property string themeFocusEdit: "#444444"
|
||||
property string themeFocusDrag: "#565656"
|
||||
|
||||
property string themeControlBackgroundPressed: "#606060"
|
||||
|
||||
Regular → Executable
@@ -49,7 +49,7 @@
|
||||
{
|
||||
"trKey": "CMake",
|
||||
"value": "cmake",
|
||||
"condition": "%{JS: value('Plugins).indexOf('CMakeProjectManager') >= 0}"
|
||||
"condition": "%{JS: value('Plugins').indexOf('CMakeProjectManager') >= 0}"
|
||||
},
|
||||
{
|
||||
"trKey": "Qbs",
|
||||
|
||||
@@ -11,7 +11,6 @@ add_qtc_library(ClangSupport
|
||||
annotationsmessage.cpp annotationsmessage.h
|
||||
baseserverproxy.cpp baseserverproxy.h
|
||||
cancelmessage.cpp cancelmessage.h
|
||||
changedfilepathcompressor.h
|
||||
clangcodemodelclientinterface.cpp clangcodemodelclientinterface.h
|
||||
clangcodemodelclientmessages.h
|
||||
clangcodemodelclientproxy.cpp clangcodemodelclientproxy.h
|
||||
@@ -36,6 +35,8 @@ add_qtc_library(ClangSupport
|
||||
connectionclient.cpp connectionclient.h
|
||||
connectionserver.cpp connectionserver.h
|
||||
diagnosticcontainer.cpp diagnosticcontainer.h
|
||||
directoryandfilepathid.h
|
||||
directorypathid.h
|
||||
documentschangedmessage.cpp documentschangedmessage.h
|
||||
documentsclosedmessage.cpp documentsclosedmessage.h
|
||||
documentsopenedmessage.cpp documentsopenedmessage.h
|
||||
@@ -61,6 +62,10 @@ add_qtc_library(ClangSupport
|
||||
filepathstoragesources.h
|
||||
filepathstoragesqlitestatementfactory.h
|
||||
filepathview.h
|
||||
filestatus.h
|
||||
filestatuscache.cpp filestatuscache.h
|
||||
filesystem.cpp filesystem.h
|
||||
filesysteminterface.h
|
||||
fixitcontainer.cpp fixitcontainer.h
|
||||
followsymbolmessage.cpp followsymbolmessage.h
|
||||
generatedfiles.cpp generatedfiles.h
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
; /****************************************************************************
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
@@ -57,7 +57,7 @@ void set_greedy_intersection_call(
|
||||
class WatcherEntry
|
||||
{
|
||||
public:
|
||||
ProjectPartId id;
|
||||
ProjectChunkId id;
|
||||
DirectoryPathId directoryPathId;
|
||||
FilePathId filePathId;
|
||||
long long lastModified = -1;
|
||||
@@ -98,9 +98,9 @@ public:
|
||||
ClangPathWatcher(FilePathCachingInterface &pathCache,
|
||||
FileSystemInterface &fileSystem,
|
||||
ClangPathWatcherNotifier *notifier = nullptr)
|
||||
: m_pathCache(pathCache)
|
||||
, m_fileStatusCache(fileSystem)
|
||||
: m_fileStatusCache(fileSystem)
|
||||
, m_fileSystem(fileSystem)
|
||||
, m_pathCache(pathCache)
|
||||
, m_notifier(notifier)
|
||||
{
|
||||
QObject::connect(&m_fileSystemWatcher,
|
||||
@@ -140,25 +140,6 @@ public:
|
||||
m_notifier = notifier;
|
||||
}
|
||||
|
||||
static std::vector<uint> idsFromIdPaths(const std::vector<IdPaths> &idPaths)
|
||||
{
|
||||
std::vector<uint> ids;
|
||||
ids.reserve(idPaths.size());
|
||||
|
||||
auto extractId = [] (const IdPaths &idPath) {
|
||||
return idPath.id;
|
||||
};
|
||||
|
||||
std::transform(idPaths.begin(),
|
||||
idPaths.end(),
|
||||
std::back_inserter(ids),
|
||||
extractId);
|
||||
|
||||
std::sort(ids.begin(), ids.end());
|
||||
|
||||
return ids;
|
||||
}
|
||||
|
||||
std::size_t sizeOfIdPaths(const std::vector<IdPaths> &idPaths)
|
||||
{
|
||||
auto sumSize = [] (std::size_t size, const IdPaths &idPath) {
|
||||
@@ -168,19 +149,19 @@ public:
|
||||
return std::accumulate(idPaths.begin(), idPaths.end(), std::size_t(0), sumSize);
|
||||
}
|
||||
|
||||
std::pair<WatcherEntries, ProjectPartIds> convertIdPathsToWatcherEntriesAndIds(
|
||||
std::pair<WatcherEntries, ProjectChunkIds> convertIdPathsToWatcherEntriesAndIds(
|
||||
const std::vector<IdPaths> &idPaths)
|
||||
{
|
||||
WatcherEntries entries;
|
||||
entries.reserve(sizeOfIdPaths(idPaths));
|
||||
ProjectPartIds ids;
|
||||
ProjectChunkIds ids;
|
||||
ids.reserve(ids.size());
|
||||
|
||||
auto outputIterator = std::back_inserter(entries);
|
||||
|
||||
for (const IdPaths &idPath : idPaths)
|
||||
{
|
||||
ProjectPartId id = idPath.id;
|
||||
ProjectChunkId id = idPath.id;
|
||||
|
||||
ids.push_back(id);
|
||||
|
||||
@@ -214,7 +195,7 @@ public:
|
||||
m_fileSystemWatcher.addPaths(convertWatcherEntriesToDirectoryPathList(filteredPaths));
|
||||
}
|
||||
|
||||
void removeUnusedEntries(const WatcherEntries &entries, const ProjectPartIds &ids)
|
||||
void removeUnusedEntries(const WatcherEntries &entries, const ProjectChunkIds &ids)
|
||||
{
|
||||
auto oldEntries = notAnymoreWatchedEntriesWithIds(entries, ids);
|
||||
|
||||
@@ -294,7 +275,7 @@ public:
|
||||
}
|
||||
|
||||
WatcherEntries notAnymoreWatchedEntriesWithIds(const WatcherEntries &newEntries,
|
||||
const ProjectPartIds &ids) const
|
||||
const ProjectChunkIds &ids) const
|
||||
{
|
||||
auto oldEntries = notAnymoreWatchedEntries(newEntries, std::less<WatcherEntry>());
|
||||
|
||||
@@ -420,25 +401,22 @@ public:
|
||||
return filePathIds;
|
||||
}
|
||||
|
||||
ProjectPartIds idsForWatcherEntries(const WatcherEntries &foundEntries)
|
||||
std::vector<IdPaths> idPathsForWatcherEntries(WatcherEntries &&foundEntries)
|
||||
{
|
||||
ProjectPartIds ids;
|
||||
ids.reserve(foundEntries.size());
|
||||
std::sort(foundEntries.begin(), foundEntries.end(), [](WatcherEntry first, WatcherEntry second) {
|
||||
return std::tie(first.id, first.filePathId) < std::tie(second.id, second.filePathId);
|
||||
});
|
||||
|
||||
std::transform(foundEntries.begin(),
|
||||
foundEntries.end(),
|
||||
std::back_inserter(ids),
|
||||
[&](WatcherEntry entry) { return entry.id; });
|
||||
std::vector<IdPaths> idPaths;
|
||||
idPaths.reserve(foundEntries.size());
|
||||
|
||||
return ids;
|
||||
}
|
||||
for (WatcherEntry entry : foundEntries) {
|
||||
if (idPaths.empty() || idPaths.back().id != entry.id)
|
||||
idPaths.push_back({entry.id, {}});
|
||||
idPaths.back().filePathIds.push_back(entry.filePathId);
|
||||
}
|
||||
|
||||
ProjectPartIds uniqueIds(ProjectPartIds &&ids)
|
||||
{
|
||||
std::sort(ids.begin(), ids.end());
|
||||
ids.erase(std::unique(ids.begin(), ids.end()), ids.end());
|
||||
|
||||
return std::move(ids);
|
||||
return idPaths;
|
||||
}
|
||||
|
||||
void addChangedPathForFilePath(DirectoryPathIds &&directoryPathIds)
|
||||
@@ -446,10 +424,12 @@ public:
|
||||
if (m_notifier) {
|
||||
WatcherEntries foundEntries = watchedEntriesForPaths(std::move(directoryPathIds));
|
||||
|
||||
ProjectPartIds changedIds = idsForWatcherEntries(foundEntries);
|
||||
FilePathIds watchedFilePathIds = watchedPaths(foundEntries);
|
||||
|
||||
m_notifier->pathsWithIdsChanged(uniqueIds(std::move(changedIds)));
|
||||
m_notifier->pathsChanged(watchedPaths(foundEntries));
|
||||
std::vector<IdPaths> changedIdPaths = idPathsForWatcherEntries(std::move(foundEntries));
|
||||
|
||||
m_notifier->pathsChanged(watchedFilePathIds);
|
||||
m_notifier->pathsWithIdsChanged(changedIdPaths);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,9 +26,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "clangsupport_global.h"
|
||||
|
||||
#include <filepathid.h>
|
||||
#include <projectpartid.h>
|
||||
#include "filepathid.h"
|
||||
#include "idpaths.h"
|
||||
|
||||
#include <utils/smallstringvector.h>
|
||||
|
||||
@@ -41,7 +40,7 @@ public:
|
||||
ClangPathWatcherNotifier(const ClangPathWatcherNotifier &) = delete;
|
||||
ClangPathWatcherNotifier &operator=(const ClangPathWatcherNotifier &) = delete;
|
||||
|
||||
virtual void pathsWithIdsChanged(const ProjectPartIds &ids) = 0;
|
||||
virtual void pathsWithIdsChanged(const std::vector<IdPaths> &idPaths) = 0;
|
||||
virtual void pathsChanged(const FilePathIds &filePathIds) = 0;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -27,6 +27,5 @@
|
||||
|
||||
#include "alivemessage.h"
|
||||
#include "progressmessage.h"
|
||||
#include "sourcelocationsforrenamingmessage.h"
|
||||
#include "sourcerangesanddiagnosticsforquerymessage.h"
|
||||
#include "sourcerangesforquerymessage.h"
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
|
||||
#include "cancelmessage.h"
|
||||
#include "endmessage.h"
|
||||
#include "requestsourcelocationforrenamingmessage.h"
|
||||
#include "requestsourcerangesanddiagnosticsforquerymessage.h"
|
||||
#include "requestsourcerangesforquerymessage.h"
|
||||
#include "removegeneratedfilesmessage.h"
|
||||
|
||||
@@ -56,14 +56,12 @@ SOURCES += \
|
||||
$$PWD/requestannotationsmessage.cpp \
|
||||
$$PWD/requestfollowsymbolmessage.cpp \
|
||||
$$PWD/requestreferencesmessage.cpp \
|
||||
$$PWD/requestsourcelocationforrenamingmessage.cpp \
|
||||
$$PWD/requestsourcerangesanddiagnosticsforquerymessage.cpp \
|
||||
$$PWD/requestsourcerangesforquerymessage.cpp \
|
||||
$$PWD/requesttooltipmessage.cpp \
|
||||
$$PWD/sourcelocationcontainer.cpp \
|
||||
$$PWD/sourcelocationcontainerv2.cpp \
|
||||
$$PWD/sourcelocationscontainer.cpp \
|
||||
$$PWD/sourcelocationsforrenamingmessage.cpp \
|
||||
$$PWD/sourcerangecontainer.cpp \
|
||||
$$PWD/processcreator.cpp \
|
||||
$$PWD/processexception.cpp \
|
||||
@@ -163,14 +161,12 @@ HEADERS += \
|
||||
$$PWD/requestannotationsmessage.h \
|
||||
$$PWD/requestfollowsymbolmessage.h \
|
||||
$$PWD/requestreferencesmessage.h \
|
||||
$$PWD/requestsourcelocationforrenamingmessage.h \
|
||||
$$PWD/requestsourcerangesanddiagnosticsforquerymessage.h \
|
||||
$$PWD/requestsourcerangesforquerymessage.h \
|
||||
$$PWD/requesttooltipmessage.h \
|
||||
$$PWD/sourcelocationcontainer.h \
|
||||
$$PWD/sourcelocationcontainerv2.h \
|
||||
$$PWD/sourcelocationscontainer.h \
|
||||
$$PWD/sourcelocationsforrenamingmessage.h \
|
||||
$$PWD/sourcerangecontainer.h \
|
||||
$$PWD/filepath.h \
|
||||
$$PWD/processcreator.h \
|
||||
|
||||
@@ -25,21 +25,60 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "projectpartid.h"
|
||||
#include "filepathid.h"
|
||||
#include "projectpartid.h"
|
||||
#include "sourceentry.h"
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
class ProjectChunkId
|
||||
{
|
||||
public:
|
||||
ProjectPartId id;
|
||||
SourceType sourceType;
|
||||
|
||||
friend bool operator==(ProjectChunkId first, ProjectChunkId second)
|
||||
{
|
||||
return first.id == second.id && first.sourceType == second.sourceType;
|
||||
}
|
||||
|
||||
friend bool operator==(ProjectChunkId first, ProjectPartId second)
|
||||
{
|
||||
return first.id == second;
|
||||
}
|
||||
|
||||
friend bool operator==(ProjectPartId first, ProjectChunkId second)
|
||||
{
|
||||
return first == second.id;
|
||||
}
|
||||
|
||||
friend bool operator!=(ProjectChunkId first, ProjectChunkId second)
|
||||
{
|
||||
return !(first == second);
|
||||
}
|
||||
|
||||
friend bool operator<(ProjectChunkId first, ProjectChunkId second)
|
||||
{
|
||||
return std::tie(first.id, first.sourceType) < std::tie(second.id, second.sourceType);
|
||||
}
|
||||
|
||||
friend bool operator<(ProjectChunkId first, ProjectPartId second) { return first.id < second; }
|
||||
|
||||
friend bool operator<(ProjectPartId first, ProjectChunkId second) { return first < second.id; }
|
||||
};
|
||||
|
||||
class IdPaths
|
||||
{
|
||||
public:
|
||||
ProjectPartId id;
|
||||
ProjectChunkId id;
|
||||
FilePathIds filePathIds;
|
||||
|
||||
friend bool operator==(const IdPaths &first, const IdPaths &second)
|
||||
friend bool operator==(IdPaths first, IdPaths second)
|
||||
{
|
||||
return first.id == second.id && first.filePathIds == second.filePathIds;
|
||||
}
|
||||
};
|
||||
|
||||
using ProjectChunkIds = std::vector<ProjectChunkId>;
|
||||
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "clangsupport_global.h"
|
||||
#include "filepathid.h"
|
||||
#include "projectpartid.h"
|
||||
|
||||
#include <utils/smallstringio.h>
|
||||
@@ -37,6 +38,7 @@ class PrecompiledHeadersUpdatedMessage
|
||||
public:
|
||||
PrecompiledHeadersUpdatedMessage() = default;
|
||||
PrecompiledHeadersUpdatedMessage(ProjectPartId projectPartId)
|
||||
|
||||
{
|
||||
projectPartIds.push_back(projectPartId);
|
||||
}
|
||||
|
||||
@@ -38,9 +38,6 @@ void RefactoringClientInterface::dispatch(const MessageEnvelop &messageEnvelop)
|
||||
case MessageType::AliveMessage:
|
||||
alive();
|
||||
break;
|
||||
case MessageType::SourceLocationsForRenamingMessage:
|
||||
sourceLocationsForRenamingMessage(messageEnvelop.message<SourceLocationsForRenamingMessage>());
|
||||
break;
|
||||
case MessageType::SourceRangesAndDiagnosticsForQueryMessage:
|
||||
sourceRangesAndDiagnosticsForQueryMessage(messageEnvelop.message<SourceRangesAndDiagnosticsForQueryMessage>());
|
||||
break;
|
||||
|
||||
@@ -47,10 +47,8 @@ public:
|
||||
void dispatch(const MessageEnvelop &messageEnvelop) override;
|
||||
|
||||
virtual void alive() = 0;
|
||||
virtual void sourceLocationsForRenamingMessage(SourceLocationsForRenamingMessage &&message) = 0;
|
||||
virtual void sourceRangesAndDiagnosticsForQueryMessage(SourceRangesAndDiagnosticsForQueryMessage &&message) = 0;
|
||||
virtual void sourceRangesForQueryMessage(SourceRangesForQueryMessage &&message) = 0;
|
||||
virtual void setLocalRenamingCallback(RenameCallback &&localRenamingCallback) = 0;
|
||||
virtual void progress(ProgressMessage &&message) = 0;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -66,11 +66,6 @@ void RefactoringClientProxy::alive()
|
||||
writeMessageBlock.write(AliveMessage());
|
||||
}
|
||||
|
||||
void RefactoringClientProxy::sourceLocationsForRenamingMessage(SourceLocationsForRenamingMessage &&message)
|
||||
{
|
||||
writeMessageBlock.write(message);
|
||||
}
|
||||
|
||||
void RefactoringClientProxy::sourceRangesAndDiagnosticsForQueryMessage(SourceRangesAndDiagnosticsForQueryMessage &&message)
|
||||
{
|
||||
writeMessageBlock.write(message);
|
||||
|
||||
@@ -50,13 +50,10 @@ public:
|
||||
void readMessages();
|
||||
|
||||
void alive() override;
|
||||
void sourceLocationsForRenamingMessage(SourceLocationsForRenamingMessage &&message) override;
|
||||
void sourceRangesAndDiagnosticsForQueryMessage(SourceRangesAndDiagnosticsForQueryMessage &&message) override;
|
||||
void sourceRangesForQueryMessage(SourceRangesForQueryMessage &&message) override;
|
||||
void progress(ProgressMessage &&message) override;
|
||||
|
||||
void setLocalRenamingCallback(RenameCallback &&) final {}
|
||||
|
||||
private:
|
||||
ClangBackEnd::WriteMessageBlock writeMessageBlock;
|
||||
ClangBackEnd::ReadMessageBlock readMessageBlock;
|
||||
|
||||
@@ -38,9 +38,6 @@ void RefactoringServerInterface::dispatch(const MessageEnvelop &messageEnvelop)
|
||||
case MessageType::EndMessage:
|
||||
end();
|
||||
break;
|
||||
case MessageType::RequestSourceLocationsForRenamingMessage:
|
||||
requestSourceLocationsForRenamingMessage(messageEnvelop.message<RequestSourceLocationsForRenamingMessage>());
|
||||
break;
|
||||
case MessageType::RequestSourceRangesAndDiagnosticsForQueryMessage:
|
||||
requestSourceRangesAndDiagnosticsForQueryMessage(messageEnvelop.message<RequestSourceRangesAndDiagnosticsForQueryMessage>());
|
||||
break;
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
namespace ClangBackEnd {
|
||||
|
||||
class RefactoringClientInterface;
|
||||
class RequestSourceLocationsForRenamingMessage;
|
||||
class RequestSourceRangesAndDiagnosticsForQueryMessage;
|
||||
class RequestSourceRangesForQueryMessage;
|
||||
class CancelMessage;
|
||||
@@ -46,7 +45,6 @@ public:
|
||||
void dispatch(const MessageEnvelop &messageEnvelop) override;
|
||||
|
||||
virtual void end() = 0;
|
||||
virtual void requestSourceLocationsForRenamingMessage(RequestSourceLocationsForRenamingMessage &&message) = 0;
|
||||
virtual void requestSourceRangesAndDiagnosticsForQueryMessage(RequestSourceRangesAndDiagnosticsForQueryMessage &&message) = 0;
|
||||
virtual void requestSourceRangesForQueryMessage(RequestSourceRangesForQueryMessage &&message) = 0;
|
||||
virtual void cancel() = 0;
|
||||
|
||||
@@ -50,11 +50,6 @@ void RefactoringServerProxy::end()
|
||||
m_writeMessageBlock.write(EndMessage());
|
||||
}
|
||||
|
||||
void RefactoringServerProxy::requestSourceLocationsForRenamingMessage(RequestSourceLocationsForRenamingMessage &&message)
|
||||
{
|
||||
m_writeMessageBlock.write(message);
|
||||
}
|
||||
|
||||
void RefactoringServerProxy::requestSourceRangesAndDiagnosticsForQueryMessage(RequestSourceRangesAndDiagnosticsForQueryMessage &&message)
|
||||
{
|
||||
m_writeMessageBlock.write(message);
|
||||
|
||||
@@ -52,7 +52,6 @@ public:
|
||||
explicit RefactoringServerProxy(RefactoringClientInterface *client, QIODevice *ioDevice);
|
||||
|
||||
void end() override;
|
||||
void requestSourceLocationsForRenamingMessage(RequestSourceLocationsForRenamingMessage &&message) override;
|
||||
void requestSourceRangesAndDiagnosticsForQueryMessage(RequestSourceRangesAndDiagnosticsForQueryMessage &&message) override;
|
||||
void requestSourceRangesForQueryMessage(RequestSourceRangesForQueryMessage &&message) override;
|
||||
void updateProjectParts(UpdateProjectPartsMessage &&message) override;
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 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.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "requestsourcelocationforrenamingmessage.h"
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
QDebug operator<<(QDebug debug, const RequestSourceLocationsForRenamingMessage &message)
|
||||
{
|
||||
debug.nospace() << "RequestSourceLocationsForRenamingMessage("
|
||||
<< message.filePath << ", "
|
||||
<< message.line << ", "
|
||||
<< message.column << ", "
|
||||
<< message.unsavedContent << ")";
|
||||
|
||||
return debug;
|
||||
}
|
||||
|
||||
} // namespace ClangBackEnd
|
||||
@@ -1,108 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 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.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "clangsupport_global.h"
|
||||
#include "filepath.h"
|
||||
|
||||
#include <utils/smallstringvector.h>
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
class CLANGSUPPORT_EXPORT RequestSourceLocationsForRenamingMessage
|
||||
{
|
||||
public:
|
||||
RequestSourceLocationsForRenamingMessage() = default;
|
||||
RequestSourceLocationsForRenamingMessage(FilePath &&filePath,
|
||||
uint line,
|
||||
uint column,
|
||||
Utils::SmallString &&unsavedContent,
|
||||
Utils::SmallStringVector &&commandLine,
|
||||
int textDocumentRevision)
|
||||
: filePath(std::move(filePath)),
|
||||
unsavedContent(std::move(unsavedContent)),
|
||||
commandLine(std::move(commandLine)),
|
||||
line(line),
|
||||
column(column),
|
||||
textDocumentRevision(textDocumentRevision)
|
||||
{}
|
||||
|
||||
friend QDataStream &operator<<(QDataStream &out, const RequestSourceLocationsForRenamingMessage &message)
|
||||
{
|
||||
out << message.filePath;
|
||||
out << message.unsavedContent;
|
||||
out << message.commandLine;
|
||||
out << message.line;
|
||||
out << message.column;
|
||||
out << message.textDocumentRevision;
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
friend QDataStream &operator>>(QDataStream &in, RequestSourceLocationsForRenamingMessage &message)
|
||||
{
|
||||
in >> message.filePath;
|
||||
in >> message.unsavedContent;
|
||||
in >> message.commandLine;
|
||||
in >> message.line;
|
||||
in >> message.column;
|
||||
in >> message.textDocumentRevision;
|
||||
|
||||
return in;
|
||||
}
|
||||
|
||||
friend bool operator==(const RequestSourceLocationsForRenamingMessage &first, const RequestSourceLocationsForRenamingMessage &second)
|
||||
{
|
||||
return first.filePath == second.filePath
|
||||
&& first.line == second.line
|
||||
&& first.column == second.column
|
||||
&& first.textDocumentRevision == second.textDocumentRevision
|
||||
&& first.unsavedContent == second.unsavedContent
|
||||
&& first.commandLine == second.commandLine;
|
||||
}
|
||||
|
||||
RequestSourceLocationsForRenamingMessage clone() const
|
||||
{
|
||||
return RequestSourceLocationsForRenamingMessage(filePath.clone(),
|
||||
line, column,
|
||||
unsavedContent.clone(),
|
||||
commandLine.clone(),
|
||||
textDocumentRevision);
|
||||
}
|
||||
|
||||
public:
|
||||
FilePath filePath;
|
||||
Utils::SmallString unsavedContent;
|
||||
Utils::SmallStringVector commandLine;
|
||||
uint line = 1;
|
||||
uint column = 1;
|
||||
int textDocumentRevision = 1;
|
||||
};
|
||||
|
||||
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const RequestSourceLocationsForRenamingMessage &message);
|
||||
|
||||
DECLARE_MESSAGE(RequestSourceLocationsForRenamingMessage)
|
||||
} // namespace ClangBackEnd
|
||||
@@ -1,39 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 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.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "sourcelocationsforrenamingmessage.h"
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
QDebug operator<<(QDebug debug, const SourceLocationsForRenamingMessage &message)
|
||||
{
|
||||
debug.nospace() << "SourceLocationsForRenamingMessage("
|
||||
<< message.sourceLocations
|
||||
<< ")";
|
||||
|
||||
return debug;
|
||||
}
|
||||
|
||||
} // namespace ClangBackEnd
|
||||
@@ -1,87 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 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.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "sourcelocationscontainer.h"
|
||||
|
||||
#include <utils/smallstring.h>
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
class SourceLocationsForRenamingMessage
|
||||
{
|
||||
public:
|
||||
SourceLocationsForRenamingMessage() = default;
|
||||
SourceLocationsForRenamingMessage(Utils::SmallString &&symbolName,
|
||||
SourceLocationsContainer &&sourceLocationContainer,
|
||||
int textDocumentRevision)
|
||||
: symbolName(std::move(symbolName)),
|
||||
sourceLocations(std::move(sourceLocationContainer)),
|
||||
textDocumentRevision(textDocumentRevision)
|
||||
{}
|
||||
|
||||
friend QDataStream &operator<<(QDataStream &out, const SourceLocationsForRenamingMessage &message)
|
||||
{
|
||||
out << message.symbolName;
|
||||
out << message.sourceLocations;
|
||||
out << message.textDocumentRevision;
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
friend QDataStream &operator>>(QDataStream &in, SourceLocationsForRenamingMessage &message)
|
||||
{
|
||||
in >> message.symbolName;
|
||||
in >> message.sourceLocations;
|
||||
in >> message.textDocumentRevision;
|
||||
|
||||
return in;
|
||||
}
|
||||
|
||||
friend bool operator==(const SourceLocationsForRenamingMessage &first, const SourceLocationsForRenamingMessage &second)
|
||||
{
|
||||
return first.textDocumentRevision == second.textDocumentRevision
|
||||
&& first.symbolName == second.symbolName
|
||||
&& first.sourceLocations == second.sourceLocations;
|
||||
}
|
||||
|
||||
SourceLocationsForRenamingMessage clone() const
|
||||
{
|
||||
return SourceLocationsForRenamingMessage(symbolName.clone(),
|
||||
sourceLocations.clone(),
|
||||
textDocumentRevision);
|
||||
}
|
||||
|
||||
public:
|
||||
Utils::SmallString symbolName;
|
||||
SourceLocationsContainer sourceLocations;
|
||||
int textDocumentRevision = 0;
|
||||
};
|
||||
|
||||
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const SourceLocationsForRenamingMessage &message);
|
||||
|
||||
DECLARE_MESSAGE(SourceLocationsForRenamingMessage)
|
||||
} // namespace ClangBackEnd
|
||||
@@ -37,6 +37,8 @@
|
||||
#include <cplusplus/Scope.h>
|
||||
#include <cplusplus/Control.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
#include <QStack>
|
||||
#include <QHash>
|
||||
#include <QVarLengthArray>
|
||||
@@ -1175,7 +1177,7 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name,
|
||||
if (!name->isTemplateNameId())
|
||||
_alreadyConsideredClasses.insert(referenceClass);
|
||||
|
||||
QSet<ClassOrNamespace *> knownUsings = reference->usings().toSet();
|
||||
QSet<ClassOrNamespace *> knownUsings = Utils::toSet(reference->usings());
|
||||
|
||||
// If we are dealling with a template type, more work is required, since we need to
|
||||
// construct all instantiation data.
|
||||
|
||||
@@ -50,6 +50,8 @@
|
||||
#include "qmt/tasks/diagramscenecontroller.h"
|
||||
#include "qmt/tasks/ielementtasks.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
#include <QSet>
|
||||
#include <QGraphicsItem>
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
@@ -514,8 +516,8 @@ bool DiagramSceneModel::exportSvg(const QString &fileName, bool selectedElements
|
||||
|
||||
return true;
|
||||
#else // QT_NO_SVG
|
||||
Q_UNUSED(fileName);
|
||||
Q_UNUSED(selectedElements);
|
||||
Q_UNUSED(fileName)
|
||||
Q_UNUSED(selectedElements)
|
||||
return false;
|
||||
#endif // QT_NO_SVG
|
||||
}
|
||||
@@ -639,7 +641,7 @@ void DiagramSceneModel::keyReleaseEvent(QKeyEvent *event)
|
||||
|
||||
void DiagramSceneModel::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
updateFocusItem(QSet<QGraphicsItem *>::fromList(m_graphicsScene->selectedItems()));
|
||||
updateFocusItem(Utils::toSet(m_graphicsScene->selectedItems()));
|
||||
m_latchController->mousePressEventLatching(event);
|
||||
mousePressEventReparenting(event);
|
||||
}
|
||||
@@ -681,7 +683,7 @@ void DiagramSceneModel::mouseReleaseEventReparenting(QGraphicsSceneMouseEvent *e
|
||||
if (event->modifiers() & Qt::AltModifier) {
|
||||
ModelController *modelController = diagramController()->modelController();
|
||||
MPackage *newOwner = nullptr;
|
||||
QSet<QGraphicsItem *> selectedItemSet = m_graphicsScene->selectedItems().toSet();
|
||||
QSet<QGraphicsItem *> selectedItemSet = Utils::toSet(m_graphicsScene->selectedItems());
|
||||
QList<QGraphicsItem *> itemsUnderMouse = m_graphicsScene->items(event->scenePos());
|
||||
foreach (QGraphicsItem *item, itemsUnderMouse) {
|
||||
if (!selectedItemSet.contains(item)) {
|
||||
@@ -840,7 +842,7 @@ void DiagramSceneModel::onSelectionChanged()
|
||||
bool selectionChanged = false;
|
||||
|
||||
// collect and update all primary selected items (selected by user)
|
||||
QSet<QGraphicsItem *> newSelectedItems = QSet<QGraphicsItem *>::fromList(m_graphicsScene->selectedItems());
|
||||
QSet<QGraphicsItem *> newSelectedItems = Utils::toSet(m_graphicsScene->selectedItems());
|
||||
updateFocusItem(newSelectedItems);
|
||||
foreach (QGraphicsItem *item, m_selectedItems) {
|
||||
if (!newSelectedItems.contains(item)) {
|
||||
|
||||
@@ -52,6 +52,8 @@
|
||||
#include "qmt/tasks/diagramscenecontroller.h"
|
||||
#include "qmt/tasks/ielementtasks.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
#include <QGraphicsScene>
|
||||
#include <QGraphicsRectItem>
|
||||
#include <QGraphicsSimpleTextItem>
|
||||
@@ -346,7 +348,7 @@ void ClassItem::relationDrawn(const QString &id, ObjectItem *targetItem, const Q
|
||||
{ CustomRelation::Relationship::Aggregation, MAssociationEnd::Aggregation },
|
||||
{ CustomRelation::Relationship::Composition, MAssociationEnd::Composition } };
|
||||
diagramSceneController->modelController()->startUpdateRelation(mAssociation);
|
||||
mAssociation->setStereotypes(customRelation.stereotypes().toList());
|
||||
mAssociation->setStereotypes(Utils::toList(customRelation.stereotypes()));
|
||||
mAssociation->setName(customRelation.name());
|
||||
MAssociationEnd endA;
|
||||
endA.setCardinality(customRelation.endA().cardinality());
|
||||
|
||||
@@ -130,7 +130,7 @@ QList<QString> StereotypeController::knownStereotypes(StereotypeIcon::Element st
|
||||
if (icon.elements().isEmpty() || icon.elements().contains(stereotypeElement))
|
||||
stereotypes += icon.stereotypes();
|
||||
}
|
||||
QList<QString> list = stereotypes.toList();
|
||||
QList<QString> list = Utils::toList(stereotypes);
|
||||
std::sort(list.begin(), list.end());
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
#include <QTcpServer>
|
||||
#include <QTcpSocket>
|
||||
|
||||
Q_DECLARE_METATYPE(QLocalSocket::LocalSocketError)
|
||||
|
||||
namespace QmlDebug {
|
||||
|
||||
const int protocolVersion = 1;
|
||||
@@ -244,6 +246,11 @@ void QmlDebugConnection::protocolReadyRead()
|
||||
QmlDebugConnection::QmlDebugConnection(QObject *parent)
|
||||
: QObject(parent), d_ptr(new QmlDebugConnectionPrivate)
|
||||
{
|
||||
static const int metaTypes[] = {
|
||||
qRegisterMetaType<QAbstractSocket::SocketError>(),
|
||||
qRegisterMetaType<QLocalSocket::LocalSocketError>()
|
||||
};
|
||||
Q_UNUSED(metaTypes);
|
||||
}
|
||||
|
||||
QmlDebugConnection::~QmlDebugConnection()
|
||||
@@ -343,9 +350,10 @@ void QmlDebugConnection::connectToHost(const QString &hostName, quint16 port)
|
||||
this, [this](QAbstractSocket::SocketError error) {
|
||||
emit logError(socketErrorToString(error));
|
||||
socketDisconnected();
|
||||
});
|
||||
}, Qt::QueuedConnection);
|
||||
connect(socket, &QAbstractSocket::connected, this, &QmlDebugConnection::socketConnected);
|
||||
connect(socket, &QAbstractSocket::disconnected, this, &QmlDebugConnection::socketDisconnected);
|
||||
connect(socket, &QAbstractSocket::disconnected, this, &QmlDebugConnection::socketDisconnected,
|
||||
Qt::QueuedConnection);
|
||||
socket->connectToHost(hostName.isEmpty() ? QString("localhost") : hostName, port);
|
||||
}
|
||||
|
||||
@@ -376,13 +384,14 @@ void QmlDebugConnection::newConnection()
|
||||
QObject::connect(d->protocol, &QPacketProtocol::readyRead,
|
||||
this, &QmlDebugConnection::protocolReadyRead);
|
||||
|
||||
connect(socket, &QLocalSocket::disconnected, this, &QmlDebugConnection::socketDisconnected);
|
||||
connect(socket, &QLocalSocket::disconnected, this, &QmlDebugConnection::socketDisconnected,
|
||||
Qt::QueuedConnection);
|
||||
|
||||
connect(socket, QOverload<QLocalSocket::LocalSocketError>::of(&QLocalSocket::error),
|
||||
this, [this](QLocalSocket::LocalSocketError error) {
|
||||
emit logError(socketErrorToString(static_cast<QAbstractSocket::SocketError>(error)));
|
||||
socketDisconnected();
|
||||
});
|
||||
}, Qt::QueuedConnection);
|
||||
|
||||
connect(socket, &QLocalSocket::stateChanged,
|
||||
this, [this](QLocalSocket::LocalSocketState state) {
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "qmljsutils.h"
|
||||
#include "parser/qmljsast_p.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QColor>
|
||||
@@ -666,7 +667,7 @@ Check::Check(Document::Ptr doc, const ContextPtr &context)
|
||||
_isQtQuick2 = isQtQuick2();
|
||||
}
|
||||
|
||||
_enabledMessages = Message::allMessageTypes().toSet();
|
||||
_enabledMessages = Utils::toSet(Message::allMessageTypes());
|
||||
disableMessage(HintAnonymousFunctionSpacing);
|
||||
disableMessage(HintDeclareVarsInOneLine);
|
||||
disableMessage(HintDeclarationsShouldBeAtStartOfFunction);
|
||||
@@ -1539,7 +1540,7 @@ void Check::scanCommentsForAnnotations()
|
||||
|
||||
// enable all checks annotation
|
||||
if (comment.contains("@enable-all-checks"))
|
||||
_enabledMessages = Message::allMessageTypes().toSet();
|
||||
_enabledMessages = Utils::toSet(Message::allMessageTypes());
|
||||
|
||||
// find all disable annotations
|
||||
int lastOffset = -1;
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "qmljsinterpreter.h"
|
||||
#include "qmljsviewercontext.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/qrcparser.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
@@ -521,7 +522,7 @@ QByteArray DependencyInfo::calculateFingerprint(const ImportDependencies &deps)
|
||||
{
|
||||
QCryptographicHash hash(QCryptographicHash::Sha1);
|
||||
rootImport.addToHash(hash);
|
||||
QStringList coreImports = allCoreImports.toList();
|
||||
QStringList coreImports = Utils::toList(allCoreImports);
|
||||
coreImports.sort();
|
||||
foreach (const QString importId, coreImports) {
|
||||
hash.addData(reinterpret_cast<const char*>(importId.constData()), importId.size() * sizeof(QChar));
|
||||
@@ -529,9 +530,9 @@ QByteArray DependencyInfo::calculateFingerprint(const ImportDependencies &deps)
|
||||
hash.addData(coreImportFingerprint);
|
||||
}
|
||||
hash.addData("/", 1);
|
||||
QList<ImportKey> imports(allImports.toList());
|
||||
QList<ImportKey> imports = Utils::toList(allImports);
|
||||
std::sort(imports.begin(), imports.end());
|
||||
foreach (const ImportKey &k, imports)
|
||||
for (const ImportKey &k : qAsConst(imports))
|
||||
k.addToHash(hash);
|
||||
return hash.result();
|
||||
}
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
|
||||
#include <qmljs/qmljsinterpreter.h>
|
||||
#include <qmljs/qmljsviewercontext.h>
|
||||
//#include <projectexplorer/session.h>
|
||||
//#include <coreplugin/messagemanager.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/filesystemwatcher.h>
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
@@ -437,7 +437,7 @@ void PluginDumper::loadDependencies(const QStringList &dependencies,
|
||||
}
|
||||
QStringList newDependencies;
|
||||
loadQmlTypeDescription(dependenciesPaths, errors, warnings, objects, 0, &newDependencies);
|
||||
newDependencies = (newDependencies.toSet() - *visitedPtr).toList();
|
||||
newDependencies = Utils::toList(Utils::toSet(newDependencies) - *visitedPtr);
|
||||
if (!newDependencies.isEmpty())
|
||||
loadDependencies(newDependencies, errors, warnings, objects, visitedPtr.take());
|
||||
}
|
||||
|
||||
@@ -1259,4 +1259,27 @@ OutputIterator set_union(InputIterator1 first1,
|
||||
return Utils::set_union_impl(
|
||||
first1, last1, first2, last2, result, std::less<typename InputIterator1::value_type>{});
|
||||
}
|
||||
|
||||
// Replacement for deprecated Qt functionality
|
||||
|
||||
template <class T>
|
||||
QSet<T> toSet(const QList<T> &list)
|
||||
{
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
|
||||
return list.toSet();
|
||||
#else
|
||||
return QSet<T>(list.begin(), list.end());
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class T>
|
||||
QList<T> toList(const QSet<T> &set)
|
||||
{
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
|
||||
return set.toList();
|
||||
#else
|
||||
return QList<T>(set.begin(), set.end());
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace Utils
|
||||
|
||||
@@ -121,23 +121,23 @@ void writeQtIncludeSection(const QStringList &qt4,
|
||||
qt4Only.subtract(common);
|
||||
qt5Only.subtract(common);
|
||||
|
||||
qtSection(common.toList(), str);
|
||||
qtSection(Utils::toList(common), str);
|
||||
|
||||
if (!qt4Only.isEmpty() || !qt5Only.isEmpty()) {
|
||||
if (addQtVersionCheck)
|
||||
writeBeginQtVersionCheck(str);
|
||||
qtSection(qt5Only.toList(), str);
|
||||
qtSection(Utils::toList(qt5Only), str);
|
||||
if (addQtVersionCheck)
|
||||
str << QLatin1String("#else\n");
|
||||
qtSection(qt4Only.toList(), str);
|
||||
qtSection(Utils::toList(qt4Only), str);
|
||||
if (addQtVersionCheck)
|
||||
str << QLatin1String("#endif\n");
|
||||
}
|
||||
} else {
|
||||
if (!qt5Only.isEmpty()) // default to Qt5
|
||||
qtSection(qt5Only.toList(), str);
|
||||
qtSection(Utils::toList(qt5Only), str);
|
||||
else
|
||||
qtSection(qt4Only.toList(), str);
|
||||
qtSection(Utils::toList(qt4Only), str);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,16 +24,18 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "synchronousprocess.h"
|
||||
#include "qtcassert.h"
|
||||
#include "executeondestruction.h"
|
||||
#include "hostosinfo.h"
|
||||
#include "fileutils.h"
|
||||
#include "qtcassert.h"
|
||||
#include "qtcprocess.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QTimer>
|
||||
#include <QTextCodec>
|
||||
#include <QDir>
|
||||
#include <QLoggingCategory>
|
||||
#include <QMessageBox>
|
||||
#include <QTextCodec>
|
||||
#include <QThread>
|
||||
#include <QTimer>
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
@@ -82,6 +84,8 @@ enum { defaultMaxHangTimerCount = 10 };
|
||||
|
||||
namespace Utils {
|
||||
|
||||
Q_LOGGING_CATEGORY(processLog, "qtc.utils.synchronousprocess", QtWarningMsg);
|
||||
|
||||
// A special QProcess derivative allowing for terminal control.
|
||||
class TerminalControllingProcess : public QProcess {
|
||||
public:
|
||||
@@ -445,8 +449,10 @@ static bool isGuiThread()
|
||||
SynchronousProcessResponse SynchronousProcess::run(const CommandLine &cmd,
|
||||
const QByteArray &writeData)
|
||||
{
|
||||
if (debug)
|
||||
qDebug() << '>' << Q_FUNC_INFO << cmd.toUserOutput();
|
||||
qCDebug(processLog).noquote() << "Starting:" << cmd.toUserOutput();
|
||||
ExecuteOnDestruction logResult([this] {
|
||||
qCDebug(processLog) << d->m_result;
|
||||
});
|
||||
|
||||
d->clearForRun();
|
||||
|
||||
@@ -492,13 +498,16 @@ SynchronousProcessResponse SynchronousProcess::run(const CommandLine &cmd,
|
||||
QApplication::restoreOverrideCursor();
|
||||
}
|
||||
|
||||
if (debug)
|
||||
qDebug() << '<' << Q_FUNC_INFO << cmd.executable().toString() << d->m_result;
|
||||
return d->m_result;
|
||||
}
|
||||
|
||||
SynchronousProcessResponse SynchronousProcess::runBlocking(const CommandLine &cmd)
|
||||
{
|
||||
qCDebug(processLog).noquote() << "Starting blocking:" << cmd.toUserOutput();
|
||||
ExecuteOnDestruction logResult([this] {
|
||||
qCDebug(processLog) << d->m_result;
|
||||
});
|
||||
|
||||
d->clearForRun();
|
||||
|
||||
// On Windows, start failure is triggered immediately if the
|
||||
|
||||
@@ -82,15 +82,15 @@ static QStringList qtSoPaths(QtSupport::BaseQtVersion *qtVersion)
|
||||
paths.insert(it.fileInfo().absolutePath());
|
||||
}
|
||||
}
|
||||
return paths.toList();
|
||||
return Utils::toList(paths);
|
||||
}
|
||||
|
||||
static QStringList uniquePaths(const QStringList &files)
|
||||
{
|
||||
QSet<QString> paths;
|
||||
foreach (const QString &file, files)
|
||||
paths<<QFileInfo(file).absolutePath();
|
||||
return paths.toList();
|
||||
for (const QString &file : files)
|
||||
paths << QFileInfo(file).absolutePath();
|
||||
return Utils::toList(paths);
|
||||
}
|
||||
|
||||
static QStringList getSoLibSearchPath(const ProjectNode *node)
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
|
||||
#include <texteditor/texteditoractionhandler.h>
|
||||
#include <texteditor/texteditor.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/utilsicons.h>
|
||||
|
||||
@@ -924,7 +925,7 @@ void AndroidManifestEditorWidget::parseManifest(QXmlStreamReader &reader, QXmlSt
|
||||
QXmlStreamAttributes result = modifyXmlStreamAttributes(attributes, keys, values);
|
||||
writer.writeAttributes(result);
|
||||
|
||||
QSet<QString> permissions = m_permissionsModel->permissions().toSet();
|
||||
QSet<QString> permissions = Utils::toSet(m_permissionsModel->permissions());
|
||||
|
||||
bool foundUsesSdk = false;
|
||||
bool foundPermissionComment = false;
|
||||
|
||||
@@ -306,7 +306,7 @@ void AndroidSdkModel::selectMissingEssentials()
|
||||
|
||||
QList<const AndroidSdkPackage *> AndroidSdkModel::userSelection() const
|
||||
{
|
||||
return m_changeState.toList();
|
||||
return Utils::toList(m_changeState);
|
||||
}
|
||||
|
||||
void AndroidSdkModel::resetSelection()
|
||||
|
||||
@@ -58,18 +58,18 @@ QStringList filterInterfering(const QStringList &provided, QStringList *omitted)
|
||||
"--gtest_print_time="
|
||||
};
|
||||
|
||||
QSet<QString> allowed = Utils::filtered(provided.toSet(), [] (const QString &arg) {
|
||||
QSet<QString> allowed = Utils::filtered(Utils::toSet(provided), [] (const QString &arg) {
|
||||
return Utils::allOf(knownInterferingOptions, [&arg] (const QString &interfering) {
|
||||
return !arg.startsWith(interfering);
|
||||
});
|
||||
});
|
||||
|
||||
if (omitted) {
|
||||
QSet<QString> providedSet = provided.toSet();
|
||||
QSet<QString> providedSet = Utils::toSet(provided);
|
||||
providedSet.subtract(allowed);
|
||||
omitted->append(providedSet.toList());
|
||||
omitted->append(Utils::toList(providedSet));
|
||||
}
|
||||
return allowed.toList();
|
||||
return Utils::toList(allowed);
|
||||
}
|
||||
|
||||
QStringList GTestConfiguration::argumentsForTestRunner(QStringList *omitted) const
|
||||
|
||||
@@ -239,7 +239,7 @@ static void fetchAndMergeBaseTestFunctions(const QSet<QString> &baseClasses,
|
||||
const CPlusPlus::Document::Ptr &doc,
|
||||
const CPlusPlus::Snapshot &snapshot)
|
||||
{
|
||||
QList<QString> bases = baseClasses.toList();
|
||||
QList<QString> bases = Utils::toList(baseClasses);
|
||||
while (!bases.empty()) {
|
||||
const QString base = bases.takeFirst();
|
||||
TestVisitor baseVisitor(base, snapshot);
|
||||
@@ -250,7 +250,7 @@ static void fetchAndMergeBaseTestFunctions(const QSet<QString> &baseClasses,
|
||||
baseVisitor.accept(declaringDoc->globalNamespace());
|
||||
if (!baseVisitor.resultValid())
|
||||
continue;
|
||||
bases.append(baseVisitor.baseClasses().toList());
|
||||
bases.append(Utils::toList(baseVisitor.baseClasses()));
|
||||
mergeTestFunctions(testFunctions, baseVisitor.privateSlots());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ static Macros dumpPredefinedMacros(const FilePath &compiler, const Core::Id lang
|
||||
|
||||
CommandLine cmd(compiler, {fakeIn.fileName()});
|
||||
if (languageId == ProjectExplorer::Constants::CXX_LANGUAGE_ID)
|
||||
cmd.addArg("--ec++");
|
||||
cmd.addArg("--c++");
|
||||
cmd.addArg("--predef_macros");
|
||||
cmd.addArg(outpath);
|
||||
|
||||
@@ -132,7 +132,7 @@ static HeaderPaths dumpHeaderPaths(const FilePath &compiler, const Core::Id lang
|
||||
|
||||
CommandLine cmd(compiler, {fakeIn.fileName()});
|
||||
if (languageId == ProjectExplorer::Constants::CXX_LANGUAGE_ID)
|
||||
cmd.addArg("--ec++");
|
||||
cmd.addArg("--c++");
|
||||
cmd.addArg("--preinclude");
|
||||
cmd.addArg(".");
|
||||
|
||||
|
||||
@@ -252,7 +252,7 @@ void BackendCommunicator::documentsChangedFromCppEditorDocument(const QString &f
|
||||
documentsChanged(filePath, document->contents(), document->revision());
|
||||
}
|
||||
|
||||
void BackendCommunicator::unsavedFielsUpdatedFromCppEditorDocument(const QString &filePath)
|
||||
void BackendCommunicator::unsavedFilesUpdatedFromCppEditorDocument(const QString &filePath)
|
||||
{
|
||||
const CppTools::CppEditorDocumentHandle *document = ClangCodeModel::Utils::cppDocument(filePath);
|
||||
QTC_ASSERT(document, return);
|
||||
@@ -387,7 +387,7 @@ void BackendCommunicator::unsavedFilesUpdated(Core::IDocument *document)
|
||||
{
|
||||
QTC_ASSERT(document, return);
|
||||
|
||||
unsavedFielsUpdatedFromCppEditorDocument(document->filePath().toString());
|
||||
unsavedFilesUpdatedFromCppEditorDocument(document->filePath().toString());
|
||||
}
|
||||
|
||||
void BackendCommunicator::onConnectedToBackend()
|
||||
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
const QByteArray &contents,
|
||||
uint documentRevision);
|
||||
void unsavedFilesUpdated(const FileContainers &fileContainers);
|
||||
void unsavedFielsUpdatedFromCppEditorDocument(const QString &filePath);
|
||||
void unsavedFilesUpdatedFromCppEditorDocument(const QString &filePath);
|
||||
void unsavedFilesRemoved(const FileContainers &fileContainers);
|
||||
|
||||
void requestCompletions(ClangCompletionAssistProcessor *assistProcessor,
|
||||
|
||||
@@ -96,10 +96,6 @@ public:
|
||||
SymbolQuery<QuerySqliteReadStatementFactory> symbolQuery{statementFactory};
|
||||
ClangBackEnd::ProjectPartsStorage<Sqlite::Database> projectPartsStorage{database};
|
||||
RefactoringEngine engine{connectionClient.serverProxy(), refactoringClient, filePathCache, symbolQuery};
|
||||
QtCreatorSearch qtCreatorSearch;
|
||||
QtCreatorClangQueryFindFilter qtCreatorfindFilter{connectionClient.serverProxy(),
|
||||
qtCreatorSearch,
|
||||
refactoringClient};
|
||||
QtCreatorRefactoringProjectUpdater projectUpdate{connectionClient.serverProxy(),
|
||||
ClangPchManagerPlugin::pchManagerClient(),
|
||||
filePathCache,
|
||||
@@ -123,7 +119,6 @@ bool ClangRefactoringPlugin::initialize(const QStringList & /*arguments*/, QStri
|
||||
|
||||
d->refactoringClient.setRefactoringEngine(&d->engine);
|
||||
d->refactoringClient.setRefactoringConnectionClient(&d->connectionClient);
|
||||
ExtensionSystem::PluginManager::addObject(&d->qtCreatorfindFilter);
|
||||
|
||||
connectBackend();
|
||||
startBackend();
|
||||
@@ -142,7 +137,6 @@ void ClangRefactoringPlugin::extensionsInitialized()
|
||||
|
||||
ExtensionSystem::IPlugin::ShutdownFlag ClangRefactoringPlugin::aboutToShutdown()
|
||||
{
|
||||
ExtensionSystem::PluginManager::removeObject(&d->qtCreatorfindFilter);
|
||||
CppTools::CppModelManager::removeRefactoringEngine(
|
||||
CppTools::RefactoringEngineType::ClangRefactoring);
|
||||
d->refactoringClient.setRefactoringConnectionClient(nullptr);
|
||||
|
||||
@@ -130,7 +130,8 @@ void QtCreatorClangQueryFindFilter::prepareFind()
|
||||
|
||||
const CppTools::ProjectInfo projectInfo = CppTools::CppModelManager::instance()->projectInfo(currentProject);
|
||||
|
||||
setProjectParts(projectInfo.projectParts().toStdVector());
|
||||
const QVector<CppTools::ProjectPart::Ptr> parts = projectInfo.projectParts();
|
||||
setProjectParts({parts.begin(), parts.end()});
|
||||
|
||||
setUnsavedContent(createUnsavedContents());
|
||||
}
|
||||
|
||||
@@ -40,16 +40,6 @@ void RefactoringClient::alive()
|
||||
m_connectionClient->resetProcessAliveTimer();
|
||||
}
|
||||
|
||||
void RefactoringClient::sourceLocationsForRenamingMessage(
|
||||
ClangBackEnd::SourceLocationsForRenamingMessage &&message)
|
||||
{
|
||||
m_localRenamingCallback(message.symbolName.toQString(),
|
||||
message.sourceLocations,
|
||||
message.textDocumentRevision);
|
||||
|
||||
m_refactoringEngine->setRefactoringEngineAvailable(true);
|
||||
}
|
||||
|
||||
void RefactoringClient::sourceRangesAndDiagnosticsForQueryMessage(
|
||||
ClangBackEnd::SourceRangesAndDiagnosticsForQueryMessage &&message)
|
||||
{
|
||||
@@ -64,12 +54,6 @@ void RefactoringClient::sourceRangesForQueryMessage(ClangBackEnd::SourceRangesFo
|
||||
setResultCounterAndSendSearchIsFinishedIfFinished();
|
||||
}
|
||||
|
||||
void RefactoringClient::setLocalRenamingCallback(
|
||||
CppTools::RefactoringEngineInterface::RenameCallback &&localRenamingCallback)
|
||||
{
|
||||
m_localRenamingCallback = std::move(localRenamingCallback);
|
||||
}
|
||||
|
||||
void RefactoringClient::progress(ClangBackEnd::ProgressMessage &&message)
|
||||
{
|
||||
m_progressManager.setProgress(message.progress, message.total);
|
||||
@@ -100,11 +84,6 @@ void RefactoringClient::setClangQueryHighlighter(ClangQueryHighlighter *highligh
|
||||
m_clangQueryHighlighter = highlighter;
|
||||
}
|
||||
|
||||
bool RefactoringClient::hasValidLocalRenamingCallback() const
|
||||
{
|
||||
return bool(m_localRenamingCallback);
|
||||
}
|
||||
|
||||
void RefactoringClient::setExpectedResultCount(uint count)
|
||||
{
|
||||
m_expectedResultCount = count;
|
||||
|
||||
@@ -54,15 +54,11 @@ public:
|
||||
{}
|
||||
|
||||
void alive() override;
|
||||
void sourceLocationsForRenamingMessage(
|
||||
ClangBackEnd::SourceLocationsForRenamingMessage &&message) override;
|
||||
void sourceRangesAndDiagnosticsForQueryMessage(
|
||||
ClangBackEnd::SourceRangesAndDiagnosticsForQueryMessage &&message) override;
|
||||
void sourceRangesForQueryMessage(
|
||||
ClangBackEnd::SourceRangesForQueryMessage &&message) override;
|
||||
|
||||
void setLocalRenamingCallback(
|
||||
CppTools::RefactoringEngineInterface::RenameCallback &&localRenamingCallback) override;
|
||||
void progress(ClangBackEnd::ProgressMessage &&message) override;
|
||||
|
||||
void setRefactoringEngine(ClangRefactoring::RefactoringEngine *refactoringEngine);
|
||||
@@ -71,8 +67,6 @@ public:
|
||||
void setClangQueryExampleHighlighter(ClangQueryExampleHighlighter *highlighter);
|
||||
void setClangQueryHighlighter(ClangQueryHighlighter *highlighter);
|
||||
|
||||
bool hasValidLocalRenamingCallback() const;
|
||||
|
||||
void setExpectedResultCount(uint count);
|
||||
uint expectedResultCount() const;
|
||||
uint resultCounter() const;
|
||||
@@ -90,7 +84,6 @@ private:
|
||||
void sendSearchIsFinished();
|
||||
|
||||
private:
|
||||
CppTools::RefactoringEngineInterface::RenameCallback m_localRenamingCallback;
|
||||
ClangBackEnd::RefactoringConnectionClient *m_connectionClient = nullptr;
|
||||
SearchHandle *m_searchHandle = nullptr;
|
||||
RefactoringEngine *m_refactoringEngine = nullptr;
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
#include <filepath.h>
|
||||
#include <refactoringserverinterface.h>
|
||||
#include <requestsourcelocationforrenamingmessage.h>
|
||||
|
||||
#include <cpptools/compileroptionsbuilder.h>
|
||||
#include <cpptools/cpptoolsreuse.h>
|
||||
@@ -47,7 +46,6 @@
|
||||
|
||||
namespace ClangRefactoring {
|
||||
|
||||
using ClangBackEnd::RequestSourceLocationsForRenamingMessage;
|
||||
|
||||
RefactoringEngine::RefactoringEngine(ClangBackEnd::RefactoringServerInterface &server,
|
||||
ClangBackEnd::RefactoringClientInterface &client,
|
||||
@@ -62,34 +60,10 @@ RefactoringEngine::RefactoringEngine(ClangBackEnd::RefactoringServerInterface &s
|
||||
|
||||
RefactoringEngine::~RefactoringEngine() = default;
|
||||
|
||||
void RefactoringEngine::startLocalRenaming(const CppTools::CursorInEditor &data,
|
||||
CppTools::ProjectPart *projectPart,
|
||||
RenameCallback &&renameSymbolsCallback)
|
||||
void RefactoringEngine::startLocalRenaming(const CppTools::CursorInEditor &,
|
||||
CppTools::ProjectPart *,
|
||||
RenameCallback &&)
|
||||
{
|
||||
using CppTools::CompilerOptionsBuilder;
|
||||
|
||||
setRefactoringEngineAvailable(false);
|
||||
|
||||
m_client.setLocalRenamingCallback(std::move(renameSymbolsCallback));
|
||||
|
||||
QString filePath = data.filePath().toString();
|
||||
QTextCursor textCursor = data.cursor();
|
||||
CompilerOptionsBuilder optionsBuilder{*projectPart, CppTools::UseSystemHeader::Yes};
|
||||
Utils::SmallStringVector commandLine{optionsBuilder.build(
|
||||
fileKindInProjectPart(projectPart, filePath),
|
||||
CppTools::getPchUsage())};
|
||||
|
||||
commandLine.push_back(filePath);
|
||||
|
||||
RequestSourceLocationsForRenamingMessage message(ClangBackEnd::FilePath(filePath),
|
||||
uint(textCursor.blockNumber() + 1),
|
||||
uint(textCursor.positionInBlock() + 1),
|
||||
textCursor.document()->toPlainText(),
|
||||
std::move(commandLine),
|
||||
textCursor.document()->revision());
|
||||
|
||||
|
||||
m_server.requestSourceLocationsForRenamingMessage(std::move(message));
|
||||
}
|
||||
|
||||
CppTools::Usages RefactoringEngine::locationsAt(const CppTools::CursorInEditor &data) const
|
||||
|
||||
@@ -128,10 +128,10 @@ void ClangToolsProjectSettings::store()
|
||||
m_project->setNamedSettings(SETTINGS_KEY_DIAGNOSTIC_CONFIG, m_diagnosticConfig.toSetting());
|
||||
m_project->setNamedSettings(SETTINGS_KEY_BUILD_BEFORE_ANALYSIS, m_buildBeforeAnalysis);
|
||||
|
||||
const QStringList dirs = Utils::transform(m_selectedDirs.toList(), &Utils::FilePath::toString);
|
||||
const QStringList dirs = Utils::transform<QList>(m_selectedDirs, &Utils::FilePath::toString);
|
||||
m_project->setNamedSettings(SETTINGS_KEY_SELECTED_DIRS, dirs);
|
||||
|
||||
const QStringList files = Utils::transform(m_selectedFiles.toList(), &Utils::FilePath::toString);
|
||||
const QStringList files = Utils::transform<QList>(m_selectedFiles, &Utils::FilePath::toString);
|
||||
m_project->setNamedSettings(SETTINGS_KEY_SELECTED_FILES, files);
|
||||
|
||||
QVariantList list;
|
||||
|
||||
@@ -587,8 +587,7 @@ void Parser::clearCache()
|
||||
|
||||
void Parser::setFileList(const QStringList &fileList)
|
||||
{
|
||||
d->fileList.clear();
|
||||
d->fileList = QSet<QString>::fromList(fileList);
|
||||
d->fileList = ::Utils::toSet(fileList);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -339,7 +339,7 @@ void CMakeProject::updateProjectData(CMakeBuildConfiguration *bc)
|
||||
{
|
||||
CMakeConfigItem paths;
|
||||
paths.key = "ANDROID_SO_LIBS_PATHS";
|
||||
paths.values = res.toList();
|
||||
paths.values = Utils::toList(res);
|
||||
patchedConfig.append(paths);
|
||||
}
|
||||
|
||||
|
||||
@@ -273,7 +273,7 @@ std::unique_ptr<CMakeProjectNode> TeaLeafReader::generateProjectTree(
|
||||
= Utils::filtered(bt.includeFiles, [this](const Utils::FilePath &fn) {
|
||||
return fn.isChildOf(m_parameters.sourceDirectory);
|
||||
});
|
||||
allIncludePathSet.unite(QSet<FilePath>::fromList(targetIncludePaths));
|
||||
allIncludePathSet.unite(Utils::toSet(targetIncludePaths));
|
||||
}
|
||||
const QList<FilePath> allIncludePaths = allIncludePathSet.toList();
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/globalfilechangeblocker.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
@@ -743,7 +744,7 @@ QString DocumentManager::allDocumentFactoryFiltersString(QString *allFilesFilter
|
||||
}
|
||||
}
|
||||
|
||||
QStringList filters = uniqueFilters.toList();
|
||||
QStringList filters = Utils::toList(uniqueFilters);
|
||||
filters.sort();
|
||||
const QString allFiles = Utils::allFilesFilterString();
|
||||
if (allFilesFilter)
|
||||
|
||||
@@ -1424,7 +1424,7 @@ bool EditorManagerPrivate::closeEditors(const QList<IEditor*> &editors, CloseFla
|
||||
return false;
|
||||
if (!rejectedList.isEmpty()) {
|
||||
closingFailed = true;
|
||||
QSet<IEditor*> skipSet = DocumentModel::editorsForDocuments(rejectedList).toSet();
|
||||
QSet<IEditor*> skipSet = Utils::toSet(DocumentModel::editorsForDocuments(rejectedList));
|
||||
acceptedEditors = acceptedEditors.subtract(skipSet);
|
||||
}
|
||||
}
|
||||
@@ -1490,7 +1490,7 @@ bool EditorManagerPrivate::closeEditors(const QList<IEditor*> &editors, CloseFla
|
||||
}
|
||||
}
|
||||
|
||||
emit m_instance->editorsClosed(acceptedEditors.toList());
|
||||
emit m_instance->editorsClosed(Utils::toList(acceptedEditors));
|
||||
|
||||
foreach (IEditor *editor, acceptedEditors)
|
||||
delete editor;
|
||||
|
||||
@@ -241,12 +241,12 @@ Id Id::versionedId(const QByteArray &prefix, int major, int minor)
|
||||
|
||||
QSet<Id> Id::fromStringList(const QStringList &list)
|
||||
{
|
||||
return QSet<Id>::fromList(Utils::transform(list, &Id::fromString));
|
||||
return Utils::transform<QSet<Id>>(list, &Id::fromString);
|
||||
}
|
||||
|
||||
QStringList Id::toStringList(const QSet<Id> &ids)
|
||||
{
|
||||
QList<Id> idList = ids.toList();
|
||||
QList<Id> idList = Utils::toList(ids);
|
||||
Utils::sort(idList);
|
||||
return Utils::transform(idList, &Id::toString);
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
|
||||
namespace std {
|
||||
template<> struct hash<QString>
|
||||
{
|
||||
@@ -47,6 +48,7 @@ template<> struct hash<QString>
|
||||
}
|
||||
};
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
using ExtensionMap = std::unordered_map<QString, Core::JsExpander::ObjectFactory>;
|
||||
Q_GLOBAL_STATIC(ExtensionMap, globalJsExtensions);
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
#include "locatorconstants.h"
|
||||
|
||||
#include <coreplugin/coreconstants.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/categorysortfiltermodel.h>
|
||||
#include <utils/headerviewstretcher.h>
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -287,7 +289,7 @@ void LocatorSettingsPage::initializeModel()
|
||||
ILocatorFilter::msgIncludeByDefaultToolTip()
|
||||
});
|
||||
m_model->clear();
|
||||
QSet<ILocatorFilter *> customFilterSet = m_customFilters.toSet();
|
||||
QSet<ILocatorFilter *> customFilterSet = Utils::toSet(m_customFilters);
|
||||
auto builtIn = new CategoryItem(tr("Built-in"), 0/*order*/);
|
||||
for (ILocatorFilter *filter : qAsConst(m_filters))
|
||||
if (!filter->isHidden() && !customFilterSet.contains(filter))
|
||||
|
||||
@@ -382,7 +382,7 @@ static void onReplaceUsagesClicked(const QString &text,
|
||||
|
||||
const QStringList fileNames = TextEditor::BaseFileFind::replaceAll(text, items, preserveCase);
|
||||
if (!fileNames.isEmpty()) {
|
||||
modelManager->updateSourceFiles(fileNames.toSet());
|
||||
modelManager->updateSourceFiles(Utils::toSet(fileNames));
|
||||
SearchResultWindow::instance()->hide();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,8 @@
|
||||
|
||||
#include <cplusplus/CppRewriter.h>
|
||||
#include <cplusplus/Overview.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/changeset.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/utilsicons.h>
|
||||
@@ -1086,11 +1088,11 @@ void InsertVirtualMethodsDialog::saveSettings()
|
||||
m_settings->overrideReplacementIndex = m_overrideReplacementComboBox->currentIndex();
|
||||
if (m_overrideReplacementComboBox && m_overrideReplacementComboBox->isEnabled())
|
||||
m_settings->overrideReplacement = m_overrideReplacementComboBox->currentText().trimmed();
|
||||
QSet<QString> addedReplacements = m_availableOverrideReplacements.toSet();
|
||||
QSet<QString> addedReplacements = Utils::toSet(m_availableOverrideReplacements);
|
||||
addedReplacements.insert(m_settings->overrideReplacement);
|
||||
addedReplacements.subtract(defaultOverrideReplacements().toSet());
|
||||
addedReplacements.subtract(Utils::toSet(defaultOverrideReplacements()));
|
||||
m_settings->userAddedOverrideReplacements =
|
||||
sortedAndTrimmedStringListWithoutEmptyElements(addedReplacements.toList());
|
||||
sortedAndTrimmedStringListWithoutEmptyElements(Utils::toList(addedReplacements));
|
||||
m_settings->write();
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <projectexplorer/projectmacro.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
using namespace CPlusPlus;
|
||||
@@ -269,7 +270,7 @@ void BuiltinEditorDocumentParser::addFileAndDependencies(Snapshot *snapshot,
|
||||
toRemove->insert(fileName);
|
||||
if (fileName != Utils::FilePath::fromString(filePath())) {
|
||||
Utils::FilePathList deps = snapshot->filesDependingOn(fileName);
|
||||
toRemove->unite(QSet<Utils::FilePath>::fromList(deps));
|
||||
toRemove->unite(Utils::toSet(deps));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -197,7 +197,7 @@ void index(QFutureInterface<void> &indexingFuture,
|
||||
const int sourceCount = sources.size();
|
||||
QStringList files = sources + headers;
|
||||
|
||||
sourceProcessor->setTodo(files.toSet());
|
||||
sourceProcessor->setTodo(Utils::toSet(files));
|
||||
|
||||
const QString conf = CppModelManager::configurationFileName();
|
||||
bool processingHeaders = false;
|
||||
|
||||
@@ -381,7 +381,7 @@ private:
|
||||
|
||||
levelNode->childDirectories.append(checkNode);
|
||||
|
||||
m_topics.unite(check.topics.toSet());
|
||||
m_topics.unite(Utils::toSet(check.topics));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1003,7 +1003,7 @@ void ClangDiagnosticConfigsWidget::setupTabs()
|
||||
setupTreeView(m_clazyChecks->checksView, m_clazySortFilterProxyModel, 2);
|
||||
m_clazyChecks->checksView->setSortingEnabled(true);
|
||||
m_clazyChecks->checksView->sortByColumn(0, Qt::AscendingOrder);
|
||||
auto topicsModel = new QStringListModel(m_clazyTreeModel->topics().toList(), this);
|
||||
auto topicsModel = new QStringListModel(Utils::toList(m_clazyTreeModel->topics()), this);
|
||||
topicsModel->sort(0);
|
||||
m_clazyChecks->topicsView->setModel(topicsModel);
|
||||
connect(m_clazyChecks->topicsResetButton, &QPushButton::clicked, [this](){
|
||||
|
||||
@@ -388,7 +388,7 @@ void CppToolsPlugin::test_global_completion()
|
||||
QVERIFY(test.succeededSoFar());
|
||||
const QStringList completions = test.getCompletions();
|
||||
QVERIFY(isProbablyGlobalCompletion(completions));
|
||||
QVERIFY(completions.toSet().contains(requiredCompletionItems.toSet()));
|
||||
QVERIFY(Utils::toSet(completions).contains(Utils::toSet(requiredCompletionItems)));
|
||||
}
|
||||
|
||||
void CppToolsPlugin::test_doxygen_tag_completion_data()
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user