Merge remote-tracking branch 'origin/4.11'

Change-Id: Ica0d173a08ff3f0296e875aa324d5bb6974bd90f
This commit is contained in:
Eike Ziller
2020-01-08 07:13:32 +01:00
36 changed files with 763 additions and 518 deletions

View File

@@ -173,6 +173,20 @@ def error(message):
def showException(msg, exType, exValue, exTraceback):
DumperBase.showException(msg, exType, exValue, exTraceback)
class Timer:
def __init__(self, d, desc):
self.d = d
self.desc = desc + '-' + d.currentIName
def __enter__(self):
self.starttime = time.time()
def __exit__(self, exType, exValue, exTraceBack):
elapsed = int(1000 * (time.time() - self.starttime))
self.d.timings.append([self.desc, elapsed])
class Children:
def __init__(self, d, numChild = 1, childType = None, childNumChild = None,
maxNumChild = None, addrBase = None, addrStep = None):
@@ -261,6 +275,9 @@ class DumperBase:
except:
pass
def timer(self, desc):
return Timer(self, desc)
def __init__(self):
self.isCdb = False
self.isGdb = False
@@ -372,12 +389,10 @@ class DumperBase:
self.counts = {}
self.structPatternCache = {}
self.pretimings = {}
self.timings = []
def resetStats(self):
# Timing collection
self.pretimings = {}
self.timings = []
pass
@@ -392,15 +407,6 @@ class DumperBase:
else:
self.counts[key] = 1
def preping(self, key):
return
self.pretimings[key] = time.time()
def ping(self, key):
return
elapsed = int(1000 * (time.time() - self.pretimings[key]))
self.timings.append([key, elapsed])
def childRange(self):
if self.currentMaxNumChild is None:
return xrange(0, self.currentNumChild)
@@ -1369,9 +1375,8 @@ class DumperBase:
return False
def putFormattedPointer(self, value):
self.preping('formattedPointer')
#with self.timer('formattedPointer'):
self.putFormattedPointerX(value)
self.ping('formattedPointer')
def putDerefedPointer(self, value):
derefValue = value.dereference()
@@ -1735,15 +1740,13 @@ class DumperBase:
metaObjectPtr = 0
if not metaObjectPtr:
# measured: 3 ms (example had one level of inheritance)
self.preping('metaObjectType-' + self.currentIName)
#with self.timer('metaObjectType-' + self.currentIName):
metaObjectPtr = extractStaticMetaObjectPtrFromType(typeobj)
self.ping('metaObjectType-' + self.currentIName)
if not metaObjectPtr:
# measured: 200 ms (example had one level of inheritance)
self.preping('metaObjectCall-' + self.currentIName)
#with self.timer('metaObjectCall-' + self.currentIName):
metaObjectPtr = extractMetaObjectPtrFromAddress()
self.ping('metaObjectCall-' + self.currentIName)
#if metaObjectPtr:
# self.bump('foundMetaObject')
@@ -2392,7 +2395,7 @@ class DumperBase:
def handleLocals(self, variables):
#warn('VARIABLES: %s' % variables)
self.preping('locals')
#with self.timer('locals'):
shadowed = {}
for value in variables:
if value.name == 'argv':
@@ -2412,20 +2415,17 @@ class DumperBase:
# A 'normal' local variable or parameter.
iname = value.iname if hasattr(value, 'iname') else 'local.' + name
with TopLevelItem(self, iname):
self.preping('all-' + iname)
#with self.timer('all-' + iname):
self.putField('iname', iname)
self.putField('name', name)
self.putItem(value)
self.ping('all-' + iname)
self.ping('locals')
def handleWatches(self, args):
self.preping('watches')
#with self.timer('watches'):
for watcher in args.get('watchers', []):
iname = watcher['iname']
exp = self.hexdecode(watcher['exp'])
self.handleWatch(exp, exp, iname)
self.ping('watches')
def handleWatch(self, origexp, exp, iname):
exp = str(exp).strip()
@@ -2734,9 +2734,8 @@ class DumperBase:
self.putSubItem(i, val)
def putItem(self, value):
self.preping('putItem')
#with self.timer('putItem'):
self.putItemX(value)
self.ping('putItem')
def putItemX(self, value):
#warn('PUT ITEM: %s' % value.stringify())
@@ -2868,9 +2867,8 @@ class DumperBase:
self.putEmptyValue()
#warn('STRUCT GUTS: %s ADDRESS: 0x%x ' % (value.name, value.address()))
if self.showQObjectNames:
self.preping(self.currentIName)
#with self.timer(self.currentIName):
self.putQObjectNameValue(value)
self.ping(self.currentIName)
if self.isExpanded():
self.putField('sortable', 1)
with Children(self, 1, childType=None):
@@ -3351,7 +3349,7 @@ class DumperBase:
error('CANNOT CONVERT TO BYTES: %s' % self)
def extractInteger(self, bitsize, unsigned):
self.dumper.preping('extractInt')
#with self.dumper.timer('extractInt'):
self.check()
if bitsize > 32:
size = 8
@@ -3369,23 +3367,21 @@ class DumperBase:
res = struct.unpack_from(self.dumper.packCode + code, rawBytes, 0)[0]
#warn('Extract: Code: %s Bytes: %s Bitsize: %s Size: %s'
# % (self.dumper.packCode + code, self.dumper.hexencode(rawBytes), bitsize, size))
self.dumper.ping('extractInt')
return res
def extractSomething(self, code, bitsize):
self.dumper.preping('extractSomething')
#with self.dumper.timer('extractSomething'):
self.check()
size = (bitsize + 7) >> 3
rawBytes = self.data(size)
res = struct.unpack_from(self.dumper.packCode + code, rawBytes, 0)[0]
self.dumper.ping('extractSomething')
return res
def to(self, pattern):
return self.split(pattern)[0]
def split(self, pattern):
self.dumper.preping('split')
#with self.dumper.timer('split'):
#warn('EXTRACT STRUCT FROM: %s' % self.type)
(pp, size, fields) = self.dumper.describeStruct(pattern)
#warn('SIZE: %s ' % size)
@@ -3405,7 +3401,6 @@ class DumperBase:
return thing
if len(fields) != len(result):
error('STRUCT ERROR: %s %s' (fields, result))
self.dumper.ping('split')
return tuple(map(structFixer, fields, result))
def checkPointer(self, p, align = 1):
@@ -3548,9 +3543,8 @@ class DumperBase:
# FIXME: That buys some performance at the cost of a fail
# of Gdb13393 dumper test.
#return self
self.dumper.preping('dynamicType %s 0x%s' % (self.name, address))
#with self.dumper.timer('dynamicType %s 0x%s' % (self.name, address)):
dynTypeName = self.dynamicTypeName(address)
self.dumper.ping('dynamicType %s 0x%s' % (self.name, address))
if dynTypeName is not None:
return self.dumper.createType(dynTypeName)
return self

View File

@@ -243,6 +243,10 @@ class Dumper(DumperBase):
nativeTargetValue = None
targetType = self.fromNativeType(nativeType.target().unqualified())
val = self.createPointerValue(toInteger(nativeValue), targetType)
# The nativeValue is needed in case of multiple inheritance, see
# QTCREATORBUG-17823. Using it triggers nativeValueDereferencePointer()
# later which
# is surprisingly expensive.
val.nativeValue = nativeValue
#warn('CREATED PTR 1: %s' % val)
if not nativeValue.address is None:
@@ -447,7 +451,6 @@ class Dumper(DumperBase):
return typeId
def nativeStructAlignment(self, nativeType):
self.preping('align ' + str(nativeType))
#warn('NATIVE ALIGN FOR %s' % nativeType.name)
def handleItem(nativeFieldType, align):
a = self.fromNativeType(nativeFieldType).alignment()
@@ -455,7 +458,6 @@ class Dumper(DumperBase):
align = 1
for f in nativeType.fields():
align = handleItem(f.type, align)
self.ping('align ' + str(nativeType))
return align
@@ -668,9 +670,7 @@ class Dumper(DumperBase):
self.resetStats()
self.prepare(args)
self.preping('endian')
self.isBigEndian = gdb.execute('show endian', to_string = True).find('big endian') > 0
self.ping('endian')
self.packCode = '>' if self.isBigEndian else '<'
(ok, res) = self.tryFetchInterpreterVariables(args)
@@ -827,9 +827,7 @@ class Dumper(DumperBase):
#warn('READ: %s FROM 0x%x' % (size, address))
if address == 0 or size == 0:
return bytes()
self.preping('readMem')
res = self.selectedInferior().read_memory(address, size)
self.ping('readMem')
return res
def findStaticMetaObject(self, type):
@@ -1137,6 +1135,7 @@ class Dumper(DumperBase):
self.reportResult('selected="0x%x",expr="(%s*)0x%x"' % (p, n, p), args)
def nativeValueDereferencePointer(self, value):
# This is actually pretty expensive, up to 100ms.
deref = value.nativeValue.dereference()
return self.fromNativeValue(deref.cast(deref.dynamic_type))

View File

@@ -31,6 +31,7 @@ HEADERS += $$PWD/drop3dlibraryitemcommand.h
HEADERS += $$PWD/update3dviewstatecommand.h
HEADERS += $$PWD/enable3dviewcommand.h
HEADERS += $$PWD/view3dclosedcommand.h
HEADERS += $$PWD/puppettocreatorcommand.h
SOURCES += $$PWD/synchronizecommand.cpp
SOURCES += $$PWD/debugoutputcommand.cpp
@@ -63,3 +64,4 @@ SOURCES += $$PWD/drop3dlibraryitemcommand.cpp
SOURCES += $$PWD/update3dviewstatecommand.cpp
SOURCES += $$PWD/enable3dviewcommand.cpp
SOURCES += $$PWD/view3dclosedcommand.cpp
SOURCES += $$PWD/puppettocreatorcommand.cpp

View File

@@ -0,0 +1,55 @@
/****************************************************************************
**
** Copyright (C) 2020 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 "puppettocreatorcommand.h"
namespace QmlDesigner {
// A generic command that can hold a variant data from puppet to creator
PuppetToCreatorCommand::PuppetToCreatorCommand(Type type, const QVariant &data)
: m_type(type)
, m_data(data)
{
}
QDataStream &operator<<(QDataStream &out, const PuppetToCreatorCommand &command)
{
out << qint32(command.type());
out << command.data();
return out;
}
QDataStream &operator>>(QDataStream &in, PuppetToCreatorCommand &command)
{
qint32 type;
in >> type;
command.m_type = PuppetToCreatorCommand::Type(type);
in >> command.m_data;
return in;
}
} // namespace QmlDesigner

View File

@@ -0,0 +1,57 @@
/****************************************************************************
**
** Copyright (C) 2020 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 <qmetatype.h>
#include <QDataStream>
#include <QVariant>
namespace QmlDesigner {
class PuppetToCreatorCommand
{
public:
enum Type { Key_Pressed, None };
PuppetToCreatorCommand(Type type, const QVariant &data);
PuppetToCreatorCommand() = default;
Type type() const { return m_type; }
QVariant data() const { return m_data; }
private:
Type m_type = None;
QVariant m_data;
friend QDataStream &operator>>(QDataStream &in, PuppetToCreatorCommand &command);
};
QDataStream &operator<<(QDataStream &out, const PuppetToCreatorCommand &command);
QDataStream &operator>>(QDataStream &in, PuppetToCreatorCommand &command);
} // namespace QmlDesigner
Q_DECLARE_METATYPE(QmlDesigner::PuppetToCreatorCommand)

View File

@@ -72,6 +72,7 @@
#include "changeselectioncommand.h"
#include "drop3dlibraryitemcommand.h"
#include "view3dclosedcommand.h"
#include "puppettocreatorcommand.h"
namespace QmlDesigner {
@@ -262,6 +263,11 @@ void NodeInstanceClientProxy::library3DItemDropped(const Drop3DLibraryItemComman
writeCommand(QVariant::fromValue(command));
}
void NodeInstanceClientProxy::handlePuppetToCreatorCommand(const PuppetToCreatorCommand &command)
{
writeCommand(QVariant::fromValue(command));
}
void NodeInstanceClientProxy::view3DClosed(const View3DClosedCommand &command)
{
writeCommand(QVariant::fromValue(command));

View File

@@ -60,6 +60,7 @@ class ChangeNodeSourceCommand;
class EndPuppetCommand;
class ChangeSelectionCommand;
class Drop3DLibraryItemCommand;
class PuppetToCreatorCommand;
class View3DClosedCommand;
class NodeInstanceClientProxy : public QObject, public NodeInstanceClientInterface
@@ -81,6 +82,7 @@ public:
void puppetAlive(const PuppetAliveCommand &command);
void selectionChanged(const ChangeSelectionCommand &command) override;
void library3DItemDropped(const Drop3DLibraryItemCommand &command) override;
void handlePuppetToCreatorCommand(const PuppetToCreatorCommand &command) override;
void view3DClosed(const View3DClosedCommand &command) override;
void flush() override;

View File

@@ -43,6 +43,7 @@ class PuppetAliveCommand;
class ChangeSelectionCommand;
class Drop3DLibraryItemCommand;
class View3DClosedCommand;
class PuppetToCreatorCommand;
class NodeInstanceClientInterface
{
@@ -59,6 +60,7 @@ public:
virtual void selectionChanged(const ChangeSelectionCommand &command) = 0;
virtual void library3DItemDropped(const Drop3DLibraryItemCommand &command) = 0;
virtual void view3DClosed(const View3DClosedCommand &command) = 0;
virtual void handlePuppetToCreatorCommand(const PuppetToCreatorCommand &command) = 0;
virtual void flush() {}
virtual void synchronizeWithClientProcess() {}

View File

@@ -64,6 +64,7 @@
#include "debugoutputcommand.h"
#include "puppetalivecommand.h"
#include "view3dclosedcommand.h"
#include "puppettocreatorcommand.h"
#include <enumeration.h>
@@ -209,6 +210,12 @@ void NodeInstanceServerInterface::registerCommands()
qRegisterMetaType<View3DClosedCommand>("View3DClosedCommand");
qRegisterMetaTypeStreamOperators<View3DClosedCommand>("View3DClosedCommand");
qRegisterMetaType<PuppetToCreatorCommand>("PuppetToCreatorCommand");
qRegisterMetaTypeStreamOperators<PuppetToCreatorCommand>("PuppetToCreatorCommand");
qRegisterMetaType<QPair<int, int>>("QPairIntInt");
qRegisterMetaTypeStreamOperators<QPair<int, int>>("QPairIntInt");
}
}

View File

@@ -61,6 +61,7 @@
#include "removesharedmemorycommand.h"
#include "objectnodeinstance.h"
#include "drop3dlibraryitemcommand.h"
#include "puppettocreatorcommand.h"
#include "view3dclosedcommand.h"
#include "dummycontextobject.h"
@@ -102,6 +103,13 @@ bool Qt5InformationNodeInstanceServer::eventFilter(QObject *, QEvent *event)
nodeInstanceClient()->view3DClosed(View3DClosedCommand());
} break;
case QEvent::KeyPress: {
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
QPair<int, int> data = {keyEvent->key(), keyEvent->modifiers()};
nodeInstanceClient()->handlePuppetToCreatorCommand({PuppetToCreatorCommand::Key_Pressed,
QVariant::fromValue(data)});
} break;
default:
break;
}

View File

@@ -36,20 +36,28 @@ QtObject {
property bool isInModel: backendValue.isInModel;
property bool isInSubState: backendValue.isInSubState;
property bool highlight: textColor === __changedTextColor
property bool errorState: false
property color __defaultTextColor: StudioTheme.Values.themeTextColor
readonly property color __defaultTextColor: StudioTheme.Values.themeTextColor
readonly property color __changedTextColor: StudioTheme.Values.themeInteraction
readonly property color __errorTextColor: StudioTheme.Values.themeErrorColor
onBackendValueChanged: evaluate()
onValueFromBackendChanged: evaluate()
onBaseStateFlagChanged: evaluate()
onIsInModelChanged: evaluate()
onIsInSubStateChanged: evaluate()
onErrorStateChanged: evaluate()
function evaluate() {
if (innerObject.backendValue === undefined)
return
if (innerObject.errorState) {
innerObject.textColor = __errorTextColor
return
}
if (innerObject.baseStateFlag) {
if (innerObject.backendValue.isInModel)
innerObject.textColor = __changedTextColor

View File

@@ -33,7 +33,7 @@ StudioControls.ComboBox {
property variant backendValue
labelColor: edit ? StudioTheme.Values.themeTextColor : colorLogic.textColor
labelColor: edit && !colorLogic.errorState ? StudioTheme.Values.themeTextColor : colorLogic.textColor
property string scope: "Qt"
property bool useInteger: false
@@ -48,6 +48,8 @@ StudioControls.ComboBox {
property bool showExtendedFunctionButton: true
property alias colorLogic: colorLogic
ExtendedFunctionLogic {
id: extFuncLogic
backendValue: comboBox.backendValue

View File

@@ -25,42 +25,43 @@
import QtQuick 2.11
import QtQuick.Layouts 1.12
import QtQuick.Controls 2.5
import QtQuick.Dialogs 1.3
import HelperWidgets 2.0
import QtQuickDesignerTheme 1.0
import StudioControls 1.0 as StudioControls
import StudioTheme 1.0 as StudioTheme
Dialog {
id: dialogWindow
width: 1200
height: 650
title: "Gradient Picker"
title: qsTr("Gradient Picker")
signal saved;
property alias gradientData: gradientPickerData;
signal saved
property alias gradientData: gradientPickerData
QtObject {
id: gradientPickerData
property var stops;
property var colors;
property int stopsCount;
property int presetID;
property int presetType; //default(0) or custom(1)
property Item selectedItem;
property var stops
property var colors
property int stopsCount
property int presetID
property int presetType // default(0) or custom(1)
property Item selectedItem
}
function addGradient(stopsPositions, stopsColors, stopsCount) {
customPresetListModel.addGradient(stopsPositions, stopsColors, stopsCount);
customPresetListModel.addGradient(stopsPositions, stopsColors, stopsCount)
}
function updatePresets() {
customPresetListModel.readPresets();
customPresetListModel.readPresets()
}
GradientPresetDefaultListModel { id: defaultPresetListModel; }
GradientPresetCustomListModel { id: customPresetListModel; }
GradientPresetDefaultListModel { id: defaultPresetListModel }
GradientPresetCustomListModel { id: customPresetListModel }
standardButtons: Dialog.NoButton
@@ -68,27 +69,30 @@ Dialog {
anchors.fill: parent
anchors.margins: -12
anchors.bottomMargin: -70
color: "#363636"
color: StudioTheme.Values.themeColumnBackground
ColumnLayout {
anchors.fill: parent
anchors.margins: 13
anchors.bottomMargin: 71
TabView {
id: presetTabView
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
Layout.fillHeight: true
Layout.fillWidth: true
Tab {
title: qsTr("System Presets")
anchors.fill:parent
anchors.fill: parent
GradientPresetTabContent {
id: defaultTabContent
viewModel: defaultPresetListModel
editableName: false
}
}
} //tab default
Tab {
title: qsTr("User Presets")
anchors.fill: parent
@@ -97,11 +101,12 @@ Dialog {
id: customTabContent
viewModel: customPresetListModel
editableName: true
onPresetNameChanged: customPresetListModel.changePresetName(id, name);
property int deleteId;
onPresetNameChanged: customPresetListModel.changePresetName(id, name)
property int deleteId
onDeleteButtonClicked: {
deleteId = id;
deleteId = id
deleteDialog.open()
}
@@ -112,11 +117,12 @@ Dialog {
standardButtons: Dialog.No | Dialog.Yes
title: qsTr("Delete preset?")
text: qsTr("Are you sure you want to delete this preset?")
onAccepted: customPresetListModel.deletePreset(customTabContent.deleteId);
onAccepted: customPresetListModel.deletePreset(customTabContent.deleteId)
}
}
} //tab custom
} //tabview
}
}
RowLayout {
Layout.alignment: Qt.AlignBottom | Qt.AlignRight
Layout.topMargin: 5
@@ -124,7 +130,7 @@ Dialog {
Button { id: buttonClose; text: qsTr("Close"); onClicked: { dialogWindow.reject(); } }
Button { id: buttonSave; text: qsTr("Save"); onClicked: { dialogWindow.saved(); } }
Button { id: buttonApply; text: qsTr("Apply"); onClicked: { dialogWindow.apply(); } }
} //RowLayout
} //ColumnLayout
} //rectangle
} //dialog
}
}
}
}

View File

@@ -25,31 +25,28 @@
import QtQuick 2.11
import QtQuick.Layouts 1.12
import QtQuick.Controls 2.5
import QtQuick.Controls.Styles 1.4
import QtQuick.Dialogs 1.3
import HelperWidgets 2.0
import QtQuickDesignerTheme 1.0
import QtQuick.Controls.Private 1.0 as PrivateControls
import StudioControls 1.0 as StudioControls
import StudioTheme 1.0 as StudioTheme
Rectangle {
id: tabBackground
width: parent.width
height: parent.height
color: "#242424"
color: StudioTheme.Values.themeControlBackground
anchors.fill: parent
property alias viewModel : gradientTable.model;
property bool editableName : false;
property alias viewModel: gradientTable.model
property bool editableName: false
signal presetNameChanged(int id, string name)
signal deleteButtonClicked(int id)
property real delegateWidth: 154;
property real delegateHeight: 178;
property real gridCellWidth: 160;
property real delegateWidth: 154
property real delegateHeight: 178
property real gridCellWidth: 160
ScrollView {
Layout.fillWidth: true
@@ -74,7 +71,7 @@ Rectangle {
Rectangle {
id: backgroundCard
color: "#404040"
color: StudioTheme.Values.themeControlOutline
clip: true
property real flexibleWidth: (gradientTable.width - gradientTable.cellWidth * gradientTable.gridColumns) / gradientTable.gridColumns
@@ -84,16 +81,12 @@ Rectangle {
height: tabBackground.delegateHeight
radius: 16
MouseArea {
id: rectMouseArea
anchors.fill: parent
hoverEnabled: true
onClicked: {
gradientTable.currentIndex = index;
gradientData.stops = stopsPosList;
gradientData.colors = stopsColorList;
gradientData.stopsCount = stopListSize;
gradientData.presetID = presetID;
function selectPreset(index) {
gradientTable.currentIndex = index
gradientData.stops = stopsPosList
gradientData.colors = stopsColorList
gradientData.stopsCount = stopListSize
gradientData.presetID = presetID
gradientData.presetType = presetTabView.currentIndex
if (gradientData.selectedItem != null)
@@ -102,64 +95,64 @@ Rectangle {
backgroundCard.isSelected = true
gradientData.selectedItem = backgroundCard
}
onEntered: {
if (backgroundCard.state != "CLICKED") {
backgroundCard.state = "HOVER";
}
}
onExited: {
if (backgroundCard.state != "CLICKED") {
backgroundCard.state = "USUAL";
}
}
} //mouseArea
onIsSelectedChanged: {
if (isSelected)
backgroundCard.state = "CLICKED"
else
backgroundCard.state = "USUAL"
MouseArea {
id: rectMouseArea
anchors.fill: parent
hoverEnabled: true
onClicked: {
presetNameBox.edit = false
nameInput.focus = false
backgroundCard.selectPreset(index)
}
}
states: [
State {
name: "HOVER"
name: "default"
when: !(rectMouseArea.containsMouse || removeButton.hovered ||
(nameMouseArea.containsMouse && !tabBackground.editableName)) &&
!backgroundCard.isSelected
PropertyChanges {
target: backgroundCard
color: "#606060"
border.width: 1
border.color: "#029de0"
}
},
State {
name: "CLICKED"
PropertyChanges {
target: backgroundCard
color:"#029de0"
border.width: 1
border.color: "#606060"
}
},
State {
name: "USUAL"
PropertyChanges
{
target: backgroundCard
color: "#404040"
color: StudioTheme.Values.themeControlOutline
border.width: 0
}
},
State {
name: "hovered"
when: (rectMouseArea.containsMouse || removeButton.hovered ||
(nameMouseArea.containsMouse && !tabBackground.editableName)) &&
!backgroundCard.isSelected
PropertyChanges {
target: backgroundCard
color: StudioTheme.Values.themeControlBackgroundPressed
border.width: 1
border.color: StudioTheme.Values.themeInteraction
}
] //states
},
State {
name: "selected"
when: backgroundCard.isSelected
PropertyChanges {
target: backgroundCard
color:StudioTheme.Values.themeInteraction
border.width: 1
border.color: StudioTheme.Values.themeControlBackgroundPressed
}
}
]
ColumnLayout {
spacing: 2
anchors.fill: parent
Rectangle {
width: 150; height: 150
id: gradientRect
width: 150
height: 150
radius: 16
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter //was top
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
Layout.topMargin: 2
gradient: Gradient {
@@ -174,36 +167,26 @@ Rectangle {
Component.onCompleted: {
var stopsAmount = stopListSize;
var newStops = [];
for (var i = 0; i < stopsAmount; i++ ) {
for (var i = 0; i < stopsAmount; i++) {
newStops.push( stopComponent.createObject(showGr, { "position": stopsPosList[i], "color": stopsColorList[i] }) );
}
showGr.stops = newStops;
}
Rectangle {
id: removeItemRect
AbstractButton {
id: removeButton
visible: editableName && (rectMouseArea.containsMouse || removeButton.hovered)
backgroundRadius: StudioTheme.Values.smallRectWidth
anchors.right: parent.right
anchors.rightMargin: 5
anchors.top: parent.top
anchors.topMargin: 5
height: 16
width: 16
visible: editableName && rectMouseArea.containsMouse
color: "#804682b4"
MouseArea {
anchors.fill: parent;
onClicked: tabBackground.deleteButtonClicked(index);
width: Math.round(StudioTheme.Values.smallRectWidth)
height: Math.round(StudioTheme.Values.smallRectWidth)
buttonIcon: StudioTheme.Constants.closeCross
onClicked: tabBackground.deleteButtonClicked(index)
}
}
Image {
source: "image://icons/close"
fillMode: Image.PreserveAspectFit
anchors.fill: parent;
Layout.alignment: Qt.AlignCenter
} //image remove
} //rectangle remove
} //rectangle gradient
Item {
id: presetNameBox
@@ -212,19 +195,7 @@ Rectangle {
Layout.preferredHeight: backgroundCard.height - gradientRect.height - 4
Layout.bottomMargin: 4
property bool readOnly : true;
onReadOnlyChanged: {
if (!readOnly) {
nameInput.visible = true;
nameInput.forceActiveFocus();
//have to select text like this, otherwise there is an issue with long names
nameInput.cursorPosition = 0;
nameInput.cursorPosition = nameInput.length;
nameInput.selectAll();
}
} //onReadOnlyChanged
property bool edit: false
Rectangle {
id: nameBackgroundColor
@@ -233,131 +204,118 @@ Rectangle {
radius: 16
visible: true
anchors.fill: parent
} //rectangle
}
MouseArea {
ToolTipArea {
id: nameMouseArea
visible: tabBackground.editableName
hoverEnabled: true
anchors.fill: parent
tooltip: nameText.text
propagateComposedEvents: true
onClicked: presetNameBox.state = "Clicked";
onEntered: {
if (presetNameBox.state != "Clicked")
{
presetNameBox.state = "Hover";
}
onClicked: {
if (!tabBackground.editableName) {
backgroundCard.selectPreset(index)
return
}
onExited: {
if (presetNameBox.state != "Clicked")
{
presetNameBox.state = "Normal";
presetNameBox.edit = true
nameInput.forceActiveFocus()
// have to select text like this, otherwise there is an issue with long names
nameInput.cursorPosition = 0
nameInput.cursorPosition = nameInput.length
nameInput.selectAll()
}
PrivateControls.Tooltip.hideText()
}
Timer {
interval: 1000
running: nameMouseArea.containsMouse && presetNameBox.readOnly
onTriggered: PrivateControls.Tooltip.showText(nameMouseArea, Qt.point(nameMouseArea.mouseX, nameMouseArea.mouseY), presetName)
}
onCanceled: Tooltip.hideText()
} //mouseArea
Text {
id: nameText
visible: presetNameBox.readOnly
text: presetName
anchors.fill: parent
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
color: "#ffffff"
color: StudioTheme.Values.themeTextColor
elide: Text.ElideMiddle
maximumLineCount: 1
} //text
}
TextInput {
id: nameInput
visible: !presetNameBox.readOnly
enabled: tabBackground.editableName
visible: false
text: presetName
anchors.fill: parent
anchors.leftMargin: 5
anchors.rightMargin: 5
horizontalAlignment: TextInput.AlignHCenter
verticalAlignment: TextInput.AlignVCenter
color: "#ffffff"
selectionColor: "#029de0"
color: StudioTheme.Values.themeTextColor
selectionColor: StudioTheme.Values.themeInteraction
selectByMouse: true
activeFocusOnPress: true
wrapMode: TextInput.NoWrap
clip: true
onEditingFinished: {
nameText.text = text
tabBackground.presetNameChanged(index, text);
presetNameBox.state = "Normal";
tabBackground.presetNameChanged(index, text)
presetNameBox.edit = false
}
Keys.onPressed: {
if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return) {
event.accepted = true;
editingFinished();
focus = false;
} //if
} //Keys.onPressed
} //textInput
event.accepted = true
nameInput.editingFinished()
nameInput.focus = false
}
if (event.key === Qt.Key_Escape) {
event.accepted = true
nameInput.text = nameText.text
nameInput.focus = false
}
}
}
states: [
State {
name: "Normal"
name: "default"
when: tabBackground.editableName && !nameMouseArea.containsMouse && !presetNameBox.edit
PropertyChanges {
target: nameBackgroundColor
color: "transparent"
border.width: 0
}
PropertyChanges {
target: presetNameBox
readOnly: true
}
PropertyChanges { target: nameText; visible: true }
PropertyChanges { target: nameInput; visible: false }
},
State {
name: "Hover"
name: "hovered"
when: tabBackground.editableName && nameMouseArea.containsMouse && !presetNameBox.edit
PropertyChanges {
target: nameBackgroundColor
color: "#606060"
color: StudioTheme.Values.themeControlBackgroundPressed
border.width: 0
}
PropertyChanges {
target: presetNameBox
readOnly: true
}
PropertyChanges { target: nameText; visible: true }
PropertyChanges { target: nameInput; visible: false }
},
State {
name: "Clicked"
name: "edit"
when: tabBackground.editableName && presetNameBox.edit
PropertyChanges {
target: nameBackgroundColor
color: "#606060"
border.color: "#029de0"
color: StudioTheme.Values.themeControlBackgroundPressed
border.color: StudioTheme.Values.themeInteraction
border.width: 1
}
PropertyChanges {
target: presetNameBox
readOnly: false
PropertyChanges { target: nameText; visible: false }
PropertyChanges { target: nameInput; visible: true }
}
PropertyChanges {
target: nameInput
visible: true
]
}
}
] //states
} //gradient name Item
} //columnLayout
} //rectangle background
} //component delegate
} //gridview
} //scrollView
} //rectangle
}
}
}
}
}

View File

@@ -24,16 +24,18 @@
****************************************************************************/
import QtQuick 2.1
import QtQuick.Controls 1.1 as Controls
import HelperWidgets 2.0
import QtQuick.Layouts 1.0
import QtQuick.Controls.Private 1.0
MouseArea {
id: mouseArea
onExited: Tooltip.hideText()
onCanceled: Tooltip.hideText()
Tooltip {
id: myTooltip
}
onExited: myTooltip.hideText()
onCanceled: myTooltip.hideText()
onClicked: forceActiveFocus()
hoverEnabled: true
@@ -43,6 +45,6 @@ MouseArea {
Timer {
interval: 1000
running: mouseArea.containsMouse && tooltip.length
onTriggered: Tooltip.showText(mouseArea, Qt.point(mouseArea.mouseX, mouseArea.mouseY), tooltip)
onTriggered: myTooltip.showText(mouseArea, Qt.point(mouseArea.mouseX, mouseArea.mouseY), tooltip)
}
}

View File

@@ -108,6 +108,8 @@ QtObject {
property string themeSliderInactiveTrackFocus: "#606060"
property string themeSliderHandleFocus: values.themeInteraction
property string themeErrorColor: "#df3a3a"
// NEW NEW NEW NEW NEW
property string themeControlBackgroundDisabled: "#363636"
property string themeControlOutlineDisabled: "#404040"

View File

@@ -161,8 +161,6 @@ CppCodeStylePreferencesWidget::CppCodeStylePreferencesWidget(QWidget *parent)
this, &CppCodeStylePreferencesWidget::slotCodeStyleSettingsChanged);
m_ui->categoryTab->setCurrentIndex(0);
m_ui->tabSettingsWidget->setFlat(true);
}
CppCodeStylePreferencesWidget::~CppCodeStylePreferencesWidget()

View File

@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>463</width>
<height>314</height>
<height>317</height>
</rect>
</property>
<property name="windowTitle">
@@ -69,19 +69,7 @@
<property name="title">
<string>Indent</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="indentAccessSpecifiers">
<property name="text">
@@ -155,19 +143,7 @@
<property name="title">
<string>Indent Braces</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="indentClassBraces">
<property name="text">
@@ -238,19 +214,7 @@
<property name="title">
<string>Indent within &quot;switch&quot;</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="leftMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="indentSwitchLabels">
<property name="text">
@@ -317,19 +281,7 @@
<property name="title">
<string>Align</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<property name="leftMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="alignAssignments">
<property name="toolTip">
@@ -414,9 +366,6 @@ if they would align to the next line</string>
<property name="title">
<string>Bind '*' and '&amp;&amp;' in types/declarations to</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QCheckBox" name="bindStarToIdentifier">

View File

@@ -1617,6 +1617,8 @@ void FakeVimPluginPrivate::editorOpened(IEditor *editor)
tabSettings.m_tabSize = theFakeVimSetting(ConfigTabStop)->value().toInt();
tabSettings.m_tabPolicy = theFakeVimSetting(ConfigExpandTab)->value().toBool()
? TabSettings::SpacesOnlyTabPolicy : TabSettings::TabsOnlyTabPolicy;
tabSettings.m_continuationAlignBehavior =
tew->textDocument()->tabSettings().m_continuationAlignBehavior;
QTextDocument *doc = tew->document();
QTextBlock startBlock = doc->findBlockByNumber(beginBlock);

View File

@@ -143,6 +143,7 @@ extend_qtc_plugin(QmlDesigner
update3dviewstatecommand.cpp update3dviewstatecommand.h
enable3dviewcommand.cpp enable3dviewcommand.h
view3dclosedcommand.cpp view3dclosedcommand.h
puppettocreatorcommand.cpp puppettocreatorcommand.h
)
extend_qtc_plugin(QmlDesigner
@@ -320,6 +321,7 @@ extend_qtc_plugin(QmlDesigner
simplecolorpalette.cpp simplecolorpalette.h
simplecolorpalettemodel.cpp simplecolorpalettemodel.h
simplecolorpalettesingleton.cpp simplecolorpalettesingleton.h
tooltip.cpp tooltip.h
qmlanchorbindingproxy.cpp qmlanchorbindingproxy.h
qmlmodelnodeproxy.cpp qmlmodelnodeproxy.h
quick2propertyeditorview.cpp quick2propertyeditorview.h

View File

@@ -20,7 +20,8 @@ SOURCES += propertyeditorview.cpp \
simplecolorpalettemodel.cpp \
simplecolorpalettesingleton.cpp \
itemfiltermodel.cpp \
aligndistribute.cpp
aligndistribute.cpp \
tooltip.cpp
HEADERS += propertyeditorview.h \
qmlanchorbindingproxy.h \
@@ -42,6 +43,7 @@ HEADERS += propertyeditorview.h \
simplecolorpalettemodel.h \
simplecolorpalettesingleton.h \
itemfiltermodel.h \
aligndistribute.h
aligndistribute.h \
tooltip.h
QT += qml quick
QT += qml quick gui-private

View File

@@ -37,6 +37,7 @@
#include "qmlanchorbindingproxy.h"
#include "theme.h"
#include "aligndistribute.h"
#include "tooltip.h"
namespace QmlDesigner {
@@ -63,6 +64,7 @@ void Quick2PropertyEditorView::registerQmlTypes()
BindingEditor::registerDeclarativeType();
ActionEditor::registerDeclarativeType();
AlignDistribute::registerDeclarativeType();
Tooltip::registerDeclarativeType();
}
}

View File

@@ -0,0 +1,74 @@
/****************************************************************************
**
** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Quick Controls module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** 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 Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** 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-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "tooltip.h"
#include <qquickwindow.h>
#include <qquickitem.h>
#include <QtQuick/QQuickRenderControl>
#include <QtWidgets/qtwidgetsglobal.h>
#include <qtooltip.h>
Tooltip::Tooltip(QObject *parent)
: QObject(parent)
{}
void Tooltip::showText(QQuickItem *item, const QPointF &pos, const QString &str)
{
if (!item || !item->window())
return;
if (QCoreApplication::instance()->inherits("QApplication")) {
QPoint quickWidgetOffsetInTlw;
QWindow *renderWindow = QQuickRenderControl::renderWindowFor(item->window(), &quickWidgetOffsetInTlw);
QWindow *window = renderWindow ? renderWindow : item->window();
const QPoint offsetInQuickWidget = item->mapToScene(pos).toPoint();
const QPoint mappedPos = window->mapToGlobal(offsetInQuickWidget + quickWidgetOffsetInTlw);
QToolTip::showText(mappedPos, str);
}
}
void Tooltip::hideText()
{
QToolTip::hideText();
}
void Tooltip::registerDeclarativeType()
{
qmlRegisterType<Tooltip>("HelperWidgets", 2, 0, "Tooltip");
}

View File

@@ -0,0 +1,67 @@
/****************************************************************************
**
** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Quick Controls module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** 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 Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** 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-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef TOOLTIP_H
#define TOOLTIP_H
#include <QtQml>
#include <QtCore/qobject.h>
QT_BEGIN_NAMESPACE
class QPointF;
class QQuickItem;
QT_END_NAMESPACE
class Tooltip : public QObject
{
Q_OBJECT
public:
explicit Tooltip(QObject *parent = nullptr);
Q_INVOKABLE void showText(QQuickItem *item, const QPointF &pos, const QString &text);
Q_INVOKABLE void hideText();
static void registerDeclarativeType();
};
QML_DECLARE_TYPE(Tooltip)
#endif // TOOLTIP_H

View File

@@ -138,6 +138,8 @@ public:
void mainWindowActiveChanged(bool active, bool hasPopup);
void enable3DView(bool enable);
void handlePuppetToCreatorCommand(const PuppetToCreatorCommand &command) override;
protected:
void timerEvent(QTimerEvent *event) override;
@@ -189,12 +191,13 @@ private: // functions
void restartProcess();
void delayedRestartProcess();
private:
void handleCrash();
void startPuppetTransaction();
void endPuppetTransaction();
private: //variables
// puppet to creator command handlers
void handlePuppetKeyPress(int key, Qt::KeyboardModifiers modifiers);
NodeInstance m_rootNodeInstance;
NodeInstance m_activeStateInstance;

View File

@@ -45,6 +45,7 @@
#include <changenodesourcecommand.h>
#include <changeselectioncommand.h>
#include <drop3dlibraryitemcommand.h>
#include <puppettocreatorcommand.h>
#include <view3dclosedcommand.h>
#include <informationchangedcommand.h>
@@ -285,6 +286,7 @@ void NodeInstanceServerProxy::dispatchCommand(const QVariant &command, PuppetStr
static const int puppetAliveCommandType = QMetaType::type("PuppetAliveCommand");
static const int changeSelectionCommandType = QMetaType::type("ChangeSelectionCommand");
static const int drop3DLibraryItemCommandType = QMetaType::type("Drop3DLibraryItemCommand");
static const int puppetToCreatorCommand = QMetaType::type("PuppetToCreatorCommand");
static const int view3DClosedCommand = QMetaType::type("View3DClosedCommand");
if (m_destructing)
@@ -313,6 +315,8 @@ void NodeInstanceServerProxy::dispatchCommand(const QVariant &command, PuppetStr
nodeInstanceClient()->selectionChanged(command.value<ChangeSelectionCommand>());
} else if (command.userType() == drop3DLibraryItemCommandType) {
nodeInstanceClient()->library3DItemDropped(command.value<Drop3DLibraryItemCommand>());
} else if (command.userType() == puppetToCreatorCommand) {
nodeInstanceClient()->handlePuppetToCreatorCommand(command.value<PuppetToCreatorCommand>());
} else if (command.userType() == view3DClosedCommand) {
nodeInstanceClient()->view3DClosed(command.value<View3DClosedCommand>());
} else if (command.userType() == puppetAliveCommandType) {

View File

@@ -30,7 +30,6 @@
#include <metainfo.h>
#include <nodehints.h>
#include <rewriterview.h>
#include "abstractproperty.h"
#include "variantproperty.h"
#include "bindingproperty.h"
@@ -42,7 +41,7 @@
#include "qmltimeline.h"
#include "qmltimelinekeyframegroup.h"
#include "qmlvisualnode.h"
#include "qmldesignerconstants.h"
#include "createscenecommand.h"
#include "createinstancescommand.h"
#include "clearscenecommand.h"
@@ -71,6 +70,14 @@
#include "removesharedmemorycommand.h"
#include "debugoutputcommand.h"
#include "nodeinstanceserverproxy.h"
#include "puppettocreatorcommand.h"
#ifndef QMLDESIGNER_TEST
#include <qmldesignerplugin.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/documentmanager.h>
#endif
#include <utils/algorithm.h>
#include <utils/qtcassert.h>
@@ -1446,6 +1453,45 @@ void NodeInstanceView::library3DItemDropped(const Drop3DLibraryItemCommand &comm
QmlVisualNode::createQmlVisualNode(this, itemLibraryEntry, {});
}
void NodeInstanceView::handlePuppetToCreatorCommand(const PuppetToCreatorCommand &command)
{
if (command.type() == PuppetToCreatorCommand::Key_Pressed) {
QPair<int, int> data = qvariant_cast<QPair<int, int>>(command.data());
int key = data.first;
Qt::KeyboardModifiers modifiers = Qt::KeyboardModifiers(data.second);
handlePuppetKeyPress(key, modifiers);
}
}
// puppet to creator command handlers
void NodeInstanceView::handlePuppetKeyPress(int key, Qt::KeyboardModifiers modifiers)
{
// TODO: optimal way to handle key events is to just pass them on. This is done
// using the code below but it is so far not working, if someone could get it to work then
// it should be utilized and the rest of the method deleted
// QCoreApplication::postEvent([receiver], new QKeyEvent(QEvent::KeyPress, key, modifiers));
#ifndef QMLDESIGNER_TEST
// handle common keyboard actions coming from puppet
if (Core::ActionManager::command(Core::Constants::UNDO)->keySequence().matches(key + modifiers) == QKeySequence::ExactMatch)
QmlDesignerPlugin::instance()->currentDesignDocument()->undo();
else if (Core::ActionManager::command(Core::Constants::REDO)->keySequence().matches(key + modifiers) == QKeySequence::ExactMatch)
QmlDesignerPlugin::instance()->currentDesignDocument()->redo();
else if (Core::ActionManager::command(Core::Constants::SAVE)->keySequence().matches(key + modifiers) == QKeySequence::ExactMatch)
Core::EditorManager::saveDocument();
else if (Core::ActionManager::command(Core::Constants::SAVEAS)->keySequence().matches(key + modifiers) == QKeySequence::ExactMatch)
Core::EditorManager::saveDocumentAs();
else if (Core::ActionManager::command(Core::Constants::SAVEALL)->keySequence().matches(key + modifiers) == QKeySequence::ExactMatch)
Core::DocumentManager::saveAllModifiedDocuments();
else if (Core::ActionManager::command(QmlDesigner::Constants::C_DELETE)->keySequence().matches(key + modifiers) == QKeySequence::ExactMatch)
QmlDesignerPlugin::instance()->currentDesignDocument()->deleteSelected();
#else
Q_UNUSED(key);
Q_UNUSED(modifiers);
#endif
}
void NodeInstanceView::view3DClosed(const View3DClosedCommand &command)
{
Q_UNUSED(command)

View File

@@ -12,7 +12,7 @@ Project {
Depends {
name: "Qt";
submodules: [
"core-private", "quickwidgets"
"core-private", "gui-private", "quickwidgets"
]
}
Depends { name: "Core" }
@@ -177,6 +177,8 @@ Project {
"commands/enable3dviewcommand.h",
"commands/view3dclosedcommand.cpp",
"commands/view3dclosedcommand.h",
"commands/puppettocreatorcommand.cpp",
"commands/puppettocreatorcommand.h",
"container/addimportcontainer.cpp",
"container/addimportcontainer.h",
"container/idcontainer.cpp",
@@ -618,6 +620,8 @@ Project {
"propertyeditor/simplecolorpalettemodel.h",
"propertyeditor/simplecolorpalettesingleton.cpp",
"propertyeditor/simplecolorpalettesingleton.h",
"propertyeditor/tooltip.cpp",
"propertyeditor/tooltip.h",
"resources/resources.qrc",
"stateseditor/stateseditorimageprovider.cpp",
"stateseditor/stateseditorimageprovider.h",

View File

@@ -301,8 +301,10 @@ static bool isClosingParenthesis(QChar c)
void Highlighter::highlightBlock(const QString &text)
{
if (!definition().isValid())
if (!definition().isValid()) {
formatSpaces(text);
return;
}
QTextBlock block = currentBlock();
KSyntaxHighlighting::State state;
TextDocumentLayout::setBraceDepth(block, TextDocumentLayout::braceDepth(block.previous()));

View File

@@ -89,11 +89,6 @@ void SimpleCodeStylePreferencesWidget::slotTabSettingsChanged(const TextEditor::
current->setTabSettings(settings);
}
void SimpleCodeStylePreferencesWidget::setFlat(bool on)
{
m_tabSettingsWidget->setFlat(on);
}
TabSettingsWidget *SimpleCodeStylePreferencesWidget::tabSettingsWidget() const
{
return m_tabSettingsWidget;

View File

@@ -46,7 +46,6 @@ public:
void setPreferences(ICodeStylePreferences *tabPreferences);
void setFlat(bool on);
TabSettingsWidget *tabSettingsWidget() const;
private:

View File

@@ -32,7 +32,7 @@
namespace TextEditor {
TabSettingsWidget::TabSettingsWidget(QWidget *parent) :
QWidget(parent),
QGroupBox(parent),
ui(new Internal::Ui::TabSettingsWidget)
{
ui->setupUi(this);
@@ -91,13 +91,6 @@ void TabSettingsWidget::codingStyleLinkActivated(const QString &linkString)
emit codingStyleLinkClicked(QtQuickLink);
}
void TabSettingsWidget::setFlat(bool on)
{
ui->tabsAndIndentationGroupBox->setFlat(on);
const int margin = on ? 0 : -1;
ui->tabsAndIndentationGroupBox->layout()->setContentsMargins(margin, -1, margin, margin);
}
void TabSettingsWidget::setCodingStyleWarningVisible(bool visible)
{
ui->codingStyleWarning->setVisible(visible);

View File

@@ -27,7 +27,7 @@
#include "texteditor_global.h"
#include <QWidget>
#include <QGroupBox>
namespace TextEditor {
@@ -35,7 +35,7 @@ namespace Internal { namespace Ui { class TabSettingsWidget; } }
class TabSettings;
class TEXTEDITOR_EXPORT TabSettingsWidget : public QWidget
class TEXTEDITOR_EXPORT TabSettingsWidget : public QGroupBox
{
Q_OBJECT
@@ -50,7 +50,6 @@ public:
TabSettings tabSettings() const;
void setFlat(bool on);
void setCodingStyleWarningVisible(bool visible);
void setTabSettings(const TextEditor::TabSettings& s);

View File

@@ -1,28 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TextEditor::Internal::TabSettingsWidget</class>
<widget class="QWidget" name="TextEditor::Internal::TabSettingsWidget">
<widget class="QGroupBox" name="TextEditor::Internal::TabSettingsWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>335</width>
<height>224</height>
<width>254</width>
<height>189</height>
</rect>
</property>
<property name="windowTitle">
<string/>
<string notr="true"/>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="tabsAndIndentationGroupBox">
<property name="title">
<string>Tabs And Indentation</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="codingStyleWarning">
<property name="toolTip">
<string>The text editor indentation setting is used for non-code files only. See the C++ and Qt Quick coding style settings to configure indentation for code files.</string>
</property>
<property name="text">
<string>&lt;i&gt;Code indentation is configured in &lt;a href=&quot;C++&quot;&gt;C++&lt;/a&gt; and &lt;a href=&quot;QtQuick&quot;&gt;Qt Quick&lt;/a&gt; settings.&lt;/i&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="tabPolicyLabel">
<property name="text">
<string>Tab policy:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
@@ -145,6 +159,13 @@
</item>
</layout>
</item>
<item row="4" column="0" colspan="2">
<widget class="QLabel" name="continuationAlignBehaviorLabel">
<property name="text">
<string>Align continuation lines:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QComboBox" name="continuationAlignBehavior">
<property name="sizePolicy">
@@ -197,36 +218,6 @@ Influences the indentation of continuation lines.
</item>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="tabPolicyLabel">
<property name="text">
<string>Tab policy:</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QLabel" name="continuationAlignBehaviorLabel">
<property name="text">
<string>Align continuation lines:</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="codingStyleWarning">
<property name="toolTip">
<string>The text editor indentation setting is used for non-code files only. See the C++ and Qt Quick coding style settings to configure indentation for code files.</string>
</property>
<property name="text">
<string>&lt;i&gt;Code indentation is configured in &lt;a href=&quot;C++&quot;&gt;C++&lt;/a&gt; and &lt;a href=&quot;QtQuick&quot;&gt;Qt Quick&lt;/a&gt; settings.&lt;/i&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<tabstops>

View File

@@ -49,6 +49,7 @@ extend_qtc_executable(qml2puppet
update3dviewstatecommand.cpp update3dviewstatecommand.h
enable3dviewcommand.cpp enable3dviewcommand.h
view3dclosedcommand.cpp view3dclosedcommand.h
puppettocreatorcommand.cpp puppettocreatorcommand.h
valueschangedcommand.cpp
)

View File

@@ -103,6 +103,8 @@ QtcTool {
"commands/enable3dviewcommand.h",
"commands/view3dclosedcommand.cpp",
"commands/view3dclosedcommand.h",
"commands/puppettocreatorcommand.cpp",
"commands/puppettocreatorcommand.h",
"container/addimportcontainer.cpp",
"container/addimportcontainer.h",
"container/idcontainer.cpp",