forked from qt-creator/qt-creator
QmlDesigner: Modernize
modernize-use-auto modernize-use-nullptr modernize-use-override modernize-use-using modernize-use-default-member-init modernize-use-equals-default Change-Id: Ic42b5c59fed5a4a01853138542d8156471e86f58 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -29,9 +29,7 @@
|
|||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
ChangeAuxiliaryCommand::ChangeAuxiliaryCommand()
|
ChangeAuxiliaryCommand::ChangeAuxiliaryCommand() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
ChangeAuxiliaryCommand::ChangeAuxiliaryCommand(const QVector<PropertyValueContainer> &auxiliaryChangeVector)
|
ChangeAuxiliaryCommand::ChangeAuxiliaryCommand(const QVector<PropertyValueContainer> &auxiliaryChangeVector)
|
||||||
: m_auxiliaryChangeVector (auxiliaryChangeVector)
|
: m_auxiliaryChangeVector (auxiliaryChangeVector)
|
||||||
|
@@ -29,9 +29,7 @@
|
|||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
ChangeBindingsCommand::ChangeBindingsCommand()
|
ChangeBindingsCommand::ChangeBindingsCommand() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
ChangeBindingsCommand::ChangeBindingsCommand(const QVector<PropertyBindingContainer> &bindingChangeVector)
|
ChangeBindingsCommand::ChangeBindingsCommand(const QVector<PropertyBindingContainer> &bindingChangeVector)
|
||||||
: m_bindingChangeVector (bindingChangeVector)
|
: m_bindingChangeVector (bindingChangeVector)
|
||||||
|
@@ -30,9 +30,7 @@
|
|||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
ChangeFileUrlCommand::ChangeFileUrlCommand()
|
ChangeFileUrlCommand::ChangeFileUrlCommand() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
ChangeFileUrlCommand::ChangeFileUrlCommand(const QUrl &fileUrl)
|
ChangeFileUrlCommand::ChangeFileUrlCommand(const QUrl &fileUrl)
|
||||||
: m_fileUrl(fileUrl)
|
: m_fileUrl(fileUrl)
|
||||||
|
@@ -29,9 +29,7 @@
|
|||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
ChangeIdsCommand::ChangeIdsCommand()
|
ChangeIdsCommand::ChangeIdsCommand() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
ChangeIdsCommand::ChangeIdsCommand(const QVector<IdContainer> &idVector)
|
ChangeIdsCommand::ChangeIdsCommand(const QVector<IdContainer> &idVector)
|
||||||
: m_idVector(idVector)
|
: m_idVector(idVector)
|
||||||
|
@@ -30,9 +30,7 @@
|
|||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
ChangeNodeSourceCommand::ChangeNodeSourceCommand()
|
ChangeNodeSourceCommand::ChangeNodeSourceCommand() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
ChangeNodeSourceCommand::ChangeNodeSourceCommand(qint32 newInstanceId, const QString &newNodeSource)
|
ChangeNodeSourceCommand::ChangeNodeSourceCommand(qint32 newInstanceId, const QString &newNodeSource)
|
||||||
: m_instanceId(newInstanceId), m_nodeSource(newNodeSource)
|
: m_instanceId(newInstanceId), m_nodeSource(newNodeSource)
|
||||||
|
@@ -29,9 +29,7 @@
|
|||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
ChangeValuesCommand::ChangeValuesCommand()
|
ChangeValuesCommand::ChangeValuesCommand() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
ChangeValuesCommand::ChangeValuesCommand(const QVector<PropertyValueContainer> &valueChangeVector)
|
ChangeValuesCommand::ChangeValuesCommand(const QVector<PropertyValueContainer> &valueChangeVector)
|
||||||
: m_valueChangeVector (valueChangeVector)
|
: m_valueChangeVector (valueChangeVector)
|
||||||
|
@@ -29,9 +29,7 @@
|
|||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
ClearSceneCommand::ClearSceneCommand()
|
ClearSceneCommand::ClearSceneCommand() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QDataStream &operator<<(QDataStream &out, const ClearSceneCommand &/*command*/)
|
QDataStream &operator<<(QDataStream &out, const ClearSceneCommand &/*command*/)
|
||||||
{
|
{
|
||||||
|
@@ -30,9 +30,7 @@
|
|||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
CompleteComponentCommand::CompleteComponentCommand()
|
CompleteComponentCommand::CompleteComponentCommand() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
CompleteComponentCommand::CompleteComponentCommand(const QVector<qint32> &container)
|
CompleteComponentCommand::CompleteComponentCommand(const QVector<qint32> &container)
|
||||||
: m_instanceVector(container)
|
: m_instanceVector(container)
|
||||||
|
@@ -32,9 +32,7 @@
|
|||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
ComponentCompletedCommand::ComponentCompletedCommand()
|
ComponentCompletedCommand::ComponentCompletedCommand() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
ComponentCompletedCommand::ComponentCompletedCommand(const QVector<qint32> &container)
|
ComponentCompletedCommand::ComponentCompletedCommand(const QVector<qint32> &container)
|
||||||
: m_instanceVector(container)
|
: m_instanceVector(container)
|
||||||
|
@@ -30,9 +30,7 @@
|
|||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
CreateInstancesCommand::CreateInstancesCommand()
|
CreateInstancesCommand::CreateInstancesCommand() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
CreateInstancesCommand::CreateInstancesCommand(const QVector<InstanceContainer> &container)
|
CreateInstancesCommand::CreateInstancesCommand(const QVector<InstanceContainer> &container)
|
||||||
: m_instanceVector(container)
|
: m_instanceVector(container)
|
||||||
|
@@ -29,9 +29,7 @@
|
|||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
CreateSceneCommand::CreateSceneCommand()
|
CreateSceneCommand::CreateSceneCommand() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
CreateSceneCommand::CreateSceneCommand(const QVector<InstanceContainer> &instanceContainer,
|
CreateSceneCommand::CreateSceneCommand(const QVector<InstanceContainer> &instanceContainer,
|
||||||
const QVector<ReparentContainer> &reparentContainer,
|
const QVector<ReparentContainer> &reparentContainer,
|
||||||
|
@@ -29,9 +29,7 @@
|
|||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
DebugOutputCommand::DebugOutputCommand()
|
DebugOutputCommand::DebugOutputCommand() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
DebugOutputCommand::DebugOutputCommand(const QString &text, DebugOutputCommand::Type type, const QVector<qint32> &instanceIds)
|
DebugOutputCommand::DebugOutputCommand(const QString &text, DebugOutputCommand::Type type, const QVector<qint32> &instanceIds)
|
||||||
: m_instanceIds(instanceIds)
|
: m_instanceIds(instanceIds)
|
||||||
|
@@ -29,9 +29,7 @@
|
|||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
EndPuppetCommand::EndPuppetCommand()
|
EndPuppetCommand::EndPuppetCommand() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QDataStream &operator<<(QDataStream &out, const EndPuppetCommand &/*command*/)
|
QDataStream &operator<<(QDataStream &out, const EndPuppetCommand &/*command*/)
|
||||||
{
|
{
|
||||||
|
@@ -34,9 +34,7 @@
|
|||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
InformationChangedCommand::InformationChangedCommand()
|
InformationChangedCommand::InformationChangedCommand() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
InformationChangedCommand::InformationChangedCommand(const QVector<InformationContainer> &informationVector)
|
InformationChangedCommand::InformationChangedCommand(const QVector<InformationContainer> &informationVector)
|
||||||
: m_informationVector(informationVector)
|
: m_informationVector(informationVector)
|
||||||
|
@@ -33,9 +33,7 @@
|
|||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
PixmapChangedCommand::PixmapChangedCommand()
|
PixmapChangedCommand::PixmapChangedCommand() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
PixmapChangedCommand::PixmapChangedCommand(const QVector<ImageContainer> &imageVector)
|
PixmapChangedCommand::PixmapChangedCommand(const QVector<ImageContainer> &imageVector)
|
||||||
: m_imageVector(imageVector)
|
: m_imageVector(imageVector)
|
||||||
|
@@ -27,9 +27,7 @@
|
|||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
PuppetAliveCommand::PuppetAliveCommand()
|
PuppetAliveCommand::PuppetAliveCommand() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QDataStream &operator<<(QDataStream &out, const PuppetAliveCommand &/*command*/)
|
QDataStream &operator<<(QDataStream &out, const PuppetAliveCommand &/*command*/)
|
||||||
{
|
{
|
||||||
|
@@ -30,9 +30,7 @@
|
|||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
RemoveInstancesCommand::RemoveInstancesCommand()
|
RemoveInstancesCommand::RemoveInstancesCommand() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
RemoveInstancesCommand::RemoveInstancesCommand(const QVector<qint32> &idVector)
|
RemoveInstancesCommand::RemoveInstancesCommand(const QVector<qint32> &idVector)
|
||||||
: m_instanceIdVector(idVector)
|
: m_instanceIdVector(idVector)
|
||||||
|
@@ -29,9 +29,7 @@
|
|||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
RemovePropertiesCommand::RemovePropertiesCommand()
|
RemovePropertiesCommand::RemovePropertiesCommand() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
RemovePropertiesCommand::RemovePropertiesCommand(const QVector<PropertyAbstractContainer> &properties)
|
RemovePropertiesCommand::RemovePropertiesCommand(const QVector<PropertyAbstractContainer> &properties)
|
||||||
: m_properties(properties)
|
: m_properties(properties)
|
||||||
|
@@ -30,9 +30,7 @@
|
|||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
RemoveSharedMemoryCommand::RemoveSharedMemoryCommand()
|
RemoveSharedMemoryCommand::RemoveSharedMemoryCommand() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
RemoveSharedMemoryCommand::RemoveSharedMemoryCommand(const QString &typeName, const QVector<qint32> &keyNumberVector)
|
RemoveSharedMemoryCommand::RemoveSharedMemoryCommand(const QString &typeName, const QVector<qint32> &keyNumberVector)
|
||||||
: m_typeName(typeName),
|
: m_typeName(typeName),
|
||||||
|
@@ -30,9 +30,7 @@
|
|||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
ReparentInstancesCommand::ReparentInstancesCommand()
|
ReparentInstancesCommand::ReparentInstancesCommand() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
ReparentInstancesCommand::ReparentInstancesCommand(const QVector<ReparentContainer> &container)
|
ReparentInstancesCommand::ReparentInstancesCommand(const QVector<ReparentContainer> &container)
|
||||||
: m_reparentInstanceVector(container)
|
: m_reparentInstanceVector(container)
|
||||||
|
@@ -31,9 +31,7 @@
|
|||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
StatePreviewImageChangedCommand::StatePreviewImageChangedCommand()
|
StatePreviewImageChangedCommand::StatePreviewImageChangedCommand() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
StatePreviewImageChangedCommand::StatePreviewImageChangedCommand(const QVector<ImageContainer> &imageVector)
|
StatePreviewImageChangedCommand::StatePreviewImageChangedCommand(const QVector<ImageContainer> &imageVector)
|
||||||
: m_previewVector(imageVector)
|
: m_previewVector(imageVector)
|
||||||
|
@@ -36,7 +36,7 @@
|
|||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
// using cache as a container which deletes sharedmemory pointers at process exit
|
// using cache as a container which deletes sharedmemory pointers at process exit
|
||||||
typedef QCache<qint32, SharedMemory> GlobalSharedMemoryContainer;
|
using GlobalSharedMemoryContainer = QCache<qint32, SharedMemory>;
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(GlobalSharedMemoryContainer, globalSharedMemoryContainer, (10000))
|
Q_GLOBAL_STATIC_WITH_ARGS(GlobalSharedMemoryContainer, globalSharedMemoryContainer, (10000))
|
||||||
|
|
||||||
ValuesChangedCommand::ValuesChangedCommand()
|
ValuesChangedCommand::ValuesChangedCommand()
|
||||||
@@ -88,7 +88,7 @@ static SharedMemory *createSharedMemory(qint32 key, int byteCount)
|
|||||||
delete sharedMemory;
|
delete sharedMemory;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDataStream &operator<<(QDataStream &out, const ValuesChangedCommand &command)
|
QDataStream &operator<<(QDataStream &out, const ValuesChangedCommand &command)
|
||||||
|
@@ -30,9 +30,7 @@
|
|||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
AddImportContainer::AddImportContainer()
|
AddImportContainer::AddImportContainer() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
AddImportContainer::AddImportContainer(const QUrl &url, const QString &fileName, const QString &version, const QString &alias, const QStringList &importPathList)
|
AddImportContainer::AddImportContainer(const QUrl &url, const QString &fileName, const QString &version, const QString &alias, const QStringList &importPathList)
|
||||||
: m_url(url),
|
: m_url(url),
|
||||||
|
@@ -39,7 +39,7 @@
|
|||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
// using cache as a container which deletes sharedmemory pointers at process exit
|
// using cache as a container which deletes sharedmemory pointers at process exit
|
||||||
typedef QCache<qint32, SharedMemory> GlobalSharedMemoryContainer;
|
using GlobalSharedMemoryContainer = QCache<qint32, SharedMemory>;
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(GlobalSharedMemoryContainer, globalSharedMemoryContainer, (10000))
|
Q_GLOBAL_STATIC_WITH_ARGS(GlobalSharedMemoryContainer, globalSharedMemoryContainer, (10000))
|
||||||
|
|
||||||
ImageContainer::ImageContainer()
|
ImageContainer::ImageContainer()
|
||||||
@@ -91,14 +91,14 @@ static SharedMemory *createSharedMemory(qint32 key, int byteCount)
|
|||||||
{
|
{
|
||||||
SharedMemory *sharedMemory = (*globalSharedMemoryContainer())[key];
|
SharedMemory *sharedMemory = (*globalSharedMemoryContainer())[key];
|
||||||
|
|
||||||
if (sharedMemory == 0) {
|
if (sharedMemory == nullptr) {
|
||||||
sharedMemory = new SharedMemory(QString(imageKeyTemplateString).arg(key));
|
sharedMemory = new SharedMemory(QString(imageKeyTemplateString).arg(key));
|
||||||
bool sharedMemoryIsCreated = sharedMemory->create(byteCount);
|
bool sharedMemoryIsCreated = sharedMemory->create(byteCount);
|
||||||
if (sharedMemoryIsCreated) {
|
if (sharedMemoryIsCreated) {
|
||||||
globalSharedMemoryContainer()->insert(key, sharedMemory);
|
globalSharedMemoryContainer()->insert(key, sharedMemory);
|
||||||
} else {
|
} else {
|
||||||
delete sharedMemory;
|
delete sharedMemory;
|
||||||
sharedMemory = 0;
|
sharedMemory = nullptr;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
bool sharedMemoryIsAttached = sharedMemory->isAttached();
|
bool sharedMemoryIsAttached = sharedMemory->isAttached();
|
||||||
@@ -117,7 +117,7 @@ static SharedMemory *createSharedMemory(qint32 key, int byteCount)
|
|||||||
|
|
||||||
if (!sharedMemory->isAttached()) {
|
if (!sharedMemory->isAttached()) {
|
||||||
globalSharedMemoryContainer()->remove(key);
|
globalSharedMemoryContainer()->remove(key);
|
||||||
sharedMemory = 0;
|
sharedMemory = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,7 +165,7 @@ QDataStream &operator<<(QDataStream &out, const ImageContainer &container)
|
|||||||
} else {
|
} else {
|
||||||
SharedMemory *sharedMemory = createSharedMemory(container.keyNumber(), image.byteCount() + extraDataSize);
|
SharedMemory *sharedMemory = createSharedMemory(container.keyNumber(), image.byteCount() + extraDataSize);
|
||||||
|
|
||||||
out << qint32(sharedMemory != 0); // send if shared memory is used
|
out << qint32(sharedMemory != nullptr); // send if shared memory is used
|
||||||
|
|
||||||
if (sharedMemory)
|
if (sharedMemory)
|
||||||
writeSharedMemory(sharedMemory, image);
|
writeSharedMemory(sharedMemory, image);
|
||||||
|
@@ -40,9 +40,7 @@ static TypeName properDelemitingOfType(const TypeName &typeName)
|
|||||||
return convertedTypeName;
|
return convertedTypeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
InstanceContainer::InstanceContainer()
|
InstanceContainer::InstanceContainer() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
InstanceContainer::InstanceContainer(qint32 instanceId,
|
InstanceContainer::InstanceContainer(qint32 instanceId,
|
||||||
const TypeName &type,
|
const TypeName &type,
|
||||||
|
@@ -29,10 +29,7 @@
|
|||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
QmlDesigner::MockupTypeContainer::MockupTypeContainer()
|
QmlDesigner::MockupTypeContainer::MockupTypeContainer() = default;
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
QmlDesigner::MockupTypeContainer::MockupTypeContainer(const QmlDesigner::TypeName &type,
|
QmlDesigner::MockupTypeContainer::MockupTypeContainer(const QmlDesigner::TypeName &type,
|
||||||
const QString &importUri,
|
const QString &importUri,
|
||||||
|
@@ -27,18 +27,14 @@
|
|||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
SharedMemory::SharedMemory()
|
SharedMemory::SharedMemory() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
SharedMemory::SharedMemory(const QString &key)
|
SharedMemory::SharedMemory(const QString &key)
|
||||||
: m_sharedMemory(key)
|
: m_sharedMemory(key)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedMemory::~SharedMemory()
|
SharedMemory::~SharedMemory() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void SharedMemory::setKey(const QString &key)
|
void SharedMemory::setKey(const QString &key)
|
||||||
{
|
{
|
||||||
|
@@ -30,8 +30,8 @@
|
|||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
typedef QByteArray PropertyName;
|
using PropertyName = QByteArray;
|
||||||
typedef QList<PropertyName> PropertyNameList;
|
using PropertyNameList = QList<PropertyName>;
|
||||||
typedef QByteArray TypeName;
|
using TypeName = QByteArray;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -59,7 +59,7 @@ public:
|
|||||||
TestModus // No preview images and synchronized
|
TestModus // No preview images and synchronized
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit NodeInstanceServerInterface(QObject *parent = 0);
|
explicit NodeInstanceServerInterface(QObject *parent = nullptr);
|
||||||
|
|
||||||
virtual void createInstances(const CreateInstancesCommand &command) = 0;
|
virtual void createInstances(const CreateInstancesCommand &command) = 0;
|
||||||
virtual void changeFileUrl(const ChangeFileUrlCommand &command) = 0;
|
virtual void changeFileUrl(const ChangeFileUrlCommand &command) = 0;
|
||||||
|
@@ -31,9 +31,7 @@
|
|||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
Enumeration::Enumeration()
|
Enumeration::Enumeration() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Enumeration::Enumeration(const EnumerationName &enumerationName)
|
Enumeration::Enumeration(const EnumerationName &enumerationName)
|
||||||
: m_enumerationName(enumerationName)
|
: m_enumerationName(enumerationName)
|
||||||
|
@@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
typedef QByteArray EnumerationName;
|
using EnumerationName = QByteArray;
|
||||||
|
|
||||||
class Enumeration
|
class Enumeration
|
||||||
{
|
{
|
||||||
|
@@ -74,7 +74,7 @@ SelectionContext AbstractAction::selectionContext() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
DefaultAction::DefaultAction(const QString &description)
|
DefaultAction::DefaultAction(const QString &description)
|
||||||
: QAction(description, 0)
|
: QAction(description, nullptr)
|
||||||
{
|
{
|
||||||
connect(this, &QAction::triggered, this, &DefaultAction::actionTriggered);
|
connect(this, &QAction::triggered, this, &DefaultAction::actionTriggered);
|
||||||
}
|
}
|
||||||
|
@@ -52,7 +52,7 @@ public:
|
|||||||
LowestPriority = ComponentCoreConstants::priorityLast
|
LowestPriority = ComponentCoreConstants::priorityLast
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual ~ActionInterface() {}
|
virtual ~ActionInterface() = default;
|
||||||
|
|
||||||
virtual QAction *action() const = 0;
|
virtual QAction *action() const = 0;
|
||||||
virtual QByteArray category() const = 0;
|
virtual QByteArray category() const = 0;
|
||||||
|
@@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
static QTableWidget* createFilesTable(const QStringList &fileNames)
|
static QTableWidget* createFilesTable(const QStringList &fileNames)
|
||||||
{
|
{
|
||||||
QTableWidget *table = new QTableWidget(0, 2);
|
auto table = new QTableWidget(0, 2);
|
||||||
table->setSelectionMode(QAbstractItemView::NoSelection);
|
table->setSelectionMode(QAbstractItemView::NoSelection);
|
||||||
|
|
||||||
QStringList labels({
|
QStringList labels({
|
||||||
@@ -55,7 +55,7 @@ static QTableWidget* createFilesTable(const QStringList &fileNames)
|
|||||||
const QString toolTip = QDir::toNativeSeparators(filePath);
|
const QString toolTip = QDir::toNativeSeparators(filePath);
|
||||||
const QString fileName = QFileInfo(filePath).fileName();
|
const QString fileName = QFileInfo(filePath).fileName();
|
||||||
const qint64 size = QFileInfo(filePath).size() / 1024;
|
const qint64 size = QFileInfo(filePath).size() / 1024;
|
||||||
QTableWidgetItem *fileNameItem = new QTableWidgetItem(fileName);
|
auto fileNameItem = new QTableWidgetItem(fileName);
|
||||||
fileNameItem->setToolTip(toolTip);
|
fileNameItem->setToolTip(toolTip);
|
||||||
fileNameItem->setFlags(fileNameItem->flags() ^ Qt::ItemIsEditable);
|
fileNameItem->setFlags(fileNameItem->flags() ^ Qt::ItemIsEditable);
|
||||||
QTableWidgetItem *sizeItem = new QTableWidgetItem(QString::number(size) + " KB");
|
QTableWidgetItem *sizeItem = new QTableWidgetItem(QString::number(size) + " KB");
|
||||||
@@ -74,7 +74,7 @@ static QTableWidget* createFilesTable(const QStringList &fileNames)
|
|||||||
|
|
||||||
QComboBox *createDirectoryComboBox(const QString &defaultDirectory)
|
QComboBox *createDirectoryComboBox(const QString &defaultDirectory)
|
||||||
{
|
{
|
||||||
QComboBox *comboBox = new QComboBox;
|
auto comboBox = new QComboBox;
|
||||||
comboBox->addItem(defaultDirectory);
|
comboBox->addItem(defaultDirectory);
|
||||||
comboBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
comboBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ QString AddImagesDialog::getDirectory(const QStringList &fileNames, const QStrin
|
|||||||
dialog->setWindowTitle(QCoreApplication::translate("AddImageToResources","Add Resources"));
|
dialog->setWindowTitle(QCoreApplication::translate("AddImageToResources","Add Resources"));
|
||||||
QTableWidget *table = createFilesTable(fileNames);
|
QTableWidget *table = createFilesTable(fileNames);
|
||||||
table->setParent(dialog);
|
table->setParent(dialog);
|
||||||
QGridLayout *mainLayout = new QGridLayout(dialog);
|
auto mainLayout = new QGridLayout(dialog);
|
||||||
mainLayout->addWidget(table, 0, 0, 1, 4);
|
mainLayout->addWidget(table, 0, 0, 1, 4);
|
||||||
|
|
||||||
QComboBox *directoryComboBox = createDirectoryComboBox(defaultDirectory);
|
QComboBox *directoryComboBox = createDirectoryComboBox(defaultDirectory);
|
||||||
|
@@ -61,7 +61,7 @@ const char disbledTooltip[] = QT_TRANSLATE_NOOP("ChangeStyleWidgetAction",
|
|||||||
|
|
||||||
QWidget *ChangeStyleWidgetAction::createWidget(QWidget *parent)
|
QWidget *ChangeStyleWidgetAction::createWidget(QWidget *parent)
|
||||||
{
|
{
|
||||||
QComboBox *comboBox = new QComboBox(parent);
|
auto comboBox = new QComboBox(parent);
|
||||||
comboBox->setToolTip(tr(enabledTooltip));
|
comboBox->setToolTip(tr(enabledTooltip));
|
||||||
comboBox->addItem("Default");
|
comboBox->addItem("Default");
|
||||||
comboBox->addItem("Fusion");
|
comboBox->addItem("Fusion");
|
||||||
|
@@ -71,7 +71,7 @@ DesignerActionManagerView *DesignerActionManager::view()
|
|||||||
|
|
||||||
DesignerActionToolBar *DesignerActionManager::createToolBar(QWidget *parent) const
|
DesignerActionToolBar *DesignerActionManager::createToolBar(QWidget *parent) const
|
||||||
{
|
{
|
||||||
DesignerActionToolBar *toolBar = new DesignerActionToolBar(parent);
|
auto toolBar = new DesignerActionToolBar(parent);
|
||||||
|
|
||||||
QList<ActionInterface* > categories = Utils::filtered(designerActions(), [](ActionInterface *action) {
|
QList<ActionInterface* > categories = Utils::filtered(designerActions(), [](ActionInterface *action) {
|
||||||
return action->type() == ActionInterface::ContextMenu;
|
return action->type() == ActionInterface::ContextMenu;
|
||||||
@@ -149,13 +149,13 @@ QGraphicsWidget *DesignerActionManager::createFormEditorToolBar(QGraphicsItem *p
|
|||||||
|
|
||||||
QGraphicsWidget *toolbar = new QGraphicsWidget(parent);
|
QGraphicsWidget *toolbar = new QGraphicsWidget(parent);
|
||||||
|
|
||||||
QGraphicsLinearLayout *layout = new QGraphicsLinearLayout;
|
auto layout = new QGraphicsLinearLayout;
|
||||||
layout->setContentsMargins(0, 0, 0, 0);
|
layout->setContentsMargins(0, 0, 0, 0);
|
||||||
layout->setSpacing(0);
|
layout->setSpacing(0);
|
||||||
toolbar->setLayout(layout);
|
toolbar->setLayout(layout);
|
||||||
|
|
||||||
for (ActionInterface *action : actions) {
|
for (ActionInterface *action : actions) {
|
||||||
FormEditorToolButton *button = new FormEditorToolButton(action->action(), toolbar);
|
auto button = new FormEditorToolButton(action->action(), toolbar);
|
||||||
layout->addItem(button);
|
layout->addItem(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1036,9 +1036,7 @@ DesignerActionManager::DesignerActionManager(DesignerActionManagerView *designer
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
DesignerActionManager::~DesignerActionManager()
|
DesignerActionManager::~DesignerActionManager() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
DesignerActionToolBar::DesignerActionToolBar(QWidget *parentWidget) : Utils::StyledBar(parentWidget),
|
DesignerActionToolBar::DesignerActionToolBar(QWidget *parentWidget) : Utils::StyledBar(parentWidget),
|
||||||
m_toolBar(new QToolBar("ActionToolBar", this))
|
m_toolBar(new QToolBar("ActionToolBar", this))
|
||||||
@@ -1048,7 +1046,7 @@ DesignerActionToolBar::DesignerActionToolBar(QWidget *parentWidget) : Utils::Sty
|
|||||||
m_toolBar->setMovable(true);
|
m_toolBar->setMovable(true);
|
||||||
m_toolBar->setOrientation(Qt::Horizontal);
|
m_toolBar->setOrientation(Qt::Horizontal);
|
||||||
|
|
||||||
QHBoxLayout *horizontalLayout = new QHBoxLayout(this);
|
auto horizontalLayout = new QHBoxLayout(this);
|
||||||
|
|
||||||
horizontalLayout->setMargin(0);
|
horizontalLayout->setMargin(0);
|
||||||
horizontalLayout->setSpacing(0);
|
horizontalLayout->setSpacing(0);
|
||||||
@@ -1066,7 +1064,7 @@ void DesignerActionToolBar::registerAction(ActionInterface *action)
|
|||||||
|
|
||||||
void DesignerActionToolBar::addSeparator()
|
void DesignerActionToolBar::addSeparator()
|
||||||
{
|
{
|
||||||
QAction *separatorAction = new QAction(m_toolBar);
|
auto separatorAction = new QAction(m_toolBar);
|
||||||
separatorAction->setSeparator(true);
|
separatorAction->setSeparator(true);
|
||||||
m_toolBar->addAction(separatorAction);
|
m_toolBar->addAction(separatorAction);
|
||||||
}
|
}
|
||||||
|
@@ -42,7 +42,7 @@ namespace QmlDesigner {
|
|||||||
|
|
||||||
class DesignerActionManagerView;
|
class DesignerActionManagerView;
|
||||||
|
|
||||||
typedef std::function<bool (const QStringList &filenames, const QString &defaulTargetDirectory)> AddResourceOperation;
|
using AddResourceOperation = std::function<bool (const QStringList&, const QString&)>;
|
||||||
|
|
||||||
struct AddResourceHandler
|
struct AddResourceHandler
|
||||||
{
|
{
|
||||||
|
@@ -32,7 +32,7 @@
|
|||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
DesignerActionManagerView::DesignerActionManagerView()
|
DesignerActionManagerView::DesignerActionManagerView()
|
||||||
: AbstractView(0),
|
: AbstractView(nullptr),
|
||||||
m_designerActionManager(this),
|
m_designerActionManager(this),
|
||||||
m_isInRewriterTransaction(false),
|
m_isInRewriterTransaction(false),
|
||||||
m_setupContextDirty(false)
|
m_setupContextDirty(false)
|
||||||
|
@@ -42,7 +42,7 @@ using namespace QmlJS;
|
|||||||
class FindImplementationVisitor: protected AST::Visitor
|
class FindImplementationVisitor: protected AST::Visitor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef QList<AST::SourceLocation> Results;
|
using Results = QList<AST::SourceLocation>;
|
||||||
|
|
||||||
FindImplementationVisitor(Document::Ptr doc, const ContextPtr &context)
|
FindImplementationVisitor(Document::Ptr doc, const ContextPtr &context)
|
||||||
: m_document(doc)
|
: m_document(doc)
|
||||||
@@ -248,9 +248,7 @@ QString matchingLine(unsigned position, const QString &source)
|
|||||||
} //namespace
|
} //namespace
|
||||||
|
|
||||||
|
|
||||||
FindImplementation::FindImplementation()
|
FindImplementation::FindImplementation() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<QmlJSEditor::FindReferences::Usage> FindImplementation::run(const QString &fileName,
|
QList<QmlJSEditor::FindReferences::Usage> FindImplementation::run(const QString &fileName,
|
||||||
const QString &typeName,
|
const QString &typeName,
|
||||||
|
@@ -46,7 +46,7 @@ public:
|
|||||||
const QList<ModelNode> &modelNodeList);
|
const QList<ModelNode> &modelNodeList);
|
||||||
static void setSizeAsPreferredSize(const QList<ModelNode> &modelNodeList);
|
static void setSizeAsPreferredSize(const QList<ModelNode> &modelNodeList);
|
||||||
private:
|
private:
|
||||||
typedef std::function<bool(const ModelNode &node1, const ModelNode &node2)> LessThan;
|
using LessThan = std::function<bool (const ModelNode&, const ModelNode&)>;
|
||||||
|
|
||||||
LayoutInGridLayout(const SelectionContext &selectionContext);
|
LayoutInGridLayout(const SelectionContext &selectionContext);
|
||||||
void doIt();
|
void doIt();
|
||||||
|
@@ -91,7 +91,7 @@ void populateMenu(QSet<ActionInterface* > &actionInterfaces,
|
|||||||
|
|
||||||
void ModelNodeContextMenu::execute(const QPoint &position, bool selectionMenuBool)
|
void ModelNodeContextMenu::execute(const QPoint &position, bool selectionMenuBool)
|
||||||
{
|
{
|
||||||
QMenu* mainMenu = new QMenu();
|
auto mainMenu = new QMenu();
|
||||||
|
|
||||||
m_selectionContext.setShowSelectionTools(selectionMenuBool);
|
m_selectionContext.setShowSelectionTools(selectionMenuBool);
|
||||||
m_selectionContext.setScenePosition(m_scenePos);
|
m_selectionContext.setScenePosition(m_scenePos);
|
||||||
|
@@ -41,8 +41,8 @@
|
|||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
typedef std::function<bool (const SelectionContext &context)> SelectionContextPredicate;
|
using SelectionContextPredicate = std::function<bool (const SelectionContext&)>;
|
||||||
typedef std::function<void (const SelectionContext &context)> SelectionContextOperation;
|
using SelectionContextOperation = std::function<void (const SelectionContext&)>;
|
||||||
|
|
||||||
namespace SelectionContextFunctors {
|
namespace SelectionContextFunctors {
|
||||||
|
|
||||||
|
@@ -444,7 +444,7 @@ void anchorsReset(const SelectionContext &selectionState)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef std::function<bool(const ModelNode &node1, const ModelNode &node2)> LessThan;
|
using LessThan = std::function<bool (const ModelNode &, const ModelNode&)>;
|
||||||
|
|
||||||
bool compareByX(const ModelNode &node1, const ModelNode &node2)
|
bool compareByX(const ModelNode &node1, const ModelNode &node2)
|
||||||
{
|
{
|
||||||
@@ -588,9 +588,9 @@ static QString toUpper(const QString signal)
|
|||||||
static void addSignal(const QString &typeName, const QString &itemId, const QString &signalName, bool isRootModelNode)
|
static void addSignal(const QString &typeName, const QString &itemId, const QString &signalName, bool isRootModelNode)
|
||||||
{
|
{
|
||||||
QScopedPointer<Model> model(Model::create("Item", 2, 0));
|
QScopedPointer<Model> model(Model::create("Item", 2, 0));
|
||||||
RewriterView rewriterView(RewriterView::Amend, 0);
|
RewriterView rewriterView(RewriterView::Amend, nullptr);
|
||||||
|
|
||||||
TextEditor::TextEditorWidget *textEdit = qobject_cast<TextEditor::TextEditorWidget*>
|
auto textEdit = qobject_cast<TextEditor::TextEditorWidget*>
|
||||||
(Core::EditorManager::currentEditor()->widget());
|
(Core::EditorManager::currentEditor()->widget());
|
||||||
|
|
||||||
BaseTextEditModifier modifier(textEdit);
|
BaseTextEditModifier modifier(textEdit);
|
||||||
@@ -699,7 +699,7 @@ void addSignalHandlerOrGotoImplementation(const SelectionContext &selectionState
|
|||||||
Core::EditorManager::openEditorAt(usages.constFirst().path, usages.constFirst().line, usages.constFirst().col);
|
Core::EditorManager::openEditorAt(usages.constFirst().path, usages.constFirst().line, usages.constFirst().col);
|
||||||
|
|
||||||
if (!signalNames.isEmpty()) {
|
if (!signalNames.isEmpty()) {
|
||||||
AddSignalHandlerDialog *dialog = new AddSignalHandlerDialog(Core::ICore::dialogParent());
|
auto dialog = new AddSignalHandlerDialog(Core::ICore::dialogParent());
|
||||||
dialog->setSignals(signalNames);
|
dialog->setSignals(signalNames);
|
||||||
|
|
||||||
AddSignalHandlerDialog::connect(dialog, &AddSignalHandlerDialog::signalSelected, [=] {
|
AddSignalHandlerDialog::connect(dialog, &AddSignalHandlerDialog::signalSelected, [=] {
|
||||||
|
@@ -71,7 +71,7 @@ void ZoomAction::setZoomLevel(double zoomLevel)
|
|||||||
|
|
||||||
QWidget *ZoomAction::createWidget(QWidget *parent)
|
QWidget *ZoomAction::createWidget(QWidget *parent)
|
||||||
{
|
{
|
||||||
QComboBox *comboBox = new QComboBox(parent);
|
auto comboBox = new QComboBox(parent);
|
||||||
|
|
||||||
if (m_comboBoxModel.isNull()) {
|
if (m_comboBoxModel.isNull()) {
|
||||||
m_comboBoxModel = comboBox->model();
|
m_comboBoxModel = comboBox->model();
|
||||||
|
@@ -298,7 +298,7 @@ void DebugView::rewriterEndTransaction()
|
|||||||
|
|
||||||
WidgetInfo DebugView::widgetInfo()
|
WidgetInfo DebugView::widgetInfo()
|
||||||
{
|
{
|
||||||
return createWidgetInfo(m_debugViewWidget.data(), 0, QStringLiteral("DebugView"), WidgetInfo::LeftPane, 0, tr("Debug View"));
|
return createWidgetInfo(m_debugViewWidget.data(), nullptr, QStringLiteral("DebugView"), WidgetInfo::LeftPane, 0, tr("Debug View"));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DebugView::hasWidget() const
|
bool DebugView::hasWidget() const
|
||||||
@@ -316,7 +316,7 @@ void DebugView::instancePropertyChanged(const QList<QPair<ModelNode, PropertyNam
|
|||||||
QString string;
|
QString string;
|
||||||
message.setString(&string);
|
message.setString(&string);
|
||||||
|
|
||||||
typedef QPair<ModelNode, PropertyName> Pair;
|
using Pair = QPair<ModelNode, PropertyName>;
|
||||||
|
|
||||||
foreach (const Pair &pair, propertyList) {
|
foreach (const Pair &pair, propertyList) {
|
||||||
message << pair.first;
|
message << pair.first;
|
||||||
|
@@ -30,7 +30,7 @@
|
|||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
AbstractCustomTool::AbstractCustomTool()
|
AbstractCustomTool::AbstractCustomTool()
|
||||||
: AbstractFormEditorTool(0)
|
: AbstractFormEditorTool(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -42,11 +42,7 @@ AbstractFormEditorTool::AbstractFormEditorTool(FormEditorView *editorView) : m_v
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AbstractFormEditorTool::~AbstractFormEditorTool() = default;
|
||||||
AbstractFormEditorTool::~AbstractFormEditorTool()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
FormEditorView* AbstractFormEditorTool::view() const
|
FormEditorView* AbstractFormEditorTool::view() const
|
||||||
{
|
{
|
||||||
@@ -79,7 +75,7 @@ QList<FormEditorItem *> AbstractFormEditorTool::toFormEditorItemList(const QList
|
|||||||
QList<FormEditorItem *> formEditorItemList;
|
QList<FormEditorItem *> formEditorItemList;
|
||||||
|
|
||||||
foreach (QGraphicsItem *graphicsItem, itemList) {
|
foreach (QGraphicsItem *graphicsItem, itemList) {
|
||||||
FormEditorItem *formEditorItem = qgraphicsitem_cast<FormEditorItem*>(graphicsItem);
|
auto formEditorItem = qgraphicsitem_cast<FormEditorItem*>(graphicsItem);
|
||||||
if (formEditorItem)
|
if (formEditorItem)
|
||||||
formEditorItemList.append(formEditorItem);
|
formEditorItemList.append(formEditorItem);
|
||||||
}
|
}
|
||||||
@@ -90,13 +86,13 @@ QList<FormEditorItem *> AbstractFormEditorTool::toFormEditorItemList(const QList
|
|||||||
bool AbstractFormEditorTool::topItemIsMovable(const QList<QGraphicsItem*> & itemList)
|
bool AbstractFormEditorTool::topItemIsMovable(const QList<QGraphicsItem*> & itemList)
|
||||||
{
|
{
|
||||||
QGraphicsItem *firstSelectableItem = topMovableGraphicsItem(itemList);
|
QGraphicsItem *firstSelectableItem = topMovableGraphicsItem(itemList);
|
||||||
if (firstSelectableItem == 0)
|
if (firstSelectableItem == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
FormEditorItem *formEditorItem = FormEditorItem::fromQGraphicsItem(firstSelectableItem);
|
FormEditorItem *formEditorItem = FormEditorItem::fromQGraphicsItem(firstSelectableItem);
|
||||||
QList<ModelNode> selectedNodes = view()->selectedModelNodes();
|
QList<ModelNode> selectedNodes = view()->selectedModelNodes();
|
||||||
|
|
||||||
if (formEditorItem != 0
|
if (formEditorItem != nullptr
|
||||||
&& selectedNodes.contains(formEditorItem->qmlItemNode()))
|
&& selectedNodes.contains(formEditorItem->qmlItemNode()))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@@ -170,7 +166,7 @@ QGraphicsItem *AbstractFormEditorTool::topMovableGraphicsItem(const QList<QGraph
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
FormEditorItem *AbstractFormEditorTool::topMovableFormEditorItem(const QList<QGraphicsItem*> &itemList, bool selectOnlyContentItems)
|
FormEditorItem *AbstractFormEditorTool::topMovableFormEditorItem(const QList<QGraphicsItem*> &itemList, bool selectOnlyContentItems)
|
||||||
@@ -186,12 +182,12 @@ FormEditorItem *AbstractFormEditorTool::topMovableFormEditorItem(const QList<QGr
|
|||||||
return formEditorItem;
|
return formEditorItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
FormEditorItem* AbstractFormEditorTool::nearestFormEditorItem(const QPointF &point, const QList<QGraphicsItem*> & itemList)
|
FormEditorItem* AbstractFormEditorTool::nearestFormEditorItem(const QPointF &point, const QList<QGraphicsItem*> & itemList)
|
||||||
{
|
{
|
||||||
FormEditorItem* nearestItem = 0;
|
FormEditorItem* nearestItem = nullptr;
|
||||||
foreach (QGraphicsItem *item, itemList) {
|
foreach (QGraphicsItem *item, itemList) {
|
||||||
FormEditorItem *formEditorItem = FormEditorItem::fromQGraphicsItem(item);
|
FormEditorItem *formEditorItem = FormEditorItem::fromQGraphicsItem(item);
|
||||||
|
|
||||||
@@ -345,7 +341,7 @@ FormEditorItem *AbstractFormEditorTool::containerFormEditorItem(const QList<QGra
|
|||||||
return formEditorItem;
|
return formEditorItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractFormEditorTool::clear()
|
void AbstractFormEditorTool::clear()
|
||||||
|
@@ -37,9 +37,7 @@ AnchorIndicator::AnchorIndicator(LayerItem *layerItem)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
AnchorIndicator::AnchorIndicator()
|
AnchorIndicator::AnchorIndicator() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
AnchorIndicator::~AnchorIndicator()
|
AnchorIndicator::~AnchorIndicator()
|
||||||
{
|
{
|
||||||
|
@@ -55,7 +55,7 @@ QIcon iconForColor(const QColor &color) {
|
|||||||
|
|
||||||
QWidget *BackgroundAction::createWidget(QWidget *parent)
|
QWidget *BackgroundAction::createWidget(QWidget *parent)
|
||||||
{
|
{
|
||||||
QComboBox *comboBox = new QComboBox(parent);
|
auto comboBox = new QComboBox(parent);
|
||||||
comboBox->setFixedWidth(42);
|
comboBox->setFixedWidth(42);
|
||||||
|
|
||||||
for (int i = 0; i < colors().count(); ++i) {
|
for (int i = 0; i < colors().count(); ++i) {
|
||||||
|
@@ -36,9 +36,7 @@ BindingIndicator::BindingIndicator(LayerItem *layerItem)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
BindingIndicator::BindingIndicator()
|
BindingIndicator::BindingIndicator() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
BindingIndicator::~BindingIndicator()
|
BindingIndicator::~BindingIndicator()
|
||||||
{
|
{
|
||||||
|
@@ -37,9 +37,7 @@ ContentNotEditableIndicator::ContentNotEditableIndicator(LayerItem *layerItem)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ContentNotEditableIndicator::ContentNotEditableIndicator()
|
ContentNotEditableIndicator::ContentNotEditableIndicator() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
ContentNotEditableIndicator::~ContentNotEditableIndicator()
|
ContentNotEditableIndicator::~ContentNotEditableIndicator()
|
||||||
{
|
{
|
||||||
@@ -92,7 +90,7 @@ void ContentNotEditableIndicator::addAddiationEntries(const QList<FormEditorItem
|
|||||||
if (modelNode.metaInfo().isValid() && modelNode.metaInfo().isSubclassOf("QtQuick.Loader")) {
|
if (modelNode.metaInfo().isValid() && modelNode.metaInfo().isSubclassOf("QtQuick.Loader")) {
|
||||||
|
|
||||||
if (!m_entryList.contains(EntryPair(formEditorItem, 0))) {
|
if (!m_entryList.contains(EntryPair(formEditorItem, 0))) {
|
||||||
QGraphicsRectItem *indicatorShape = new QGraphicsRectItem(m_layerItem);
|
auto indicatorShape = new QGraphicsRectItem(m_layerItem);
|
||||||
QPen linePen;
|
QPen linePen;
|
||||||
linePen.setCosmetic(true);
|
linePen.setCosmetic(true);
|
||||||
linePen.setColor(QColor(0xa0, 0xa0, 0xa0));
|
linePen.setColor(QColor(0xa0, 0xa0, 0xa0));
|
||||||
|
@@ -35,7 +35,7 @@ namespace QmlDesigner {
|
|||||||
class ContentNotEditableIndicator
|
class ContentNotEditableIndicator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef QPair<FormEditorItem*, QGraphicsRectItem *> EntryPair;
|
using EntryPair = QPair<FormEditorItem*, QGraphicsRectItem *>;
|
||||||
|
|
||||||
ContentNotEditableIndicator(LayerItem *layerItem);
|
ContentNotEditableIndicator(LayerItem *layerItem);
|
||||||
ContentNotEditableIndicator();
|
ContentNotEditableIndicator();
|
||||||
|
@@ -52,10 +52,7 @@ DragTool::DragTool(FormEditorView *editorView)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DragTool::~DragTool() = default;
|
||||||
DragTool::~DragTool()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void DragTool::clear()
|
void DragTool::clear()
|
||||||
{
|
{
|
||||||
|
@@ -67,7 +67,7 @@ bool FormEditorGraphicsView::eventFilter(QObject *watched, QEvent *event)
|
|||||||
stopPanning(event);
|
stopPanning(event);
|
||||||
}
|
}
|
||||||
if (event->type() == QEvent::MouseMove) {
|
if (event->type() == QEvent::MouseMove) {
|
||||||
QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
|
auto mouseEvent = static_cast<QMouseEvent*>(event);
|
||||||
if (!m_panningStartPosition.isNull()) {
|
if (!m_panningStartPosition.isNull()) {
|
||||||
horizontalScrollBar()->setValue(horizontalScrollBar()->value() -
|
horizontalScrollBar()->setValue(horizontalScrollBar()->value() -
|
||||||
(mouseEvent->x() - m_panningStartPosition.x()));
|
(mouseEvent->x() - m_panningStartPosition.x()));
|
||||||
@@ -112,8 +112,8 @@ void FormEditorGraphicsView::mouseReleaseEvent(QMouseEvent *event)
|
|||||||
bool isTextInputItem(QGraphicsItem* item)
|
bool isTextInputItem(QGraphicsItem* item)
|
||||||
{
|
{
|
||||||
if (item && item->isWidget()) {
|
if (item && item->isWidget()) {
|
||||||
QGraphicsWidget *graphicsWidget = static_cast<QGraphicsWidget *>(item);
|
auto graphicsWidget = static_cast<QGraphicsWidget *>(item);
|
||||||
QGraphicsProxyWidget * textInputProxyWidget = qobject_cast<QGraphicsProxyWidget *>(graphicsWidget);
|
auto textInputProxyWidget = qobject_cast<QGraphicsProxyWidget *>(graphicsWidget);
|
||||||
if (textInputProxyWidget && textInputProxyWidget->widget() && (
|
if (textInputProxyWidget && textInputProxyWidget->widget() && (
|
||||||
strcmp(textInputProxyWidget->widget()->metaObject()->className(), "QLineEdit") == 0 ||
|
strcmp(textInputProxyWidget->widget()->metaObject()->className(), "QLineEdit") == 0 ||
|
||||||
strcmp(textInputProxyWidget->widget()->metaObject()->className(), "QTextEdit") == 0)) {
|
strcmp(textInputProxyWidget->widget()->metaObject()->className(), "QTextEdit") == 0)) {
|
||||||
|
@@ -86,7 +86,7 @@ void FormEditorScene::resetScene()
|
|||||||
|
|
||||||
FormEditorItem* FormEditorScene::itemForQmlItemNode(const QmlItemNode &qmlItemNode) const
|
FormEditorItem* FormEditorScene::itemForQmlItemNode(const QmlItemNode &qmlItemNode) const
|
||||||
{
|
{
|
||||||
QTC_ASSERT(qmlItemNode.isValid(), return 0);
|
QTC_ASSERT(qmlItemNode.isValid(), return nullptr);
|
||||||
return m_qmlItemNodeItemHash.value(qmlItemNode);
|
return m_qmlItemNodeItemHash.value(qmlItemNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,7 +140,7 @@ FormEditorItem* FormEditorScene::calulateNewParent(FormEditorItem *formEditorIte
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormEditorScene::synchronizeTransformation(FormEditorItem *item)
|
void FormEditorScene::synchronizeTransformation(FormEditorItem *item)
|
||||||
@@ -182,7 +182,7 @@ void FormEditorScene::synchronizeOtherProperty(FormEditorItem *item, const QByte
|
|||||||
|
|
||||||
FormEditorItem *FormEditorScene::addFormEditorItem(const QmlItemNode &qmlItemNode)
|
FormEditorItem *FormEditorScene::addFormEditorItem(const QmlItemNode &qmlItemNode)
|
||||||
{
|
{
|
||||||
FormEditorItem *formEditorItem = new FormEditorItem(qmlItemNode, this);
|
auto formEditorItem = new FormEditorItem(qmlItemNode, this);
|
||||||
Q_ASSERT(!m_qmlItemNodeItemHash.contains(qmlItemNode));
|
Q_ASSERT(!m_qmlItemNodeItemHash.contains(qmlItemNode));
|
||||||
|
|
||||||
m_qmlItemNodeItemHash.insert(qmlItemNode, formEditorItem);
|
m_qmlItemNodeItemHash.insert(qmlItemNode, formEditorItem);
|
||||||
@@ -382,7 +382,7 @@ void FormEditorScene::hoverLeaveEvent(QGraphicsSceneHoverEvent * /*event*/)
|
|||||||
void FormEditorScene::reparentItem(const QmlItemNode &node, const QmlItemNode &newParent)
|
void FormEditorScene::reparentItem(const QmlItemNode &node, const QmlItemNode &newParent)
|
||||||
{
|
{
|
||||||
if (FormEditorItem *item = itemForQmlItemNode(node)) {
|
if (FormEditorItem *item = itemForQmlItemNode(node)) {
|
||||||
item->setParentItem(0);
|
item->setParentItem(nullptr);
|
||||||
if (newParent.isValid()) {
|
if (newParent.isValid()) {
|
||||||
if (FormEditorItem *parentItem = itemForQmlItemNode(newParent))
|
if (FormEditorItem *parentItem = itemForQmlItemNode(newParent))
|
||||||
item->setParentItem(parentItem);
|
item->setParentItem(parentItem);
|
||||||
@@ -407,7 +407,7 @@ void FormEditorScene::clearFormEditorItems()
|
|||||||
const QList<FormEditorItem*> formEditorItems = Utils::filtered(formEditorItemsTransformed,
|
const QList<FormEditorItem*> formEditorItems = Utils::filtered(formEditorItemsTransformed,
|
||||||
[](FormEditorItem *item) { return item; });
|
[](FormEditorItem *item) { return item; });
|
||||||
foreach (FormEditorItem *item, formEditorItems)
|
foreach (FormEditorItem *item, formEditorItems)
|
||||||
item->setParentItem(0);
|
item->setParentItem(nullptr);
|
||||||
|
|
||||||
foreach (FormEditorItem *item, formEditorItems)
|
foreach (FormEditorItem *item, formEditorItems)
|
||||||
delete item;
|
delete item;
|
||||||
|
@@ -155,7 +155,7 @@ void FormEditorView::createFormEditorWidget()
|
|||||||
|
|
||||||
m_currentTool = m_selectionTool.get();
|
m_currentTool = m_selectionTool.get();
|
||||||
|
|
||||||
Internal::FormEditorContext *formEditorContext = new Internal::FormEditorContext(m_formEditorWidget.data());
|
auto formEditorContext = new Internal::FormEditorContext(m_formEditorWidget.data());
|
||||||
Core::ICore::addContextObject(formEditorContext);
|
Core::ICore::addContextObject(formEditorContext);
|
||||||
|
|
||||||
connect(formEditorWidget()->zoomAction(), &ZoomAction::zoomLevelChanged, [this]() {
|
connect(formEditorWidget()->zoomAction(), &ZoomAction::zoomLevelChanged, [this]() {
|
||||||
@@ -168,7 +168,7 @@ void FormEditorView::createFormEditorWidget()
|
|||||||
void FormEditorView::temporaryBlockView()
|
void FormEditorView::temporaryBlockView()
|
||||||
{
|
{
|
||||||
formEditorWidget()->graphicsView()->setUpdatesEnabled(false);
|
formEditorWidget()->graphicsView()->setUpdatesEnabled(false);
|
||||||
static QTimer *timer = new QTimer(qApp);
|
static auto timer = new QTimer(qApp);
|
||||||
timer->setSingleShot(true);
|
timer->setSingleShot(true);
|
||||||
timer->start(1000);
|
timer->start(1000);
|
||||||
|
|
||||||
@@ -277,7 +277,7 @@ WidgetInfo FormEditorView::widgetInfo()
|
|||||||
if (!m_formEditorWidget)
|
if (!m_formEditorWidget)
|
||||||
createFormEditorWidget();
|
createFormEditorWidget();
|
||||||
|
|
||||||
return createWidgetInfo(m_formEditorWidget.data(), 0, "FormEditor", WidgetInfo::CentralPane, 0, tr("Form Editor"), DesignerWidgetFlags::IgnoreErrors);
|
return createWidgetInfo(m_formEditorWidget.data(), nullptr, "FormEditor", WidgetInfo::CentralPane, 0, tr("Form Editor"), DesignerWidgetFlags::IgnoreErrors);
|
||||||
}
|
}
|
||||||
|
|
||||||
FormEditorWidget *FormEditorView::formEditorWidget()
|
FormEditorWidget *FormEditorView::formEditorWidget()
|
||||||
@@ -395,7 +395,7 @@ void FormEditorView::changeToCustomTool()
|
|||||||
{
|
{
|
||||||
if (hasSelectedModelNodes()) {
|
if (hasSelectedModelNodes()) {
|
||||||
int handlingRank = 0;
|
int handlingRank = 0;
|
||||||
AbstractCustomTool *selectedCustomTool = 0;
|
AbstractCustomTool *selectedCustomTool = nullptr;
|
||||||
|
|
||||||
const ModelNode selectedModelNode = selectedModelNodes().constFirst();
|
const ModelNode selectedModelNode = selectedModelNodes().constFirst();
|
||||||
|
|
||||||
|
@@ -61,7 +61,7 @@ FormEditorWidget::FormEditorWidget(FormEditorView *view)
|
|||||||
{
|
{
|
||||||
setStyleSheet(Theme::replaceCssColors(QString::fromUtf8(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/formeditorstylesheet.css")))));
|
setStyleSheet(Theme::replaceCssColors(QString::fromUtf8(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/formeditorstylesheet.css")))));
|
||||||
|
|
||||||
QVBoxLayout *fillLayout = new QVBoxLayout(this);
|
auto fillLayout = new QVBoxLayout(this);
|
||||||
fillLayout->setMargin(0);
|
fillLayout->setMargin(0);
|
||||||
fillLayout->setSpacing(0);
|
fillLayout->setSpacing(0);
|
||||||
setLayout(fillLayout);
|
setLayout(fillLayout);
|
||||||
@@ -70,7 +70,7 @@ FormEditorWidget::FormEditorWidget(FormEditorView *view)
|
|||||||
|
|
||||||
m_toolActionGroup = new QActionGroup(this);
|
m_toolActionGroup = new QActionGroup(this);
|
||||||
|
|
||||||
QActionGroup *layoutActionGroup = new QActionGroup(this);
|
auto layoutActionGroup = new QActionGroup(this);
|
||||||
layoutActionGroup->setExclusive(true);
|
layoutActionGroup->setExclusive(true);
|
||||||
|
|
||||||
m_noSnappingAction = layoutActionGroup->addAction(tr("No snapping (T)."));
|
m_noSnappingAction = layoutActionGroup->addAction(tr("No snapping (T)."));
|
||||||
@@ -98,7 +98,7 @@ FormEditorWidget::FormEditorWidget(FormEditorView *view)
|
|||||||
addActions(layoutActionGroup->actions());
|
addActions(layoutActionGroup->actions());
|
||||||
upperActions.append(layoutActionGroup->actions());
|
upperActions.append(layoutActionGroup->actions());
|
||||||
|
|
||||||
QAction *separatorAction = new QAction(this);
|
auto separatorAction = new QAction(this);
|
||||||
separatorAction->setSeparator(true);
|
separatorAction->setSeparator(true);
|
||||||
addAction(separatorAction);
|
addAction(separatorAction);
|
||||||
upperActions.append(separatorAction);
|
upperActions.append(separatorAction);
|
||||||
|
@@ -39,9 +39,7 @@ LayerItem::LayerItem(FormEditorScene* scene)
|
|||||||
setAcceptedMouseButtons(Qt::NoButton);
|
setAcceptedMouseButtons(Qt::NoButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
LayerItem::~LayerItem()
|
LayerItem::~LayerItem() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void LayerItem::paint(QPainter * /*painter*/, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/)
|
void LayerItem::paint(QPainter * /*painter*/, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/)
|
||||||
{
|
{
|
||||||
|
@@ -48,7 +48,7 @@ void LineEditAction::clearLineEditText()
|
|||||||
|
|
||||||
QWidget *LineEditAction::createWidget(QWidget *parent)
|
QWidget *LineEditAction::createWidget(QWidget *parent)
|
||||||
{
|
{
|
||||||
QLineEdit *lineEdit = new QLineEdit(parent);
|
auto lineEdit = new QLineEdit(parent);
|
||||||
|
|
||||||
lineEdit->setPlaceholderText(m_placeHolderText);
|
lineEdit->setPlaceholderText(m_placeHolderText);
|
||||||
lineEdit->setFixedWidth(100);
|
lineEdit->setFixedWidth(100);
|
||||||
|
@@ -51,10 +51,7 @@ MoveTool::MoveTool(FormEditorView *editorView)
|
|||||||
m_selectionIndicator.setCursor(Qt::SizeAllCursor);
|
m_selectionIndicator.setCursor(Qt::SizeAllCursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
MoveTool::~MoveTool()
|
MoveTool::~MoveTool() = default;
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void MoveTool::clear()
|
void MoveTool::clear()
|
||||||
{
|
{
|
||||||
@@ -316,7 +313,7 @@ bool MoveTool::isAncestorOfAllItems(FormEditorItem* maybeAncestorItem,
|
|||||||
FormEditorItem* MoveTool::ancestorIfOtherItemsAreChild(const QList<FormEditorItem*> &itemList)
|
FormEditorItem* MoveTool::ancestorIfOtherItemsAreChild(const QList<FormEditorItem*> &itemList)
|
||||||
{
|
{
|
||||||
if (itemList.isEmpty())
|
if (itemList.isEmpty())
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
|
|
||||||
foreach (FormEditorItem* item, itemList)
|
foreach (FormEditorItem* item, itemList)
|
||||||
@@ -325,7 +322,7 @@ FormEditorItem* MoveTool::ancestorIfOtherItemsAreChild(const QList<FormEditorIte
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MoveTool::updateMoveManipulator()
|
void MoveTool::updateMoveManipulator()
|
||||||
@@ -369,13 +366,13 @@ QList<FormEditorItem*> MoveTool::movingItems(const QList<FormEditorItem*> &selec
|
|||||||
|
|
||||||
FormEditorItem* ancestorItem = ancestorIfOtherItemsAreChild(filteredItemList);
|
FormEditorItem* ancestorItem = ancestorIfOtherItemsAreChild(filteredItemList);
|
||||||
|
|
||||||
if (ancestorItem != 0 && ancestorItem->qmlItemNode().isRootNode()) {
|
if (ancestorItem != nullptr && ancestorItem->qmlItemNode().isRootNode()) {
|
||||||
// view()->changeToSelectionTool();
|
// view()->changeToSelectionTool();
|
||||||
return QList<FormEditorItem*>();
|
return QList<FormEditorItem*>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (ancestorItem != 0 && ancestorItem->parentItem() != 0) {
|
if (ancestorItem != nullptr && ancestorItem->parentItem() != nullptr) {
|
||||||
QList<FormEditorItem*> ancestorItemList;
|
QList<FormEditorItem*> ancestorItemList;
|
||||||
ancestorItemList.append(ancestorItem);
|
ancestorItemList.append(ancestorItem);
|
||||||
return ancestorItemList;
|
return ancestorItemList;
|
||||||
|
@@ -42,7 +42,7 @@ void NumberSeriesAction::addEntry(const QString &text, const QVariant &value)
|
|||||||
if (m_comboBoxModel.isNull())
|
if (m_comboBoxModel.isNull())
|
||||||
m_comboBoxModel = new QStandardItemModel(this);
|
m_comboBoxModel = new QStandardItemModel(this);
|
||||||
|
|
||||||
QStandardItem *newItem = new QStandardItem(text);
|
auto newItem = new QStandardItem(text);
|
||||||
newItem->setData(value);
|
newItem->setData(value);
|
||||||
m_comboBoxModel->appendRow(newItem);
|
m_comboBoxModel->appendRow(newItem);
|
||||||
}
|
}
|
||||||
@@ -54,7 +54,7 @@ QVariant NumberSeriesAction::currentValue() const
|
|||||||
|
|
||||||
QWidget *NumberSeriesAction::createWidget(QWidget *parent)
|
QWidget *NumberSeriesAction::createWidget(QWidget *parent)
|
||||||
{
|
{
|
||||||
QComboBox *comboBox = new QComboBox(parent);
|
auto comboBox = new QComboBox(parent);
|
||||||
|
|
||||||
comboBox->setModel(m_comboBoxModel.data());
|
comboBox->setModel(m_comboBoxModel.data());
|
||||||
|
|
||||||
|
@@ -58,30 +58,19 @@ public:
|
|||||||
ResizeControllerData::ResizeControllerData(LayerItem *layerItem, FormEditorItem *formEditorItem)
|
ResizeControllerData::ResizeControllerData(LayerItem *layerItem, FormEditorItem *formEditorItem)
|
||||||
: layerItem(layerItem),
|
: layerItem(layerItem),
|
||||||
formEditorItem(formEditorItem),
|
formEditorItem(formEditorItem),
|
||||||
topLeftItem(0),
|
topLeftItem(nullptr),
|
||||||
topRightItem(0),
|
topRightItem(nullptr),
|
||||||
bottomLeftItem(0),
|
bottomLeftItem(nullptr),
|
||||||
bottomRightItem(0),
|
bottomRightItem(nullptr),
|
||||||
topItem(0),
|
topItem(nullptr),
|
||||||
leftItem(0),
|
leftItem(nullptr),
|
||||||
rightItem(0),
|
rightItem(nullptr),
|
||||||
bottomItem(0)
|
bottomItem(nullptr)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ResizeControllerData::ResizeControllerData(const ResizeControllerData &other)
|
ResizeControllerData::ResizeControllerData(const ResizeControllerData &other) = default;
|
||||||
: layerItem(other.layerItem),
|
|
||||||
formEditorItem(other.formEditorItem),
|
|
||||||
topLeftItem(other.topLeftItem),
|
|
||||||
topRightItem(other.topRightItem),
|
|
||||||
bottomLeftItem(other.bottomLeftItem),
|
|
||||||
bottomRightItem(other.bottomRightItem),
|
|
||||||
topItem(other.topItem),
|
|
||||||
leftItem(other.leftItem),
|
|
||||||
rightItem(other.rightItem),
|
|
||||||
bottomItem(other.bottomItem)
|
|
||||||
{}
|
|
||||||
|
|
||||||
ResizeControllerData::~ResizeControllerData()
|
ResizeControllerData::~ResizeControllerData()
|
||||||
{
|
{
|
||||||
@@ -100,7 +89,7 @@ ResizeControllerData::~ResizeControllerData()
|
|||||||
|
|
||||||
|
|
||||||
ResizeController::ResizeController()
|
ResizeController::ResizeController()
|
||||||
: m_data(new ResizeControllerData(0, 0))
|
: m_data(new ResizeControllerData(nullptr, nullptr))
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -149,20 +138,14 @@ ResizeController::ResizeController(LayerItem *layerItem, FormEditorItem *formEdi
|
|||||||
updatePosition();
|
updatePosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
ResizeController::ResizeController(const ResizeController &other)
|
ResizeController::ResizeController(const ResizeController &other) = default;
|
||||||
: m_data(other.m_data)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
ResizeController::ResizeController(const WeakResizeController &resizeController)
|
ResizeController::ResizeController(const WeakResizeController &resizeController)
|
||||||
: m_data(resizeController.m_data.toStrongRef())
|
: m_data(resizeController.m_data.toStrongRef())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
ResizeController::~ResizeController()
|
ResizeController::~ResizeController() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
ResizeController &ResizeController::operator =(const ResizeController &other)
|
ResizeController &ResizeController::operator =(const ResizeController &other)
|
||||||
{
|
{
|
||||||
@@ -310,24 +293,16 @@ WeakResizeController ResizeController::toWeakResizeController() const
|
|||||||
return WeakResizeController(*this);
|
return WeakResizeController(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
WeakResizeController::WeakResizeController()
|
WeakResizeController::WeakResizeController() = default;
|
||||||
{
|
|
||||||
|
|
||||||
}
|
WeakResizeController::WeakResizeController(const WeakResizeController &resizeController) = default;
|
||||||
|
|
||||||
WeakResizeController::WeakResizeController(const WeakResizeController &resizeController)
|
|
||||||
: m_data(resizeController.m_data)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
WeakResizeController::WeakResizeController(const ResizeController &resizeController)
|
WeakResizeController::WeakResizeController(const ResizeController &resizeController)
|
||||||
: m_data(resizeController.m_data.toWeakRef())
|
: m_data(resizeController.m_data.toWeakRef())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
WeakResizeController::~WeakResizeController()
|
WeakResizeController::~WeakResizeController() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
WeakResizeController &WeakResizeController::operator =(const WeakResizeController &other)
|
WeakResizeController &WeakResizeController::operator =(const WeakResizeController &other)
|
||||||
{
|
{
|
||||||
|
@@ -38,9 +38,7 @@ ResizeHandleItem::ResizeHandleItem(QGraphicsItem *parent, const ResizeController
|
|||||||
setAcceptedMouseButtons(Qt::NoButton);
|
setAcceptedMouseButtons(Qt::NoButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResizeHandleItem::~ResizeHandleItem()
|
ResizeHandleItem::~ResizeHandleItem() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void ResizeHandleItem::setHandlePosition(const QPointF & globalPosition, const QPointF & itemSpacePosition)
|
void ResizeHandleItem::setHandlePosition(const QPointF & globalPosition, const QPointF & itemSpacePosition)
|
||||||
{
|
{
|
||||||
|
@@ -42,7 +42,7 @@ ResizeManipulator::ResizeManipulator(LayerItem *layerItem, FormEditorView *view)
|
|||||||
m_beginRightMargin(0.0),
|
m_beginRightMargin(0.0),
|
||||||
m_beginBottomMargin(0.0),
|
m_beginBottomMargin(0.0),
|
||||||
m_layerItem(layerItem),
|
m_layerItem(layerItem),
|
||||||
m_resizeHandle(0),
|
m_resizeHandle(nullptr),
|
||||||
m_isActive(false)
|
m_isActive(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -65,7 +65,7 @@ void ResizeManipulator::setHandle(ResizeHandleItem *resizeHandle)
|
|||||||
void ResizeManipulator::removeHandle()
|
void ResizeManipulator::removeHandle()
|
||||||
{
|
{
|
||||||
m_resizeController = ResizeController();
|
m_resizeController = ResizeController();
|
||||||
m_resizeHandle = 0;
|
m_resizeHandle = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResizeManipulator::begin(const QPointF &/*beginPoint*/)
|
void ResizeManipulator::begin(const QPointF &/*beginPoint*/)
|
||||||
|
@@ -46,10 +46,7 @@ ResizeTool::ResizeTool(FormEditorView *editorView)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ResizeTool::~ResizeTool() = default;
|
||||||
ResizeTool::~ResizeTool()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void ResizeTool::mousePressEvent(const QList<QGraphicsItem*> &itemList,
|
void ResizeTool::mousePressEvent(const QList<QGraphicsItem*> &itemList,
|
||||||
QGraphicsSceneMouseEvent *event)
|
QGraphicsSceneMouseEvent *event)
|
||||||
|
@@ -32,7 +32,7 @@ namespace QmlDesigner {
|
|||||||
RubberBandSelectionManipulator::RubberBandSelectionManipulator(LayerItem *layerItem, FormEditorView *editorView)
|
RubberBandSelectionManipulator::RubberBandSelectionManipulator(LayerItem *layerItem, FormEditorView *editorView)
|
||||||
: m_selectionRectangleElement(layerItem),
|
: m_selectionRectangleElement(layerItem),
|
||||||
m_editorView(editorView),
|
m_editorView(editorView),
|
||||||
m_beginFormEditorItem(0),
|
m_beginFormEditorItem(nullptr),
|
||||||
m_isActive(false)
|
m_isActive(false)
|
||||||
{
|
{
|
||||||
m_selectionRectangleElement.hide();
|
m_selectionRectangleElement.hide();
|
||||||
|
@@ -34,8 +34,6 @@ ScaleManipulator::ScaleManipulator(LayerItem *layerItem, FormEditorItem *formEdi
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
ScaleManipulator::~ScaleManipulator()
|
ScaleManipulator::~ScaleManipulator() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -98,7 +98,7 @@ void SelectionIndicator::setItems(const QList<FormEditorItem*> &itemList)
|
|||||||
if (!item->qmlItemNode().isValid())
|
if (!item->qmlItemNode().isValid())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
QGraphicsPolygonItem *newSelectionIndicatorGraphicsItem = new QGraphicsPolygonItem(m_layerItem.data());
|
auto newSelectionIndicatorGraphicsItem = new QGraphicsPolygonItem(m_layerItem.data());
|
||||||
m_indicatorShapeHash.insert(item, newSelectionIndicatorGraphicsItem);
|
m_indicatorShapeHash.insert(item, newSelectionIndicatorGraphicsItem);
|
||||||
newSelectionIndicatorGraphicsItem->setPolygon(boundingRectInLayerItemSpaceForItem(item, m_layerItem.data()));
|
newSelectionIndicatorGraphicsItem->setPolygon(boundingRectInLayerItemSpaceForItem(item, m_layerItem.data()));
|
||||||
newSelectionIndicatorGraphicsItem->setFlag(QGraphicsItem::ItemIsSelectable, false);
|
newSelectionIndicatorGraphicsItem->setFlag(QGraphicsItem::ItemIsSelectable, false);
|
||||||
|
@@ -64,7 +64,7 @@ void SelectionRectangle::show()
|
|||||||
|
|
||||||
void SelectionRectangle::hide()
|
void SelectionRectangle::hide()
|
||||||
{
|
{
|
||||||
m_controlShape->setParentItem(0);
|
m_controlShape->setParentItem(nullptr);
|
||||||
m_controlShape->hide();
|
m_controlShape->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -54,10 +54,7 @@ SelectionTool::SelectionTool(FormEditorView *editorView)
|
|||||||
m_selectionIndicator.setCursor(Qt::ArrowCursor);
|
m_selectionIndicator.setCursor(Qt::ArrowCursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SelectionTool::~SelectionTool() = default;
|
||||||
SelectionTool::~SelectionTool()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void SelectionTool::mousePressEvent(const QList<QGraphicsItem*> &itemList,
|
void SelectionTool::mousePressEvent(const QList<QGraphicsItem*> &itemList,
|
||||||
QGraphicsSceneMouseEvent *event)
|
QGraphicsSceneMouseEvent *event)
|
||||||
|
@@ -38,8 +38,8 @@
|
|||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
Snapper::Snapper()
|
Snapper::Snapper()
|
||||||
: m_containerFormEditorItem(0),
|
: m_containerFormEditorItem(nullptr),
|
||||||
m_transformtionSpaceFormEditorItem(0),
|
m_transformtionSpaceFormEditorItem(nullptr),
|
||||||
m_snappingDistance(5.0)
|
m_snappingDistance(5.0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -321,7 +321,7 @@ QList<QLineF> Snapper::findSnappingLines(const SnapLineMap &snappingLineMap,
|
|||||||
lowerLimit,
|
lowerLimit,
|
||||||
upperLimit,
|
upperLimit,
|
||||||
snappingLineIterator.value().first);
|
snappingLineIterator.value().first);
|
||||||
if (boundingRects != 0)
|
if (boundingRects != nullptr)
|
||||||
boundingRects->append(snappingLineIterator.value().first);
|
boundingRects->append(snappingLineIterator.value().first);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -363,7 +363,7 @@ QList<QLineF> Snapper::findSnappingOffsetLines(const SnapLineMap &snappingOffset
|
|||||||
lowerLimit,
|
lowerLimit,
|
||||||
upperLimit,
|
upperLimit,
|
||||||
formEditorItemRect);
|
formEditorItemRect);
|
||||||
if (boundingRects != 0)
|
if (boundingRects != nullptr)
|
||||||
boundingRects->append(snappingOffsetIterator.value().first);
|
boundingRects->append(snappingOffsetIterator.value().first);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -715,7 +715,7 @@ QList<QGraphicsItem*> Snapper::generateSnappingLines(const QList<QRectF> &boundi
|
|||||||
|
|
||||||
foreach (const QLineF &line, lineList) {
|
foreach (const QLineF &line, lineList) {
|
||||||
QLineF lineInTransformationSpace = transform.map(line);
|
QLineF lineInTransformationSpace = transform.map(line);
|
||||||
QGraphicsLineItem * lineItem = new QGraphicsLineItem(lineInTransformationSpace, layerItem);
|
auto lineItem = new QGraphicsLineItem(lineInTransformationSpace, layerItem);
|
||||||
lineItem->setZValue(40);
|
lineItem->setZValue(40);
|
||||||
QPen linePen;
|
QPen linePen;
|
||||||
linePen.setCosmetic(true);
|
linePen.setCosmetic(true);
|
||||||
|
@@ -31,8 +31,8 @@ namespace QmlDesigner {
|
|||||||
|
|
||||||
class FormEditorItem;
|
class FormEditorItem;
|
||||||
|
|
||||||
typedef QMultiMap<double, QPair<QRectF, FormEditorItem*> > SnapLineMap;
|
using SnapLineMap = QMultiMap<double, QPair<QRectF, FormEditorItem*> >;
|
||||||
typedef QMapIterator<double, QPair<QRectF, FormEditorItem*> > SnapLineMapIterator;
|
using SnapLineMapIterator = QMapIterator<double, QPair<QRectF, FormEditorItem*> >;
|
||||||
|
|
||||||
class FormEditorItem;
|
class FormEditorItem;
|
||||||
|
|
||||||
|
@@ -42,11 +42,11 @@ ToolBox::ToolBox(QWidget *parentWidget)
|
|||||||
m_leftToolBar->setMovable(true);
|
m_leftToolBar->setMovable(true);
|
||||||
m_leftToolBar->setOrientation(Qt::Horizontal);
|
m_leftToolBar->setOrientation(Qt::Horizontal);
|
||||||
|
|
||||||
QHBoxLayout *horizontalLayout = new QHBoxLayout(this);
|
auto horizontalLayout = new QHBoxLayout(this);
|
||||||
horizontalLayout->setMargin(0);
|
horizontalLayout->setMargin(0);
|
||||||
horizontalLayout->setSpacing(0);
|
horizontalLayout->setSpacing(0);
|
||||||
|
|
||||||
QToolBar *stretchToolbar = new QToolBar(this);
|
auto stretchToolbar = new QToolBar(this);
|
||||||
|
|
||||||
m_leftToolBar->setProperty("panelwidget", true);
|
m_leftToolBar->setProperty("panelwidget", true);
|
||||||
m_leftToolBar->setProperty("panelwidget_singlerow", false);
|
m_leftToolBar->setProperty("panelwidget_singlerow", false);
|
||||||
|
@@ -35,7 +35,7 @@ namespace QmlDesigner {
|
|||||||
ImportLabel::ImportLabel(QWidget *parent) :
|
ImportLabel::ImportLabel(QWidget *parent) :
|
||||||
QWidget(parent)
|
QWidget(parent)
|
||||||
{
|
{
|
||||||
QHBoxLayout *layout = new QHBoxLayout(this);
|
auto layout = new QHBoxLayout(this);
|
||||||
layout->setContentsMargins(0, 0, 0, 0);
|
layout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
|
|
||||||
|
@@ -33,15 +33,12 @@ namespace QmlDesigner {
|
|||||||
|
|
||||||
ImportManagerView::ImportManagerView(QObject *parent) :
|
ImportManagerView::ImportManagerView(QObject *parent) :
|
||||||
AbstractView(parent),
|
AbstractView(parent),
|
||||||
m_importsWidget(0)
|
m_importsWidget(nullptr)
|
||||||
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
ImportManagerView::~ImportManagerView()
|
ImportManagerView::~ImportManagerView() = default;
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ImportManagerView::hasWidget() const
|
bool ImportManagerView::hasWidget() const
|
||||||
{
|
{
|
||||||
@@ -50,7 +47,7 @@ bool ImportManagerView::hasWidget() const
|
|||||||
|
|
||||||
WidgetInfo ImportManagerView::widgetInfo()
|
WidgetInfo ImportManagerView::widgetInfo()
|
||||||
{
|
{
|
||||||
if (m_importsWidget == 0) {
|
if (m_importsWidget == nullptr) {
|
||||||
m_importsWidget = new ImportsWidget;
|
m_importsWidget = new ImportsWidget;
|
||||||
connect(m_importsWidget.data(), &ImportsWidget::removeImport, this, &ImportManagerView::removeImport);
|
connect(m_importsWidget.data(), &ImportsWidget::removeImport, this, &ImportManagerView::removeImport);
|
||||||
connect(m_importsWidget.data(), &ImportsWidget::addImport, this, &ImportManagerView::addImport);
|
connect(m_importsWidget.data(), &ImportsWidget::addImport, this, &ImportManagerView::addImport);
|
||||||
@@ -59,7 +56,7 @@ WidgetInfo ImportManagerView::widgetInfo()
|
|||||||
m_importsWidget->setImports(model()->imports());
|
m_importsWidget->setImports(model()->imports());
|
||||||
}
|
}
|
||||||
|
|
||||||
return createWidgetInfo(m_importsWidget, 0, QLatin1String("ImportManager"), WidgetInfo::LeftPane, 1);
|
return createWidgetInfo(m_importsWidget, nullptr, QLatin1String("ImportManager"), WidgetInfo::LeftPane, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImportManagerView::modelAttached(Model *model)
|
void ImportManagerView::modelAttached(Model *model)
|
||||||
|
@@ -124,7 +124,7 @@ void ImportsWidget::setImports(const QList<Import> &imports)
|
|||||||
Utils::sort(sortedImports, importLess);
|
Utils::sort(sortedImports, importLess);
|
||||||
|
|
||||||
foreach (const Import &import, sortedImports) {
|
foreach (const Import &import, sortedImports) {
|
||||||
ImportLabel *importLabel = new ImportLabel(this);
|
auto importLabel = new ImportLabel(this);
|
||||||
importLabel->setImport(import);
|
importLabel->setImport(import);
|
||||||
m_importLabels.append(importLabel);
|
m_importLabels.append(importLabel);
|
||||||
connect(importLabel, &ImportLabel::removeImport, this, &ImportsWidget::removeImport);
|
connect(importLabel, &ImportLabel::removeImport, this, &ImportsWidget::removeImport);
|
||||||
@@ -138,7 +138,7 @@ void ImportsWidget::updateLayout()
|
|||||||
{
|
{
|
||||||
delete layout();
|
delete layout();
|
||||||
|
|
||||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
auto layout = new QVBoxLayout(this);
|
||||||
layout->setSpacing(0);
|
layout->setSpacing(0);
|
||||||
|
|
||||||
layout->addWidget(m_addImportComboBox);
|
layout->addWidget(m_addImportComboBox);
|
||||||
|
@@ -48,7 +48,7 @@ void ComponentAction::setCurrentIndex(int index)
|
|||||||
|
|
||||||
QWidget *ComponentAction::createWidget(QWidget *parent)
|
QWidget *ComponentAction::createWidget(QWidget *parent)
|
||||||
{
|
{
|
||||||
QComboBox *comboBox = new QComboBox(parent);
|
auto comboBox = new QComboBox(parent);
|
||||||
comboBox->setMinimumWidth(120);
|
comboBox->setMinimumWidth(120);
|
||||||
comboBox->setToolTip(tr("Edit sub components defined in this file."));
|
comboBox->setToolTip(tr("Edit sub components defined in this file."));
|
||||||
comboBox->setModel(m_componentView->standardItemModel());
|
comboBox->setModel(m_componentView->standardItemModel());
|
||||||
|
@@ -203,7 +203,7 @@ void ComponentView::searchForComponentAndAddToList(const ModelNode &node)
|
|||||||
if (!hasEntryForNode(node)) {
|
if (!hasEntryForNode(node)) {
|
||||||
QString description = descriptionForNode(node);
|
QString description = descriptionForNode(node);
|
||||||
|
|
||||||
QStandardItem *item = new QStandardItem(description);
|
auto item = new QStandardItem(description);
|
||||||
item->setData(QVariant::fromValue(node.internalId()), ModelNodeRole);
|
item->setData(QVariant::fromValue(node.internalId()), ModelNodeRole);
|
||||||
item->setEditable(false);
|
item->setEditable(false);
|
||||||
removeSingleNodeFromList(node); //remove node if already present
|
removeSingleNodeFromList(node); //remove node if already present
|
||||||
|
@@ -77,13 +77,11 @@ DesignDocument::DesignDocument(QObject *parent) :
|
|||||||
m_subComponentManager(new SubComponentManager(m_documentModel.data(), this)),
|
m_subComponentManager(new SubComponentManager(m_documentModel.data(), this)),
|
||||||
m_rewriterView (new RewriterView(RewriterView::Amend, m_documentModel.data())),
|
m_rewriterView (new RewriterView(RewriterView::Amend, m_documentModel.data())),
|
||||||
m_documentLoaded(false),
|
m_documentLoaded(false),
|
||||||
m_currentKit(0)
|
m_currentKit(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
DesignDocument::~DesignDocument()
|
DesignDocument::~DesignDocument() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Model *DesignDocument::currentModel() const
|
Model *DesignDocument::currentModel() const
|
||||||
{
|
{
|
||||||
@@ -590,7 +588,7 @@ QPlainTextEdit *DesignDocument::plainTextEdit() const
|
|||||||
if (editor())
|
if (editor())
|
||||||
return qobject_cast<QPlainTextEdit*>(editor()->widget());
|
return qobject_cast<QPlainTextEdit*>(editor()->widget());
|
||||||
|
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelNode DesignDocument::rootModelNode() const
|
ModelNode DesignDocument::rootModelNode() const
|
||||||
@@ -622,7 +620,7 @@ static inline Kit *getActiveKit(DesignDocument *designDocument)
|
|||||||
currentProject = ProjectExplorer::ProjectTree::currentProject();
|
currentProject = ProjectExplorer::ProjectTree::currentProject();
|
||||||
|
|
||||||
if (!currentProject)
|
if (!currentProject)
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
|
|
||||||
QObject::connect(ProjectTree::instance(), &ProjectTree::currentProjectChanged,
|
QObject::connect(ProjectTree::instance(), &ProjectTree::currentProjectChanged,
|
||||||
@@ -641,10 +639,10 @@ static inline Kit *getActiveKit(DesignDocument *designDocument)
|
|||||||
Target *target = currentProject->activeTarget();
|
Target *target = currentProject->activeTarget();
|
||||||
|
|
||||||
if (!target)
|
if (!target)
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
if (!target->kit() || !target->kit()->isValid())
|
if (!target->kit() || !target->kit()->isValid())
|
||||||
return 0;
|
return nullptr;
|
||||||
QObject::connect(target, &Target::kitChanged,
|
QObject::connect(target, &Target::kitChanged,
|
||||||
designDocument, &DesignDocument::updateActiveQtVersion, Qt::UniqueConnection);
|
designDocument, &DesignDocument::updateActiveQtVersion, Qt::UniqueConnection);
|
||||||
|
|
||||||
|
@@ -49,9 +49,7 @@ DesignDocumentView::DesignDocumentView(QObject *parent)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
DesignDocumentView::~DesignDocumentView()
|
DesignDocumentView::~DesignDocumentView() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
ModelNode DesignDocumentView::insertModel(const ModelNode &modelNode)
|
ModelNode DesignDocumentView::insertModel(const ModelNode &modelNode)
|
||||||
{
|
{
|
||||||
@@ -81,7 +79,7 @@ void DesignDocumentView::toClipboard() const
|
|||||||
{
|
{
|
||||||
QClipboard *clipboard = QApplication::clipboard();
|
QClipboard *clipboard = QApplication::clipboard();
|
||||||
|
|
||||||
QMimeData *data = new QMimeData;
|
auto data = new QMimeData;
|
||||||
|
|
||||||
data->setText(toText());
|
data->setText(toText());
|
||||||
QStringList imports;
|
QStringList imports;
|
||||||
@@ -121,7 +119,7 @@ QString DesignDocumentView::toText() const
|
|||||||
textEdit.setPlainText(imports + QStringLiteral("Item {\n}\n"));
|
textEdit.setPlainText(imports + QStringLiteral("Item {\n}\n"));
|
||||||
NotIndentingTextEditModifier modifier(&textEdit);
|
NotIndentingTextEditModifier modifier(&textEdit);
|
||||||
|
|
||||||
QScopedPointer<RewriterView> rewriterView(new RewriterView(RewriterView::Amend, 0));
|
QScopedPointer<RewriterView> rewriterView(new RewriterView(RewriterView::Amend, nullptr));
|
||||||
rewriterView->setCheckSemanticErrors(false);
|
rewriterView->setCheckSemanticErrors(false);
|
||||||
rewriterView->setTextModifier(&modifier);
|
rewriterView->setTextModifier(&modifier);
|
||||||
outputModel->setRewriterView(rewriterView.data());
|
outputModel->setRewriterView(rewriterView.data());
|
||||||
@@ -149,7 +147,7 @@ void DesignDocumentView::fromText(QString text)
|
|||||||
textEdit.setPlainText(imports + text);
|
textEdit.setPlainText(imports + text);
|
||||||
NotIndentingTextEditModifier modifier(&textEdit);
|
NotIndentingTextEditModifier modifier(&textEdit);
|
||||||
|
|
||||||
QScopedPointer<RewriterView> rewriterView(new RewriterView(RewriterView::Amend, 0));
|
QScopedPointer<RewriterView> rewriterView(new RewriterView(RewriterView::Amend, nullptr));
|
||||||
rewriterView->setCheckSemanticErrors(false);
|
rewriterView->setCheckSemanticErrors(false);
|
||||||
rewriterView->setTextModifier(&modifier);
|
rewriterView->setTextModifier(&modifier);
|
||||||
inputModel->setRewriterView(rewriterView.data());
|
inputModel->setRewriterView(rewriterView.data());
|
||||||
@@ -172,7 +170,7 @@ static Model *currentModel()
|
|||||||
if (document)
|
if (document)
|
||||||
return document->currentModel();
|
return document->currentModel();
|
||||||
|
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Model *DesignDocumentView::pasteToModel()
|
Model *DesignDocumentView::pasteToModel()
|
||||||
|
@@ -35,9 +35,7 @@ UtilityPanelController::UtilityPanelController(QObject* parent):
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
UtilityPanelController::~UtilityPanelController()
|
UtilityPanelController::~UtilityPanelController() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget* UtilityPanelController::widget()
|
QWidget* UtilityPanelController::widget()
|
||||||
{
|
{
|
||||||
|
@@ -41,11 +41,9 @@ namespace QmlDesigner {
|
|||||||
class ItemLibraryFileIconProvider : public QFileIconProvider
|
class ItemLibraryFileIconProvider : public QFileIconProvider
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ItemLibraryFileIconProvider()
|
ItemLibraryFileIconProvider() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QIcon icon( const QFileInfo & info ) const
|
QIcon icon( const QFileInfo & info ) const override
|
||||||
{
|
{
|
||||||
QIcon icon;
|
QIcon icon;
|
||||||
|
|
||||||
|
@@ -33,9 +33,7 @@ ItemLibraryItem::ItemLibraryItem(QObject *parent)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemLibraryItem::~ItemLibraryItem()
|
ItemLibraryItem::~ItemLibraryItem() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QString ItemLibraryItem::itemName() const
|
QString ItemLibraryItem::itemName() const
|
||||||
{
|
{
|
||||||
|
@@ -88,11 +88,11 @@ QVariant ItemLibraryModel::data(const QModelIndex &index, int role) const
|
|||||||
if (m_roleNames.contains(role)) {
|
if (m_roleNames.contains(role)) {
|
||||||
QVariant value = m_sections.at(index.row())->property(m_roleNames.value(role));
|
QVariant value = m_sections.at(index.row())->property(m_roleNames.value(role));
|
||||||
|
|
||||||
ItemLibrarySectionModel* model = qobject_cast<ItemLibrarySectionModel *>(value.value<QObject*>());
|
auto model = qobject_cast<ItemLibrarySectionModel *>(value.value<QObject*>());
|
||||||
if (model)
|
if (model)
|
||||||
return QVariant::fromValue(model);
|
return QVariant::fromValue(model);
|
||||||
|
|
||||||
ItemLibraryModel* model2 = qobject_cast<ItemLibraryModel *>(value.value<QObject*>());
|
auto model2 = qobject_cast<ItemLibraryModel *>(value.value<QObject*>());
|
||||||
if (model2)
|
if (model2)
|
||||||
return QVariant::fromValue(model2);
|
return QVariant::fromValue(model2);
|
||||||
|
|
||||||
@@ -192,13 +192,13 @@ void ItemLibraryModel::update(ItemLibraryInfo *itemLibraryInfo, Model *model)
|
|||||||
qCInfo(itemlibraryPopulate) << "Adding:" << entry.typeName() << "to:" << entry.category();
|
qCInfo(itemlibraryPopulate) << "Adding:" << entry.typeName() << "to:" << entry.category();
|
||||||
ItemLibrarySection *sectionModel = sectionByName(itemSectionName);
|
ItemLibrarySection *sectionModel = sectionByName(itemSectionName);
|
||||||
|
|
||||||
if (sectionModel == 0) {
|
if (sectionModel == nullptr) {
|
||||||
sectionModel = new ItemLibrarySection(itemSectionName, this);
|
sectionModel = new ItemLibrarySection(itemSectionName, this);
|
||||||
m_sections.append(sectionModel);
|
m_sections.append(sectionModel);
|
||||||
sectionModel->setSectionExpanded(sectionExapanded(itemSectionName));
|
sectionModel->setSectionExpanded(sectionExapanded(itemSectionName));
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemLibraryItem *item = new ItemLibraryItem(sectionModel);
|
auto item = new ItemLibraryItem(sectionModel);
|
||||||
item->setItemLibraryEntry(entry);
|
item->setItemLibraryEntry(entry);
|
||||||
sectionModel->addSectionEntry(item);
|
sectionModel->addSectionEntry(item);
|
||||||
}
|
}
|
||||||
@@ -212,7 +212,7 @@ void ItemLibraryModel::update(ItemLibraryInfo *itemLibraryInfo, Model *model)
|
|||||||
|
|
||||||
QMimeData *ItemLibraryModel::getMimeData(const ItemLibraryEntry &itemLibraryEntry)
|
QMimeData *ItemLibraryModel::getMimeData(const ItemLibraryEntry &itemLibraryEntry)
|
||||||
{
|
{
|
||||||
QMimeData *mimeData = new QMimeData();
|
auto mimeData = new QMimeData();
|
||||||
|
|
||||||
QByteArray data;
|
QByteArray data;
|
||||||
QDataStream stream(&data, QIODevice::WriteOnly);
|
QDataStream stream(&data, QIODevice::WriteOnly);
|
||||||
@@ -248,7 +248,7 @@ ItemLibrarySection *ItemLibraryModel::sectionByName(const QString §ionName)
|
|||||||
return itemLibrarySection;
|
return itemLibrarySection;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ItemLibraryModel::updateVisibility(bool *changed)
|
void ItemLibraryModel::updateVisibility(bool *changed)
|
||||||
|
@@ -46,7 +46,7 @@ namespace QmlDesigner {
|
|||||||
|
|
||||||
void ItemLibraryResourceView::addSizeAction(QActionGroup *group, const QString &text, int gridSize, int iconSize)
|
void ItemLibraryResourceView::addSizeAction(QActionGroup *group, const QString &text, int gridSize, int iconSize)
|
||||||
{
|
{
|
||||||
QAction *action = new QAction(text, group);
|
auto action = new QAction(text, group);
|
||||||
group->addAction(action);
|
group->addAction(action);
|
||||||
action->setCheckable(true);
|
action->setCheckable(true);
|
||||||
QAction::connect(action, &QAction::triggered, this, [this, gridSize, iconSize]() {
|
QAction::connect(action, &QAction::triggered, this, [this, gridSize, iconSize]() {
|
||||||
@@ -80,7 +80,7 @@ ItemLibraryResourceView::ItemLibraryResourceView(QWidget *parent) :
|
|||||||
|
|
||||||
setContextMenuPolicy(Qt::ActionsContextMenu);
|
setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||||
|
|
||||||
QActionGroup *actionGroup = new QActionGroup(this);
|
auto actionGroup = new QActionGroup(this);
|
||||||
actionGroup->setExclusive(true);
|
actionGroup->setExclusive(true);
|
||||||
|
|
||||||
addSizeAction(actionGroup, tr("Large Icons"), 256, 192);
|
addSizeAction(actionGroup, tr("Large Icons"), 256, 192);
|
||||||
@@ -113,14 +113,14 @@ void ItemLibraryResourceView::startDrag(Qt::DropActions /* supportedActions */)
|
|||||||
if (!mimeData)
|
if (!mimeData)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CustomFileSystemModel *fileSystemModel = qobject_cast<CustomFileSystemModel*>(model());
|
auto fileSystemModel = qobject_cast<CustomFileSystemModel*>(model());
|
||||||
Q_ASSERT(fileSystemModel);
|
Q_ASSERT(fileSystemModel);
|
||||||
QFileInfo fileInfo = fileSystemModel->fileInfo(selectedIndexes().front());
|
QFileInfo fileInfo = fileSystemModel->fileInfo(selectedIndexes().front());
|
||||||
QPixmap pixmap(fileInfo.absoluteFilePath());
|
QPixmap pixmap(fileInfo.absoluteFilePath());
|
||||||
if (!pixmap.isNull()) {
|
if (!pixmap.isNull()) {
|
||||||
QDrag *drag = new QDrag(this);
|
auto drag = new QDrag(this);
|
||||||
drag->setPixmap(QIcon(pixmap).pixmap(128, 128));
|
drag->setPixmap(QIcon(pixmap).pixmap(128, 128));
|
||||||
QMimeData *mimeData = new QMimeData;
|
auto mimeData = new QMimeData;
|
||||||
mimeData->setData(QLatin1String("application/vnd.bauhaus.libraryresource"), fileInfo.absoluteFilePath().toUtf8());
|
mimeData->setData(QLatin1String("application/vnd.bauhaus.libraryresource"), fileInfo.absoluteFilePath().toUtf8());
|
||||||
drag->setMimeData(mimeData);
|
drag->setMimeData(mimeData);
|
||||||
drag->exec();
|
drag->exec();
|
||||||
|
@@ -57,7 +57,7 @@ QVariant ItemLibrarySectionModel::data(const QModelIndex &index, int role) const
|
|||||||
if (m_roleNames.contains(role)) {
|
if (m_roleNames.contains(role)) {
|
||||||
QVariant value = m_itemList.at(index.row())->property(m_roleNames.value(role));
|
QVariant value = m_itemList.at(index.row())->property(m_roleNames.value(role));
|
||||||
|
|
||||||
if (ItemLibrarySectionModel* model = qobject_cast<ItemLibrarySectionModel *>(value.value<QObject*>()))
|
if (auto model = qobject_cast<ItemLibrarySectionModel *>(value.value<QObject*>()))
|
||||||
return QVariant::fromValue(model);
|
return QVariant::fromValue(model);
|
||||||
|
|
||||||
return m_itemList.at(index.row())->property(m_roleNames.value(role));
|
return m_itemList.at(index.row())->property(m_roleNames.value(role));
|
||||||
|
@@ -39,10 +39,7 @@ ItemLibraryView::ItemLibraryView(QObject* parent)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemLibraryView::~ItemLibraryView()
|
ItemLibraryView::~ItemLibraryView() = default;
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ItemLibraryView::hasWidget() const
|
bool ItemLibraryView::hasWidget() const
|
||||||
{
|
{
|
||||||
@@ -79,7 +76,7 @@ void ItemLibraryView::modelAboutToBeDetached(Model *model)
|
|||||||
|
|
||||||
AbstractView::modelAboutToBeDetached(model);
|
AbstractView::modelAboutToBeDetached(model);
|
||||||
|
|
||||||
m_widget->setModel(0);
|
m_widget->setModel(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ItemLibraryView::importsChanged(const QList<Import> &/*addedImports*/, const QList<Import> &/*removedImports*/)
|
void ItemLibraryView::importsChanged(const QList<Import> &/*addedImports*/, const QList<Import> &/*removedImports*/)
|
||||||
|
@@ -111,7 +111,7 @@ ItemLibraryWidget::ItemLibraryWidget(QWidget *parent) :
|
|||||||
Theme::setupTheme(m_itemViewQuickWidget->engine());
|
Theme::setupTheme(m_itemViewQuickWidget->engine());
|
||||||
|
|
||||||
/* other widgets */
|
/* other widgets */
|
||||||
QTabBar *tabBar = new QTabBar(this);
|
auto tabBar = new QTabBar(this);
|
||||||
tabBar->addTab(tr("QML Types", "Title of library QML types view"));
|
tabBar->addTab(tr("QML Types", "Title of library QML types view"));
|
||||||
tabBar->addTab(tr("Resources", "Title of library resources view"));
|
tabBar->addTab(tr("Resources", "Title of library resources view"));
|
||||||
tabBar->addTab(tr("Imports", "Title of library imports view"));
|
tabBar->addTab(tr("Imports", "Title of library imports view"));
|
||||||
@@ -128,7 +128,7 @@ ItemLibraryWidget::ItemLibraryWidget(QWidget *parent) :
|
|||||||
m_filterLineEdit->setFiltering(true);
|
m_filterLineEdit->setFiltering(true);
|
||||||
QWidget *lineEditFrame = new QWidget(this);
|
QWidget *lineEditFrame = new QWidget(this);
|
||||||
lineEditFrame->setObjectName(QStringLiteral("itemLibrarySearchInputFrame"));
|
lineEditFrame->setObjectName(QStringLiteral("itemLibrarySearchInputFrame"));
|
||||||
QGridLayout *lineEditLayout = new QGridLayout(lineEditFrame);
|
auto lineEditLayout = new QGridLayout(lineEditFrame);
|
||||||
lineEditLayout->setMargin(2);
|
lineEditLayout->setMargin(2);
|
||||||
lineEditLayout->setSpacing(0);
|
lineEditLayout->setSpacing(0);
|
||||||
lineEditLayout->addItem(new QSpacerItem(5, 3, QSizePolicy::Fixed, QSizePolicy::Fixed), 0, 0, 1, 3);
|
lineEditLayout->addItem(new QSpacerItem(5, 3, QSizePolicy::Fixed, QSizePolicy::Fixed), 0, 0, 1, 3);
|
||||||
@@ -145,7 +145,7 @@ ItemLibraryWidget::ItemLibraryWidget(QWidget *parent) :
|
|||||||
spacer->setObjectName(QStringLiteral("itemLibrarySearchInputSpacer"));
|
spacer->setObjectName(QStringLiteral("itemLibrarySearchInputSpacer"));
|
||||||
spacer->setFixedHeight(4);
|
spacer->setFixedHeight(4);
|
||||||
|
|
||||||
QGridLayout *layout = new QGridLayout(this);
|
auto layout = new QGridLayout(this);
|
||||||
layout->setContentsMargins(0, 0, 0, 0);
|
layout->setContentsMargins(0, 0, 0, 0);
|
||||||
layout->setSpacing(0);
|
layout->setSpacing(0);
|
||||||
layout->addWidget(tabBar, 0, 0, 1, 1);
|
layout->addWidget(tabBar, 0, 0, 1, 1);
|
||||||
@@ -166,7 +166,7 @@ ItemLibraryWidget::ItemLibraryWidget(QWidget *parent) :
|
|||||||
|
|
||||||
connect(&m_compressionTimer, &QTimer::timeout, this, &ItemLibraryWidget::updateModel);
|
connect(&m_compressionTimer, &QTimer::timeout, this, &ItemLibraryWidget::updateModel);
|
||||||
|
|
||||||
auto *flowLayout = new Utils::FlowLayout(m_importTagsWidget.data());
|
auto flowLayout = new Utils::FlowLayout(m_importTagsWidget.data());
|
||||||
flowLayout->setMargin(4);
|
flowLayout->setMargin(4);
|
||||||
|
|
||||||
m_addResourcesWidget->setVisible(false);
|
m_addResourcesWidget->setVisible(false);
|
||||||
@@ -291,7 +291,7 @@ void ItemLibraryWidget::setupImportTagWidget()
|
|||||||
|
|
||||||
qDeleteAll(m_importTagsWidget->findChildren<QWidget*>("", Qt::FindDirectChildrenOnly));
|
qDeleteAll(m_importTagsWidget->findChildren<QWidget*>("", Qt::FindDirectChildrenOnly));
|
||||||
|
|
||||||
auto *flowLayout = m_importTagsWidget->layout();
|
auto flowLayout = m_importTagsWidget->layout();
|
||||||
|
|
||||||
auto createButton = [this](const QString &import) {
|
auto createButton = [this](const QString &import) {
|
||||||
auto button = new QToolButton(m_importTagsWidget.data());
|
auto button = new QToolButton(m_importTagsWidget.data());
|
||||||
@@ -342,7 +342,7 @@ void ItemLibraryWidget::startDragAndDrop(QQuickItem *mouseArea, QVariant itemLib
|
|||||||
m_currentitemLibraryEntry = itemLibraryId.value<ItemLibraryEntry>();
|
m_currentitemLibraryEntry = itemLibraryId.value<ItemLibraryEntry>();
|
||||||
|
|
||||||
QMimeData *mimeData = m_itemLibraryModel->getMimeData(m_currentitemLibraryEntry);
|
QMimeData *mimeData = m_itemLibraryModel->getMimeData(m_currentitemLibraryEntry);
|
||||||
QDrag *drag = new QDrag(this);
|
auto drag = new QDrag(this);
|
||||||
|
|
||||||
drag->setPixmap(Utils::StyleHelper::dpiSpecificImageFile(
|
drag->setPixmap(Utils::StyleHelper::dpiSpecificImageFile(
|
||||||
m_currentitemLibraryEntry.libraryEntryIconPath()));
|
m_currentitemLibraryEntry.libraryEntryIconPath()));
|
||||||
|
@@ -205,7 +205,7 @@ static void openContextMenu(const QModelIndex &index, const QPoint &pos)
|
|||||||
bool NameItemDelegate::editorEvent(QEvent *event, QAbstractItemModel *, const QStyleOptionViewItem &, const QModelIndex &index)
|
bool NameItemDelegate::editorEvent(QEvent *event, QAbstractItemModel *, const QStyleOptionViewItem &, const QModelIndex &index)
|
||||||
{
|
{
|
||||||
if (event->type() == QEvent::MouseButtonRelease) {
|
if (event->type() == QEvent::MouseButtonRelease) {
|
||||||
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
|
auto mouseEvent = static_cast<QMouseEvent *>(event);
|
||||||
if (mouseEvent->button() == Qt::RightButton) {
|
if (mouseEvent->button() == Qt::RightButton) {
|
||||||
openContextMenu(index, mouseEvent->globalPos());
|
openContextMenu(index, mouseEvent->globalPos());
|
||||||
mouseEvent->accept();
|
mouseEvent->accept();
|
||||||
@@ -220,7 +220,7 @@ QWidget *NameItemDelegate::createEditor(QWidget *parent,
|
|||||||
const QModelIndex &index) const
|
const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if (!getModelNode(index).isValid())
|
if (!getModelNode(index).isValid())
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
return new QLineEdit(parent);
|
return new QLineEdit(parent);
|
||||||
}
|
}
|
||||||
@@ -230,7 +230,7 @@ void NameItemDelegate::setEditorData(QWidget *editor, const QModelIndex &index)
|
|||||||
const ModelNode node = getModelNode(index);
|
const ModelNode node = getModelNode(index);
|
||||||
const QString value = node.id();
|
const QString value = node.id();
|
||||||
|
|
||||||
QLineEdit *lineEdit = static_cast<QLineEdit*>(editor);
|
auto lineEdit = static_cast<QLineEdit*>(editor);
|
||||||
lineEdit->setText(value);
|
lineEdit->setText(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -259,7 +259,7 @@ static void setId(const QModelIndex &index, const QString &newId)
|
|||||||
void NameItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
|
void NameItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(model);
|
Q_UNUSED(model);
|
||||||
QLineEdit *lineEdit = static_cast<QLineEdit*>(editor);
|
auto lineEdit = static_cast<QLineEdit*>(editor);
|
||||||
setId(index,lineEdit->text());
|
setId(index,lineEdit->text());
|
||||||
lineEdit->clearFocus();
|
lineEdit->clearFocus();
|
||||||
}
|
}
|
||||||
@@ -268,7 +268,7 @@ void NameItemDelegate::updateEditorGeometry(QWidget *editor,
|
|||||||
const QStyleOptionViewItem &option,
|
const QStyleOptionViewItem &option,
|
||||||
const QModelIndex & /*index*/) const
|
const QModelIndex & /*index*/) const
|
||||||
{
|
{
|
||||||
QLineEdit *lineEdit = static_cast<QLineEdit*>(editor);
|
auto lineEdit = static_cast<QLineEdit*>(editor);
|
||||||
lineEdit->setGeometry(option.rect);
|
lineEdit->setGeometry(option.rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -176,9 +176,7 @@ NavigatorTreeModel::NavigatorTreeModel(QObject *parent) : QAbstractItemModel(par
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
NavigatorTreeModel::~NavigatorTreeModel()
|
NavigatorTreeModel::~NavigatorTreeModel() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariant NavigatorTreeModel::data(const QModelIndex &index, int role) const
|
QVariant NavigatorTreeModel::data(const QModelIndex &index, int role) const
|
||||||
{
|
{
|
||||||
@@ -373,7 +371,7 @@ QStringList NavigatorTreeModel::mimeTypes() const
|
|||||||
|
|
||||||
QMimeData *NavigatorTreeModel::mimeData(const QModelIndexList &modelIndexList) const
|
QMimeData *NavigatorTreeModel::mimeData(const QModelIndexList &modelIndexList) const
|
||||||
{
|
{
|
||||||
QMimeData *mimeData = new QMimeData();
|
auto mimeData = new QMimeData();
|
||||||
|
|
||||||
QByteArray encodedModelNodeData;
|
QByteArray encodedModelNodeData;
|
||||||
QDataStream encodedModelNodeDataStream(&encodedModelNodeData, QIODevice::WriteOnly);
|
QDataStream encodedModelNodeDataStream(&encodedModelNodeData, QIODevice::WriteOnly);
|
||||||
|
@@ -60,7 +60,7 @@ public:
|
|||||||
baseStyle()->setParent(parent);
|
baseStyle()->setParent(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const
|
void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = nullptr) const override
|
||||||
{
|
{
|
||||||
static QRect mouseOverStateSavedFrameRectangle;
|
static QRect mouseOverStateSavedFrameRectangle;
|
||||||
if (element == QStyle::PE_PanelItemViewRow) {
|
if (element == QStyle::PE_PanelItemViewRow) {
|
||||||
@@ -98,7 +98,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int styleHint(StyleHint hint, const QStyleOption *option = 0, const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const {
|
int styleHint(StyleHint hint, const QStyleOption *option = nullptr, const QWidget *widget = nullptr, QStyleHintReturn *returnData = nullptr) const override {
|
||||||
if (hint == SH_ItemView_ShowDecorationSelected)
|
if (hint == SH_ItemView_ShowDecorationSelected)
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
|
@@ -75,7 +75,7 @@ NavigatorView::NavigatorView(QObject* parent) :
|
|||||||
m_treeModel(new NavigatorTreeModel(this))
|
m_treeModel(new NavigatorTreeModel(this))
|
||||||
{
|
{
|
||||||
#ifndef QMLDESIGNER_TEST
|
#ifndef QMLDESIGNER_TEST
|
||||||
Internal::NavigatorContext *navigatorContext = new Internal::NavigatorContext(m_widget.data());
|
auto navigatorContext = new Internal::NavigatorContext(m_widget.data());
|
||||||
Core::ICore::addContextObject(navigatorContext);
|
Core::ICore::addContextObject(navigatorContext);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ NavigatorView::NavigatorView(QObject* parent) :
|
|||||||
connect(m_widget.data(), &NavigatorWidget::filterToggled, this, &NavigatorView::filterToggled);
|
connect(m_widget.data(), &NavigatorWidget::filterToggled, this, &NavigatorView::filterToggled);
|
||||||
|
|
||||||
#ifndef QMLDESIGNER_TEST
|
#ifndef QMLDESIGNER_TEST
|
||||||
NameItemDelegate *idDelegate = new NameItemDelegate(this);
|
auto idDelegate = new NameItemDelegate(this);
|
||||||
IconCheckboxItemDelegate *showDelegate =
|
IconCheckboxItemDelegate *showDelegate =
|
||||||
new IconCheckboxItemDelegate(this,
|
new IconCheckboxItemDelegate(this,
|
||||||
Utils::Icons::EYE_OPEN_TOOLBAR.icon(),
|
Utils::Icons::EYE_OPEN_TOOLBAR.icon(),
|
||||||
@@ -479,7 +479,7 @@ QTreeView *NavigatorView::treeWidget() const
|
|||||||
{
|
{
|
||||||
if (m_widget)
|
if (m_widget)
|
||||||
return m_widget->treeView();
|
return m_widget->treeView();
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
NavigatorTreeModel *NavigatorView::treeModel()
|
NavigatorTreeModel *NavigatorView::treeModel()
|
||||||
|
@@ -43,9 +43,9 @@ FileResourcesModel::FileResourcesModel(QObject *parent) :
|
|||||||
void FileResourcesModel::setModelNodeBackend(const QVariant &modelNodeBackend)
|
void FileResourcesModel::setModelNodeBackend(const QVariant &modelNodeBackend)
|
||||||
{
|
{
|
||||||
|
|
||||||
QObject* modelNodeBackendObject = modelNodeBackend.value<QObject*>();
|
auto modelNodeBackendObject = modelNodeBackend.value<QObject*>();
|
||||||
|
|
||||||
const QmlDesigner::QmlModelNodeProxy *backendObjectCasted =
|
const auto backendObjectCasted =
|
||||||
qobject_cast<const QmlDesigner::QmlModelNodeProxy *>(modelNodeBackendObject);
|
qobject_cast<const QmlDesigner::QmlModelNodeProxy *>(modelNodeBackendObject);
|
||||||
|
|
||||||
if (backendObjectCasted)
|
if (backendObjectCasted)
|
||||||
|
@@ -291,9 +291,9 @@ void GradientModel::setupModel()
|
|||||||
|
|
||||||
void GradientModel::setAnchorBackend(const QVariant &anchorBackend)
|
void GradientModel::setAnchorBackend(const QVariant &anchorBackend)
|
||||||
{
|
{
|
||||||
QObject* anchorBackendObject = anchorBackend.value<QObject*>();
|
auto anchorBackendObject = anchorBackend.value<QObject*>();
|
||||||
|
|
||||||
const QmlDesigner::Internal::QmlAnchorBindingProxy *backendCasted =
|
const auto backendCasted =
|
||||||
qobject_cast<const QmlDesigner::Internal::QmlAnchorBindingProxy *>(anchorBackendObject);
|
qobject_cast<const QmlDesigner::Internal::QmlAnchorBindingProxy *>(anchorBackendObject);
|
||||||
|
|
||||||
if (backendCasted)
|
if (backendCasted)
|
||||||
@@ -330,7 +330,7 @@ bool GradientModel::locked() const
|
|||||||
if (m_locked)
|
if (m_locked)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
QmlDesigner::PropertyEditorView *view = qobject_cast<QmlDesigner::PropertyEditorView*>(m_itemNode.view());
|
auto view = qobject_cast<QmlDesigner::PropertyEditorView*>(m_itemNode.view());
|
||||||
|
|
||||||
if (view && view->locked())
|
if (view && view->locked())
|
||||||
return true;
|
return true;
|
||||||
|
@@ -84,9 +84,9 @@ PropertyEditorContextObject::PropertyEditorContextObject(QObject *parent) :
|
|||||||
QObject(parent),
|
QObject(parent),
|
||||||
m_isBaseState(false),
|
m_isBaseState(false),
|
||||||
m_selectionChanged(false),
|
m_selectionChanged(false),
|
||||||
m_backendValues(0),
|
m_backendValues(nullptr),
|
||||||
m_qmlComponent(0),
|
m_qmlComponent(nullptr),
|
||||||
m_qmlContext(0)
|
m_qmlContext(nullptr)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -342,7 +342,7 @@ void PropertyEditorContextObject::setSpecificQmlData(const QString &newSpecificQ
|
|||||||
m_specificQmlData = newSpecificQmlData;
|
m_specificQmlData = newSpecificQmlData;
|
||||||
|
|
||||||
delete m_qmlComponent;
|
delete m_qmlComponent;
|
||||||
m_qmlComponent = 0;
|
m_qmlComponent = nullptr;
|
||||||
|
|
||||||
emit specificQmlComponentChanged();
|
emit specificQmlComponentChanged();
|
||||||
emit specificQmlDataChanged();
|
emit specificQmlDataChanged();
|
||||||
|
@@ -86,7 +86,7 @@ static QObject *variantToQObject(const QVariant &value)
|
|||||||
if (value.userType() == QMetaType::QObjectStar || value.userType() > QMetaType::User)
|
if (value.userType() == QMetaType::QObjectStar || value.userType() > QMetaType::User)
|
||||||
return *(QObject **)value.constData();
|
return *(QObject **)value.constData();
|
||||||
|
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
@@ -109,15 +109,13 @@ PropertyEditorQmlBackend::PropertyEditorQmlBackend(PropertyEditorView *propertyE
|
|||||||
propertyEditor, &PropertyEditorView::changeValue);
|
propertyEditor, &PropertyEditorView::changeValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
PropertyEditorQmlBackend::~PropertyEditorQmlBackend()
|
PropertyEditorQmlBackend::~PropertyEditorQmlBackend() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void PropertyEditorQmlBackend::setupPropertyEditorValue(const PropertyName &name, PropertyEditorView *propertyEditor, const QString &type)
|
void PropertyEditorQmlBackend::setupPropertyEditorValue(const PropertyName &name, PropertyEditorView *propertyEditor, const QString &type)
|
||||||
{
|
{
|
||||||
QmlDesigner::PropertyName propertyName(name);
|
QmlDesigner::PropertyName propertyName(name);
|
||||||
propertyName.replace('.', '_');
|
propertyName.replace('.', '_');
|
||||||
PropertyEditorValue *valueObject = qobject_cast<PropertyEditorValue*>(variantToQObject(backendValuesPropertyMap().value(QString::fromUtf8(propertyName))));
|
auto valueObject = qobject_cast<PropertyEditorValue*>(variantToQObject(backendValuesPropertyMap().value(QString::fromUtf8(propertyName))));
|
||||||
if (!valueObject) {
|
if (!valueObject) {
|
||||||
valueObject = new PropertyEditorValue(&backendValuesPropertyMap());
|
valueObject = new PropertyEditorValue(&backendValuesPropertyMap());
|
||||||
QObject::connect(valueObject, &PropertyEditorValue::valueChanged, &backendValuesPropertyMap(), &DesignerPropertyMap::valueChanged);
|
QObject::connect(valueObject, &PropertyEditorValue::valueChanged, &backendValuesPropertyMap(), &DesignerPropertyMap::valueChanged);
|
||||||
@@ -186,7 +184,7 @@ void PropertyEditorQmlBackend::createPropertyEditorValue(const QmlObjectNode &qm
|
|||||||
{
|
{
|
||||||
PropertyName propertyName(name);
|
PropertyName propertyName(name);
|
||||||
propertyName.replace('.', '_');
|
propertyName.replace('.', '_');
|
||||||
PropertyEditorValue *valueObject = qobject_cast<PropertyEditorValue*>(variantToQObject(backendValuesPropertyMap().value(QString::fromUtf8(propertyName))));
|
auto valueObject = qobject_cast<PropertyEditorValue*>(variantToQObject(backendValuesPropertyMap().value(QString::fromUtf8(propertyName))));
|
||||||
if (!valueObject) {
|
if (!valueObject) {
|
||||||
valueObject = new PropertyEditorValue(&backendValuesPropertyMap());
|
valueObject = new PropertyEditorValue(&backendValuesPropertyMap());
|
||||||
QObject::connect(valueObject, &PropertyEditorValue::valueChanged, &backendValuesPropertyMap(), &DesignerPropertyMap::valueChanged);
|
QObject::connect(valueObject, &PropertyEditorValue::valueChanged, &backendValuesPropertyMap(), &DesignerPropertyMap::valueChanged);
|
||||||
@@ -220,7 +218,7 @@ void PropertyEditorQmlBackend::setValue(const QmlObjectNode & qmlObjectNode, con
|
|||||||
{
|
{
|
||||||
PropertyName propertyName = name;
|
PropertyName propertyName = name;
|
||||||
propertyName.replace('.', '_');
|
propertyName.replace('.', '_');
|
||||||
PropertyEditorValue *propertyValue = qobject_cast<PropertyEditorValue*>(variantToQObject(m_backendValuesPropertyMap.value(QString::fromUtf8(propertyName))));
|
auto propertyValue = qobject_cast<PropertyEditorValue*>(variantToQObject(m_backendValuesPropertyMap.value(QString::fromUtf8(propertyName))));
|
||||||
if (propertyValue) {
|
if (propertyValue) {
|
||||||
propertyValue->setValue(value);
|
propertyValue->setValue(value);
|
||||||
|
|
||||||
@@ -285,7 +283,7 @@ void PropertyEditorQmlBackend::setup(const QmlObjectNode &qmlObjectNode, const Q
|
|||||||
setupLayoutAttachedProperties(qmlObjectNode, propertyEditor);
|
setupLayoutAttachedProperties(qmlObjectNode, propertyEditor);
|
||||||
|
|
||||||
// className
|
// className
|
||||||
PropertyEditorValue *valueObject = qobject_cast<PropertyEditorValue*>(variantToQObject(m_backendValuesPropertyMap.value(QLatin1String("className"))));
|
auto valueObject = qobject_cast<PropertyEditorValue*>(variantToQObject(m_backendValuesPropertyMap.value(QLatin1String("className"))));
|
||||||
if (!valueObject)
|
if (!valueObject)
|
||||||
valueObject = new PropertyEditorValue(&m_backendValuesPropertyMap);
|
valueObject = new PropertyEditorValue(&m_backendValuesPropertyMap);
|
||||||
valueObject->setName("className");
|
valueObject->setName("className");
|
||||||
@@ -366,7 +364,7 @@ void PropertyEditorQmlBackend::initialSetup(const TypeName &typeName, const QUrl
|
|||||||
foreach (const PropertyName &propertyName, metaInfo.propertyNames())
|
foreach (const PropertyName &propertyName, metaInfo.propertyNames())
|
||||||
setupPropertyEditorValue(propertyName, propertyEditor, QString::fromUtf8(metaInfo.propertyTypeName(propertyName)));
|
setupPropertyEditorValue(propertyName, propertyEditor, QString::fromUtf8(metaInfo.propertyTypeName(propertyName)));
|
||||||
|
|
||||||
PropertyEditorValue *valueObject = qobject_cast<PropertyEditorValue*>(variantToQObject(m_backendValuesPropertyMap.value(QLatin1String("className"))));
|
auto valueObject = qobject_cast<PropertyEditorValue*>(variantToQObject(m_backendValuesPropertyMap.value(QLatin1String("className"))));
|
||||||
if (!valueObject)
|
if (!valueObject)
|
||||||
valueObject = new PropertyEditorValue(&m_backendValuesPropertyMap);
|
valueObject = new PropertyEditorValue(&m_backendValuesPropertyMap);
|
||||||
valueObject->setName("className");
|
valueObject->setName("className");
|
||||||
|
@@ -441,7 +441,7 @@ void PropertyEditorNodeWrapper::changeValue(const QString &propertyName)
|
|||||||
if (m_modelNode.isValid()) {
|
if (m_modelNode.isValid()) {
|
||||||
QmlDesigner::QmlObjectNode qmlObjectNode(m_modelNode);
|
QmlDesigner::QmlObjectNode qmlObjectNode(m_modelNode);
|
||||||
|
|
||||||
PropertyEditorValue *valueObject = qvariant_cast<PropertyEditorValue *>(m_valuesPropertyMap.value(QString::fromLatin1(name)));
|
auto valueObject = qvariant_cast<PropertyEditorValue *>(m_valuesPropertyMap.value(QString::fromLatin1(name)));
|
||||||
|
|
||||||
if (valueObject->value().isValid())
|
if (valueObject->value().isValid())
|
||||||
qmlObjectNode.setVariantProperty(name, valueObject->value());
|
qmlObjectNode.setVariantProperty(name, valueObject->value());
|
||||||
@@ -463,7 +463,7 @@ void PropertyEditorNodeWrapper::setup()
|
|||||||
|
|
||||||
foreach (const QmlDesigner::PropertyName &propertyName, m_modelNode.metaInfo().propertyNames()) {
|
foreach (const QmlDesigner::PropertyName &propertyName, m_modelNode.metaInfo().propertyNames()) {
|
||||||
if (qmlObjectNode.isValid()) {
|
if (qmlObjectNode.isValid()) {
|
||||||
PropertyEditorValue *valueObject = new PropertyEditorValue(&m_valuesPropertyMap);
|
auto valueObject = new PropertyEditorValue(&m_valuesPropertyMap);
|
||||||
valueObject->setName(propertyName);
|
valueObject->setName(propertyName);
|
||||||
valueObject->setValue(qmlObjectNode.instanceValue(propertyName));
|
valueObject->setValue(qmlObjectNode.instanceValue(propertyName));
|
||||||
connect(valueObject, &PropertyEditorValue::valueChanged, &m_valuesPropertyMap, &QQmlPropertyMap::valueChanged);
|
connect(valueObject, &PropertyEditorValue::valueChanged, &m_valuesPropertyMap, &QQmlPropertyMap::valueChanged);
|
||||||
|
@@ -70,10 +70,10 @@ static bool propertyIsAttachedLayoutProperty(const PropertyName &propertyName)
|
|||||||
PropertyEditorView::PropertyEditorView(QWidget *parent) :
|
PropertyEditorView::PropertyEditorView(QWidget *parent) :
|
||||||
AbstractView(parent),
|
AbstractView(parent),
|
||||||
m_parent(parent),
|
m_parent(parent),
|
||||||
m_updateShortcut(0),
|
m_updateShortcut(nullptr),
|
||||||
m_timerId(0),
|
m_timerId(0),
|
||||||
m_stackedWidget(new PropertyEditorWidget(parent)),
|
m_stackedWidget(new PropertyEditorWidget(parent)),
|
||||||
m_qmlBackEndForCurrentType(0),
|
m_qmlBackEndForCurrentType(nullptr),
|
||||||
m_locked(false),
|
m_locked(false),
|
||||||
m_setupCompleted(false),
|
m_setupCompleted(false),
|
||||||
m_singleShotTimer(new QTimer(this))
|
m_singleShotTimer(new QTimer(this))
|
||||||
@@ -170,7 +170,7 @@ void PropertyEditorView::changeValue(const QString &name)
|
|||||||
underscoreName.replace('.', '_');
|
underscoreName.replace('.', '_');
|
||||||
PropertyEditorValue *value = m_qmlBackEndForCurrentType->propertyValueForName(QString::fromLatin1(underscoreName));
|
PropertyEditorValue *value = m_qmlBackEndForCurrentType->propertyValueForName(QString::fromLatin1(underscoreName));
|
||||||
|
|
||||||
if (value ==0)
|
if (value ==nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QmlObjectNode qmlObjectNode(m_selectedNode);
|
QmlObjectNode qmlObjectNode(m_selectedNode);
|
||||||
@@ -381,7 +381,7 @@ void PropertyEditorView::updateSize()
|
|||||||
{
|
{
|
||||||
if (!m_qmlBackEndForCurrentType)
|
if (!m_qmlBackEndForCurrentType)
|
||||||
return;
|
return;
|
||||||
QWidget* frame = m_qmlBackEndForCurrentType->widget()->findChild<QWidget*>("propertyEditorFrame");
|
auto frame = m_qmlBackEndForCurrentType->widget()->findChild<QWidget*>("propertyEditorFrame");
|
||||||
if (frame)
|
if (frame)
|
||||||
frame->resize(m_stackedWidget->size());
|
frame->resize(m_stackedWidget->size());
|
||||||
}
|
}
|
||||||
@@ -412,7 +412,7 @@ void PropertyEditorView::timerEvent(QTimerEvent *timerEvent)
|
|||||||
|
|
||||||
void PropertyEditorView::resetView()
|
void PropertyEditorView::resetView()
|
||||||
{
|
{
|
||||||
if (model() == 0)
|
if (model() == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_locked = true;
|
m_locked = true;
|
||||||
@@ -688,7 +688,7 @@ bool PropertyEditorView::hasWidget() const
|
|||||||
|
|
||||||
WidgetInfo PropertyEditorView::widgetInfo()
|
WidgetInfo PropertyEditorView::widgetInfo()
|
||||||
{
|
{
|
||||||
return createWidgetInfo(m_stackedWidget, 0, QStringLiteral("Properties"), WidgetInfo::RightPane, 0);
|
return createWidgetInfo(m_stackedWidget, nullptr, QStringLiteral("Properties"), WidgetInfo::RightPane, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropertyEditorView::currentStateChanged(const ModelNode &node)
|
void PropertyEditorView::currentStateChanged(const ModelNode &node)
|
||||||
@@ -706,7 +706,7 @@ void PropertyEditorView::instancePropertyChanged(const QList<QPair<ModelNode, Pr
|
|||||||
return;
|
return;
|
||||||
m_locked = true;
|
m_locked = true;
|
||||||
|
|
||||||
typedef QPair<ModelNode, PropertyName> ModelNodePropertyPair;
|
using ModelNodePropertyPair = QPair<ModelNode, PropertyName>;
|
||||||
foreach (const ModelNodePropertyPair &propertyPair, propertyList) {
|
foreach (const ModelNodePropertyPair &propertyPair, propertyList) {
|
||||||
const ModelNode modelNode = propertyPair.first;
|
const ModelNode modelNode = propertyPair.first;
|
||||||
const QmlObjectNode qmlObjectNode(modelNode);
|
const QmlObjectNode qmlObjectNode(modelNode);
|
||||||
@@ -762,7 +762,7 @@ void PropertyEditorView::reloadQml()
|
|||||||
m_stackedWidget->removeWidget(widget);
|
m_stackedWidget->removeWidget(widget);
|
||||||
delete widget;
|
delete widget;
|
||||||
}
|
}
|
||||||
m_qmlBackEndForCurrentType = 0;
|
m_qmlBackEndForCurrentType = nullptr;
|
||||||
|
|
||||||
delayedResetView();
|
delayedResetView();
|
||||||
}
|
}
|
||||||
|
@@ -70,9 +70,7 @@ QmlAnchorBindingProxy::QmlAnchorBindingProxy(QObject *parent) :
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlAnchorBindingProxy::~QmlAnchorBindingProxy()
|
QmlAnchorBindingProxy::~QmlAnchorBindingProxy() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void QmlAnchorBindingProxy::setup(const QmlItemNode &fxItemNode)
|
void QmlAnchorBindingProxy::setup(const QmlItemNode &fxItemNode)
|
||||||
{
|
{
|
||||||
|
@@ -67,7 +67,7 @@ WidgetInfo StatesEditorView::widgetInfo()
|
|||||||
if (!m_statesEditorWidget)
|
if (!m_statesEditorWidget)
|
||||||
m_statesEditorWidget = new StatesEditorWidget(this, m_statesEditorModel.data());
|
m_statesEditorWidget = new StatesEditorWidget(this, m_statesEditorModel.data());
|
||||||
|
|
||||||
return createWidgetInfo(m_statesEditorWidget.data(), 0, QLatin1String("StatesEditor"), WidgetInfo::BottomPane, 0, tr("States"));
|
return createWidgetInfo(m_statesEditorWidget.data(), nullptr, QLatin1String("StatesEditor"), WidgetInfo::BottomPane, 0, tr("States"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatesEditorView::rootNodeTypeChanged(const QString &/*type*/, int /*majorVersion*/, int /*minorVersion*/)
|
void StatesEditorView::rootNodeTypeChanged(const QString &/*type*/, int /*majorVersion*/, int /*minorVersion*/)
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user