mirror of
https://github.com/jaredtao/TaoQuick.git
synced 2025-01-31 21:22:58 +08:00
update for 5.15
This commit is contained in:
parent
fddaab17cc
commit
50620e5847
@ -11,8 +11,8 @@ QJsonArray EffectsPlugin::infos() const
|
||||
{
|
||||
static QJsonArray arr{
|
||||
QJsonObject{
|
||||
{ "name", u8"特效" },
|
||||
{ "title", u8"特效" },
|
||||
{ "name", tr(u8"特效") },
|
||||
{ "title", tr(u8"特效") },
|
||||
{ "children",
|
||||
QJsonArray{ QJsonObject{ { "name", u8"环" }, { "title", u8"环" }, { "url", "qrc:/Effect/Qml/ContentPage/Effect/RingPage.qml" } },
|
||||
QJsonObject{ { "name", u8"璀璨星空" }, { "title", u8"璀璨星空" }, { "url", "qrc:/Effect/Qml/ContentPage/Effect/Swapper.qml" } },
|
||||
|
@ -1,6 +1,7 @@
|
||||
QT += core gui qml
|
||||
|
||||
TARGET = $$qtLibraryTarget(TaoEffect)
|
||||
#TARGET = $$qtLibraryTarget(TaoEffect)
|
||||
TARGET = TaoEffect
|
||||
TEMPLATE = lib
|
||||
CONFIG += plugin
|
||||
msvc {
|
||||
|
@ -12,5 +12,6 @@ QtObject {
|
||||
# define highp
|
||||
#endif // GL_ES
|
||||
"
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,21 +0,0 @@
|
||||
#include "taoquick_plugin.h"
|
||||
#include <QDebug>
|
||||
|
||||
void TaoQuickPlugin::registerTypes(const char *uri)
|
||||
{
|
||||
Q_UNUSED(uri);
|
||||
Q_INIT_RESOURCE(Qml);
|
||||
qInfo() << "\033[35m"
|
||||
<< "Your application is using TaoQuick ";
|
||||
qInfo() << " Version:" << TaoVer;
|
||||
qInfo() << " Revision:" << TaoREVISIONSTR;
|
||||
qInfo() << " Author: Jared Tao";
|
||||
qInfo() << " You can find more info about TaoQuick in website:"
|
||||
<< "\033[0m"
|
||||
<< "\033[31m"
|
||||
<< "https://github.com/jaredtao";
|
||||
|
||||
qInfo() << "\033[0m\033[32m"
|
||||
<< "Good luck to you."
|
||||
<< "\033[0m";
|
||||
}
|
@ -1,12 +1,60 @@
|
||||
#pragma once
|
||||
#include <QtGlobal>
|
||||
#include <QDebug>
|
||||
|
||||
#include <QQmlExtensionPlugin>
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
#include <QQmlEngineExtensionPlugin>
|
||||
|
||||
class TaoQuickPlugin : public QQmlEngineExtensionPlugin
|
||||
|
||||
class TaoQuickPlugin : public QQmlExtensionPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
|
||||
|
||||
Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid)
|
||||
public:
|
||||
void registerTypes(const char *uri) override;
|
||||
void initializeEngine(QQmlEngine* engine, const char* uri) override
|
||||
{
|
||||
Q_INIT_RESOURCE(Qml);
|
||||
qInfo() << "\033[35m"
|
||||
<< "Your application is using TaoQuick ";
|
||||
qInfo() << " Version:" << TaoVer;
|
||||
qInfo() << " Revision:" << TaoREVISIONSTR;
|
||||
qInfo() << " Author: Jared Tao";
|
||||
qInfo() << " You can find more info about TaoQuick in website:"
|
||||
<< "\033[0m"
|
||||
<< "\033[31m"
|
||||
<< "https://github.com/jaredtao";
|
||||
|
||||
qInfo() << "\033[0m\033[32m"
|
||||
<< "Good luck to you."
|
||||
<< "\033[0m";
|
||||
QQmlEngineExtensionPlugin::initializeEngine(engine, uri);
|
||||
}
|
||||
};
|
||||
|
||||
#else
|
||||
#include <QQmlExtensionPlugin>
|
||||
|
||||
class TaoQuickPlugin : public QQmlExtensionPlugin {
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
|
||||
public:
|
||||
void registerTypes(const char* uri) override
|
||||
{
|
||||
Q_INIT_RESOURCE(Qml);
|
||||
qInfo() << "\033[35m"
|
||||
<< "Your application is using TaoQuick ";
|
||||
qInfo() << " Version:" << TaoVer;
|
||||
qInfo() << " Revision:" << TaoREVISIONSTR;
|
||||
qInfo() << " Author: Jared Tao";
|
||||
qInfo() << " You can find more info about TaoQuick in website:"
|
||||
<< "\033[0m"
|
||||
<< "\033[31m"
|
||||
<< "https://github.com/jaredtao";
|
||||
|
||||
qInfo() << "\033[0m\033[32m"
|
||||
<< "Good luck to you."
|
||||
<< "\033[0m";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,8 +1,7 @@
|
||||
HEADERS += \
|
||||
$$PWD/Src/taoquick_plugin.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/Src/taoquick_plugin.cpp
|
||||
SOURCES +=
|
||||
|
||||
RESOURCES += \
|
||||
$$PWD/Image.qrc \
|
||||
|
@ -1,11 +1,12 @@
|
||||
TEMPLATE = lib
|
||||
|
||||
TARGET = $$qtLibraryTarget(TaoQuick)
|
||||
|
||||
#TARGET = $$qtLibraryTarget(TaoQuick)
|
||||
TARGET = TaoQuick
|
||||
QT += qml quick
|
||||
CONFIG += plugin c++11 qtquickcompiler
|
||||
CONFIG += plugin c++11 qtquickcompiler qmltypes
|
||||
uri = TaoQuick
|
||||
|
||||
QML_IMPORT_NAME = $$TARGET
|
||||
QML_IMPORT_MAJOR_VERSION = 1
|
||||
include(../TaoVersion.pri)
|
||||
include(../TaoBundle.pri)
|
||||
include(TaoQuick.pri)
|
||||
|
@ -1,4 +1,4 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick 2.12
|
||||
import "./Page"
|
||||
|
||||
import TaoQuick 1.0
|
||||
@ -27,7 +27,10 @@ Item {
|
||||
}
|
||||
Connections {
|
||||
target: view
|
||||
onPluginReady: {
|
||||
// onPluginReady: {
|
||||
// onPluginReady(pluginInfo)
|
||||
// }
|
||||
function onPluginReady(pluginInfo) {
|
||||
console.log("onPluginReady")
|
||||
var arr = null
|
||||
try {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
|
||||
import TaoQuick 1.0
|
||||
@ -54,7 +54,7 @@ Popup {
|
||||
Text {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
text: appInfo.appName + " " + appInfo.appVersion
|
||||
text: appInfo.appName + " " + appInfo.app
|
||||
|
||||
font.pixelSize: 20
|
||||
renderType: Text.NativeRendering
|
||||
|
@ -1,4 +1,4 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/Tao/Qml"
|
||||
@ -18,14 +18,15 @@ ListView {
|
||||
property var mainIndex: -1
|
||||
property var subIndex: -1
|
||||
Connections{
|
||||
|
||||
target: view
|
||||
onReTransed: {
|
||||
function onReTransed() {
|
||||
var m = model.get(mainIndex)
|
||||
if (subIndex != -1) {
|
||||
var s = m.children.get(subIndex)
|
||||
currentTitle = s.name
|
||||
currentTitle = qsTranslate(s.name,s.name)
|
||||
} else {
|
||||
currentTitle = m.name
|
||||
currentTitle = qsTranslate(m.name,m.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -41,14 +42,14 @@ ListView {
|
||||
id: btn
|
||||
width: root.width
|
||||
height: rowHeight
|
||||
text: model.name
|
||||
text: qsTranslate(model.name, model.name)
|
||||
textItem.leftPadding: 6
|
||||
textHorizontalAlignment: Text.AlignLeft
|
||||
textColor: text === currentTitle ? gConfig.titleBackground : gConfig.textColor
|
||||
onClicked: {
|
||||
if (model.url)
|
||||
{
|
||||
currentTitle = model.name
|
||||
currentTitle = qsTranslate(model.name,model.name)
|
||||
currentUrl = model.url
|
||||
} else {
|
||||
if (!subListView.initOnce) {
|
||||
@ -80,10 +81,10 @@ ListView {
|
||||
delegate: TGradientBtn {
|
||||
width: root.width
|
||||
height: rowHeight
|
||||
text: model.name
|
||||
text: qsTranslate(model.name, model.name)
|
||||
textColor: text === currentTitle ? gConfig.titleBackground : gConfig.textColor
|
||||
onClicked: {
|
||||
currentTitle = model.name
|
||||
currentTitle = qsTranslate(model.name,model.name)
|
||||
currentUrl = model.url
|
||||
subIndex = index
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ Rectangle {
|
||||
width: langListView.width
|
||||
height: 36
|
||||
text: modelData
|
||||
color: containsMouse ? "lightgray" : pop.barColor
|
||||
color: view.currentLang === modelData ? gConfig.titleBackground :( containsMouse ? "lightgray" : pop.barColor)
|
||||
onClicked: {
|
||||
pop.hide()
|
||||
view.reTrans(modelData)
|
||||
|
@ -81,6 +81,7 @@ void TaoView::reTrans(const QString &lang)
|
||||
m_lang = lang;
|
||||
engine()->retranslate();
|
||||
emit reTransed();
|
||||
emit currentLangChanged();
|
||||
}
|
||||
|
||||
void TaoView::loadPlugin(const QString &pluginPath)
|
||||
|
@ -11,6 +11,7 @@ class TaoView : public QQuickView
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QStringList languageList READ languageList NOTIFY languageListChanged)
|
||||
Q_PROPERTY(QString currentLang READ currentLang NOTIFY currentLangChanged)
|
||||
public:
|
||||
explicit TaoView(QWindow *parent = nullptr);
|
||||
~TaoView();
|
||||
@ -24,10 +25,15 @@ public:
|
||||
{
|
||||
return m_languageList;
|
||||
}
|
||||
const QString ¤tLang() const
|
||||
{
|
||||
return m_lang;
|
||||
}
|
||||
signals:
|
||||
void reTransed();
|
||||
void languageListChanged();
|
||||
void pluginReady(QString pluginInfo);
|
||||
void currentLangChanged();
|
||||
public slots:
|
||||
private:
|
||||
QString m_lang;
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "TaoView.h"
|
||||
#include "TaoView.h"
|
||||
#include "Logger/Logger.h"
|
||||
|
||||
#include <QGuiApplication>
|
||||
@ -15,6 +15,8 @@ int main(int argc, char **argv)
|
||||
Logger::initLog();
|
||||
|
||||
TaoView view;
|
||||
view.engine()->addImportPath(app.applicationDirPath());
|
||||
view.engine()->addPluginPath(app.applicationDirPath());
|
||||
view.rootContext()->setContextProperty("view", &view);
|
||||
view.setSource(QUrl(QStringLiteral("qrc:/Qml/main.qml")));
|
||||
view.moveToScreenCenter();
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "TaoQuickPlugin.h"
|
||||
#include "TaoQuickPlugin.h"
|
||||
#include <QQmlEngine>
|
||||
TaoQuickPlugin::TaoQuickPlugin(QObject *parent) : QObject (parent)
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
QT += core gui qml
|
||||
|
||||
TARGET = $$qtLibraryTarget(TaoQuickPlugin)
|
||||
#TARGET = $$qtLibraryTarget(TaoQuickPlugin)
|
||||
TARGET = TaoQuickPlugin
|
||||
TEMPLATE = lib
|
||||
CONFIG += plugin
|
||||
msvc {
|
||||
|
Loading…
x
Reference in New Issue
Block a user