26 changed files with 416 additions and 24 deletions
@ -0,0 +1,43 @@ |
|||||
|
TEMPLATE = app |
||||
|
|
||||
|
QT += quick mvvmquick mvvmdatasyncquick widgets |
||||
|
|
||||
|
TARGET = DataSyncSampleQuick |
||||
|
|
||||
|
SOURCES += main.cpp |
||||
|
|
||||
|
RESOURCES += qml.qrc |
||||
|
|
||||
|
target.path = $$[QT_INSTALL_EXAMPLES]/mvvmdatasyncquick/$$TARGET |
||||
|
INSTALLS += target |
||||
|
|
||||
|
#not found by linker? |
||||
|
linux:!android { |
||||
|
LIBS += -L$$OUT_PWD/../../../lib #required to make this the first place to search |
||||
|
LIBS += -L$$[QT_INSTALL_LIBS] -licudata |
||||
|
LIBS += -L$$[QT_INSTALL_LIBS] -licui18n |
||||
|
LIBS += -L$$[QT_INSTALL_LIBS] -licuuc |
||||
|
} |
||||
|
|
||||
|
#add lib dir to rpath |
||||
|
mac: QMAKE_LFLAGS += '-Wl,-rpath,\'$$OUT_PWD/../../../lib\'' |
||||
|
|
||||
|
#link to core lib |
||||
|
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../../mvvmdatasynccore/DataSyncSampleCore/release/ -lDataSyncSampleCore |
||||
|
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../../mvvmdatasynccore/DataSyncSampleCore/debug/ -lDataSyncSampleCore |
||||
|
else:unix: LIBS += -L$$OUT_PWD/../../mvvmdatasynccore/DataSyncSampleCore/ -lDataSyncSampleCore |
||||
|
|
||||
|
INCLUDEPATH += $$PWD/../../mvvmdatasynccore/DataSyncSampleCore |
||||
|
DEPENDPATH += $$PWD/../../mvvmdatasynccore/DataSyncSampleCore |
||||
|
|
||||
|
win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../../mvvmdatasynccore/DataSyncSampleCore/release/libDataSyncSampleCore.a |
||||
|
else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../../mvvmdatasynccore/DataSyncSampleCore/debug/libDataSyncSampleCore.a |
||||
|
else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../../mvvmdatasynccore/DataSyncSampleCore/release/DataSyncSampleCore.lib |
||||
|
else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../../mvvmdatasynccore/DataSyncSampleCore/debug/DataSyncSampleCore.lib |
||||
|
else:unix: PRE_TARGETDEPS += $$OUT_PWD/../../mvvmdatasynccore/DataSyncSampleCore/libDataSyncSampleCore.a |
||||
|
|
||||
|
# thanks to qmlc files, only the import path must be fixed |
||||
|
samples_in_build { |
||||
|
QML_IMPORT_PATH = $$OUT_PWD/../../../qml |
||||
|
DEFINES += QML_PATH=\\\"$$QML_IMPORT_PATH\\\" |
||||
|
} |
@ -0,0 +1,77 @@ |
|||||
|
import QtQuick 2.10 |
||||
|
import QtQuick.Controls 2.3 |
||||
|
import QtQuick.Layouts 1.3 |
||||
|
import de.skycoder42.QtMvvm.Core 1.0 |
||||
|
import de.skycoder42.QtMvvm.Quick 1.0 |
||||
|
import de.skycoder42.QtMvvm.Sample 1.0 |
||||
|
|
||||
|
Page { |
||||
|
id: sampleView |
||||
|
property SampleViewModel viewModel: null |
||||
|
readonly property bool presentAsRoot: true |
||||
|
|
||||
|
header: ToolBar { |
||||
|
height: 56 |
||||
|
|
||||
|
Label { |
||||
|
anchors.fill: parent |
||||
|
font.pointSize: 16 |
||||
|
font.bold: true |
||||
|
elide: Label.ElideRight |
||||
|
horizontalAlignment: Qt.AlignLeft |
||||
|
verticalAlignment: Qt.AlignVCenter |
||||
|
leftPadding: 10 |
||||
|
text: qsTr("Datasync Sample") |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
PresenterProgress {} |
||||
|
|
||||
|
Pane { |
||||
|
anchors.fill: parent |
||||
|
GridLayout { |
||||
|
id: grid |
||||
|
anchors.fill: parent |
||||
|
|
||||
|
columns: 2 |
||||
|
|
||||
|
ListView { |
||||
|
id: mainList |
||||
|
Layout.columnSpan: 2 |
||||
|
Layout.fillHeight: true |
||||
|
Layout.fillWidth: true |
||||
|
clip: true |
||||
|
model: viewModel.model |
||||
|
|
||||
|
delegate: ItemDelegate { |
||||
|
width: parent.width |
||||
|
text: key |
||||
|
onPressAndHold: viewModel.removeAt(index) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
TextField { |
||||
|
id: addField |
||||
|
placeholderText: "Key" |
||||
|
Layout.fillWidth: true |
||||
|
} |
||||
|
|
||||
|
Button { |
||||
|
id: addButton |
||||
|
text: qsTr("Add") |
||||
|
onClicked: { |
||||
|
viewModel.addData(addField.text); |
||||
|
addField.clear(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
Button { |
||||
|
id: syncButton |
||||
|
text: qsTr("Sync Status") |
||||
|
onClicked: viewModel.showSyncInfo() |
||||
|
Layout.columnSpan: 2 |
||||
|
Layout.fillWidth: true |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,26 @@ |
|||||
|
#include <QtWidgets/QApplication> |
||||
|
#include <QtQml/QQmlApplicationEngine> |
||||
|
|
||||
|
#include <samplecoreapp.h> |
||||
|
#include <sampleviewmodel.h> |
||||
|
|
||||
|
QTMVVM_REGISTER_CORE_APP(SampleCoreApp) |
||||
|
|
||||
|
int main(int argc, char *argv[]) |
||||
|
{ |
||||
|
#ifdef QML_PATH |
||||
|
qputenv("QML2_IMPORT_PATH", QML_PATH); |
||||
|
#endif |
||||
|
|
||||
|
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); |
||||
|
QApplication app(argc, argv); |
||||
|
|
||||
|
qmlRegisterUncreatableType<SampleViewModel>("de.skycoder42.QtMvvm.Sample", 1, 0, "SampleViewModel", QStringLiteral("ViewModels cannot be created")); |
||||
|
|
||||
|
QQmlApplicationEngine engine; |
||||
|
engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); |
||||
|
if (engine.rootObjects().isEmpty()) |
||||
|
return -1; |
||||
|
|
||||
|
return app.exec(); |
||||
|
} |
@ -0,0 +1,6 @@ |
|||||
|
import QtQuick 2.10 |
||||
|
import de.skycoder42.QtMvvm.Quick 1.0 |
||||
|
|
||||
|
QtMvvmApp { |
||||
|
title: qsTr("QtMvvm Quick Sample") |
||||
|
} |
@ -0,0 +1,8 @@ |
|||||
|
<RCC> |
||||
|
<qresource prefix="/"> |
||||
|
<file>main.qml</file> |
||||
|
</qresource> |
||||
|
<qresource prefix="/qtmvvm/views"> |
||||
|
<file>SampleView.qml</file> |
||||
|
</qresource> |
||||
|
</RCC> |
@ -0,0 +1,4 @@ |
|||||
|
TEMPLATE = subdirs |
||||
|
|
||||
|
SUBDIRS += \ |
||||
|
DataSyncSampleQuick |
@ -1,9 +1,11 @@ |
|||||
TEMPLATE = subdirs |
TEMPLATE = subdirs |
||||
|
CONFIG += ordered |
||||
|
|
||||
SUBDIRS += \ |
SUBDIRS += \ |
||||
mvvmquick \ |
mvvmquick \ |
||||
mvvmcore |
mvvmcore |
||||
|
|
||||
qtHaveModule(datasync) { |
qtHaveModule(datasync) { |
||||
SUBDIRS += mvvmdatasynccore |
SUBDIRS += mvvmdatasynccore \ |
||||
|
mvvmdatasyncquick |
||||
} |
} |
||||
|
@ -0,0 +1,5 @@ |
|||||
|
import QtQuick 2.10 |
||||
|
|
||||
|
Item { |
||||
|
|
||||
|
} |
@ -0,0 +1,3 @@ |
|||||
|
{ |
||||
|
"Keys" : [ ] |
||||
|
} |
@ -0,0 +1,40 @@ |
|||||
|
QT += core qml quick mvvmdatasyncquick |
||||
|
CXX_MODULE = mvvmdatasyncquick |
||||
|
TARGETPATH = de/skycoder42/QtMvvm/DataSync/Quick |
||||
|
TARGET = declarative_mvvmdatasyncquick |
||||
|
IMPORT_VERSION = $$MODULE_VERSION_IMPORT |
||||
|
DEFINES += "VERSION_MAJOR=$$MODULE_VERSION_MAJOR" |
||||
|
DEFINES += "VERSION_MINOR=$$MODULE_VERSION_MINOR" |
||||
|
|
||||
|
HEADERS += \ |
||||
|
qtmvvmdatasyncquick_plugin.h \ |
||||
|
testdummy.h |
||||
|
|
||||
|
SOURCES += \ |
||||
|
qtmvvmdatasyncquick_plugin.cpp \ |
||||
|
testdummy.cpp |
||||
|
|
||||
|
QML_FILES += \ |
||||
|
DataSyncView.qml |
||||
|
|
||||
|
OTHER_FILES += qmldir |
||||
|
|
||||
|
generate_qmltypes { |
||||
|
typeextra1.target = qmltypes |
||||
|
typeextra1.depends += export LD_LIBRARY_PATH := "$$shadowed($$dirname(_QMAKE_CONF_))/lib/:$(LD_LIBRARY_PATH)" |
||||
|
typeextra2.target = qmltypes |
||||
|
typeextra2.depends += export QML2_IMPORT_PATH := "$$shadowed($$dirname(_QMAKE_CONF_))/qml/" |
||||
|
QMAKE_EXTRA_TARGETS += typeextra1 typeextra2 |
||||
|
} |
||||
|
|
||||
|
CONFIG += qmlcache |
||||
|
load(qml_plugin) |
||||
|
|
||||
|
generate_qmltypes { |
||||
|
qmltypes.depends = ../../../qml/$$TARGETPATH/$(TARGET) #overwrite the target deps |
||||
|
qmltypes.commands += "2>/dev/null" # kill invalid qml warnings |
||||
|
|
||||
|
mfirst.target = all |
||||
|
mfirst.depends += qmltypes |
||||
|
QMAKE_EXTRA_TARGETS += mfirst |
||||
|
} |
@ -0,0 +1,50 @@ |
|||||
|
import QtQuick.tooling 1.2 |
||||
|
|
||||
|
// This file describes the plugin-supplied types contained in the library. |
||||
|
// It is used for QML tooling purposes only. |
||||
|
// |
||||
|
// This file was auto-generated by: |
||||
|
// 'qmlplugindump -nonrelocatable de.skycoder42.QtMvvm.DataSync.Quick 1.0' |
||||
|
|
||||
|
Module { |
||||
|
dependencies: [ |
||||
|
"Qt.labs.platform 1.0", |
||||
|
"QtGraphicalEffects 1.0", |
||||
|
"QtQml 2.2", |
||||
|
"QtQml.Models 2.3", |
||||
|
"QtQuick 2.8", |
||||
|
"QtQuick.Window 2.1", |
||||
|
"de.skycoder42.QtMvvm.Core 1.0", |
||||
|
"de.skycoder42.QtMvvm.DataSync.Core 1.0", |
||||
|
"de.skycoder42.QtMvvm.Quick 1.0" |
||||
|
] |
||||
|
Component { |
||||
|
name: "TestDummy" |
||||
|
prototype: "QObject" |
||||
|
exports: ["de.skycoder42.QtMvvm.DataSync.Quick/TestDummy 1.0"] |
||||
|
exportMetaObjectRevisions: [0] |
||||
|
} |
||||
|
Component { |
||||
|
prototype: "QQuickPlatformFileDialog" |
||||
|
name: "de.skycoder42.QtMvvm.Quick/FileDialog 1.0" |
||||
|
exports: ["de.skycoder42.QtMvvm.Quick/FileDialog 1.0"] |
||||
|
exportMetaObjectRevisions: [0] |
||||
|
isComposite: true |
||||
|
defaultProperty: "data" |
||||
|
Property { name: "msgConfig"; type: "QVariant" } |
||||
|
Property { name: "msgResult"; type: "QtMvvm::MessageResult"; isPointer: true } |
||||
|
Property { name: "mimeTypes"; type: "QVariant" } |
||||
|
Signal { name: "closed" } |
||||
|
} |
||||
|
Component { |
||||
|
prototype: "QQuickPlatformFolderDialog" |
||||
|
name: "de.skycoder42.QtMvvm.Quick/FolderDialog 1.0" |
||||
|
exports: ["de.skycoder42.QtMvvm.Quick/FolderDialog 1.0"] |
||||
|
exportMetaObjectRevisions: [0] |
||||
|
isComposite: true |
||||
|
defaultProperty: "data" |
||||
|
Property { name: "msgConfig"; type: "QVariant" } |
||||
|
Property { name: "msgResult"; type: "QtMvvm::MessageResult"; isPointer: true } |
||||
|
Signal { name: "closed" } |
||||
|
} |
||||
|
} |
@ -0,0 +1,6 @@ |
|||||
|
module de.skycoder42.QtMvvm.DataSync.Quick |
||||
|
plugin declarative_mvvmdatasyncquick |
||||
|
classname QtMvvmDataSyncQuickDeclarativeModule |
||||
|
typeinfo plugins.qmltypes |
||||
|
depends de.skycoder42.QtMvvm.DataSync.Core 1.0 |
||||
|
depends de.skycoder42.QtMvvm.Quick 1.0 |
@ -0,0 +1,20 @@ |
|||||
|
#include "qtmvvmdatasyncquick_plugin.h" |
||||
|
|
||||
|
#include <QtQml> |
||||
|
|
||||
|
#include "testdummy.h" |
||||
|
|
||||
|
QtMvvmDataSyncQuickDeclarativeModule::QtMvvmDataSyncQuickDeclarativeModule(QObject *parent) : |
||||
|
QQmlExtensionPlugin(parent) |
||||
|
{} |
||||
|
|
||||
|
void QtMvvmDataSyncQuickDeclarativeModule::registerTypes(const char *uri) |
||||
|
{ |
||||
|
Q_ASSERT(qstrcmp(uri, "de.skycoder42.QtMvvm.DataSync.Quick") == 0); |
||||
|
|
||||
|
//Version 1.0
|
||||
|
qmlRegisterType<TestDummy>(uri, 1, 0, "TestDummy"); |
||||
|
|
||||
|
// Check to make shure no module update is forgotten
|
||||
|
static_assert(VERSION_MAJOR == 1 && VERSION_MINOR == 0, "QML module version needs to be updated"); |
||||
|
} |
@ -0,0 +1,16 @@ |
|||||
|
#ifndef QTMVVMDATASYNCQUICK_PLUGIN_H |
||||
|
#define QTMVVMDATASYNCQUICK_PLUGIN_H |
||||
|
|
||||
|
#include <QtQml/QQmlExtensionPlugin> |
||||
|
|
||||
|
class QtMvvmDataSyncQuickDeclarativeModule : public QQmlExtensionPlugin |
||||
|
{ |
||||
|
Q_OBJECT |
||||
|
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) |
||||
|
|
||||
|
public: |
||||
|
QtMvvmDataSyncQuickDeclarativeModule(QObject *parent = nullptr); |
||||
|
void registerTypes(const char *uri) override; |
||||
|
}; |
||||
|
|
||||
|
#endif // QTMVVMDATASYNCQUICK_PLUGIN_H
|
@ -0,0 +1,6 @@ |
|||||
|
#include "testdummy.h" |
||||
|
|
||||
|
TestDummy::TestDummy(QObject *parent) : QObject(parent) |
||||
|
{ |
||||
|
|
||||
|
} |
@ -0,0 +1,17 @@ |
|||||
|
#ifndef TESTDUMMY_H |
||||
|
#define TESTDUMMY_H |
||||
|
|
||||
|
#include <QObject> |
||||
|
|
||||
|
class TestDummy : public QObject //TODO remove again
|
||||
|
{ |
||||
|
Q_OBJECT |
||||
|
public: |
||||
|
explicit TestDummy(QObject *parent = nullptr); |
||||
|
|
||||
|
signals: |
||||
|
|
||||
|
public slots: |
||||
|
}; |
||||
|
|
||||
|
#endif // TESTDUMMY_H
|
@ -0,0 +1,34 @@ |
|||||
|
TARGET = QtMvvmDataSyncQuick |
||||
|
|
||||
|
QT = core gui quick mvvmdatasynccore mvvmquick mvvmdatasynccore-private |
||||
|
|
||||
|
HEADERS += \ |
||||
|
qtmvvmdatasyncquick_global.h |
||||
|
|
||||
|
SOURCES += |
||||
|
|
||||
|
TRANSLATIONS += \ |
||||
|
translations/qtmvvmdatasyncquick_de.ts \ |
||||
|
translations/qtmvvmdatasyncquick_template.ts |
||||
|
|
||||
|
DISTFILES += $$TRANSLATIONS |
||||
|
|
||||
|
qpmx_ts_target.path = $$[QT_INSTALL_TRANSLATIONS] |
||||
|
qpmx_ts_target.depends += lrelease |
||||
|
|
||||
|
load(qt_module) |
||||
|
|
||||
|
win32 { |
||||
|
QMAKE_TARGET_PRODUCT = "$$TARGET" |
||||
|
QMAKE_TARGET_COMPANY = "Skycoder42" |
||||
|
QMAKE_TARGET_COPYRIGHT = "Felix Barz" |
||||
|
} else:mac { |
||||
|
QMAKE_TARGET_BUNDLE_PREFIX = "com.skycoder42." |
||||
|
} |
||||
|
|
||||
|
!ReleaseBuild:!DebugBuild:!system(qpmx -d $$shell_quote($$_PRO_FILE_PWD_) --qmake-run init $$QPMX_EXTRA_OPTIONS $$shell_quote($$QMAKE_QMAKE) $$shell_quote($$OUT_PWD)): error(qpmx initialization failed. Check the compilation log for details.) |
||||
|
else: include($$OUT_PWD/qpmx_generated.pri) |
||||
|
|
||||
|
qpmx_ts_target.files -= $$OUT_PWD/$$QPMX_WORKINGDIR/qtmvvmdatasyncquick_template.qm |
||||
|
qpmx_ts_target.files += translations/qtmvvmdatasyncquick_template.ts |
||||
|
|
@ -0,0 +1,14 @@ |
|||||
|
{ |
||||
|
"dependencies": [], |
||||
|
"license": { |
||||
|
"file": "", |
||||
|
"name": "" |
||||
|
}, |
||||
|
"prcFile": "", |
||||
|
"priFile": "", |
||||
|
"priIncludes": [ |
||||
|
], |
||||
|
"publishers": { |
||||
|
}, |
||||
|
"source": false |
||||
|
} |
@ -0,0 +1,12 @@ |
|||||
|
#ifndef MVVMDATASYNCQUICK_GLOBAL_H |
||||
|
#define MVVMDATASYNCQUICK_GLOBAL_H |
||||
|
|
||||
|
#include <QtCore/qglobal.h> |
||||
|
|
||||
|
#if defined(QT_BUILD_MVVMDATASYNCQUICK_LIB) |
||||
|
# define Q_MVVMDATASYNCQUICK_EXPORT Q_DECL_EXPORT |
||||
|
#else |
||||
|
# define Q_MVVMDATASYNCQUICK_EXPORT Q_DECL_IMPORT |
||||
|
#endif |
||||
|
|
||||
|
#endif // MVVMDATASYNCQUICK_GLOBAL_H
|
Loading…
Reference in new issue