mirror of
https://github.com/jaredtao/TaoQuick.git
synced 2025-01-17 20:12:54 +08:00
update for compatibility Qt 6
This commit is contained in:
parent
681bb0680a
commit
ee5f88c130
10
3rdparty/TaoCommon/Logger/logger.cpp
vendored
10
3rdparty/TaoCommon/Logger/logger.cpp
vendored
@ -6,7 +6,7 @@
|
||||
#include <QDir>
|
||||
#include <QMutex>
|
||||
#include <QDebug>
|
||||
|
||||
#include <QTextStream>
|
||||
#include <string>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
@ -81,7 +81,11 @@ namespace Logger
|
||||
bool exist = file.exists();
|
||||
file.open(QIODevice::WriteOnly | QIODevice::Append);
|
||||
textStream.setDevice(&file);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
textStream.setEncoding(QStringConverter::Utf8);
|
||||
#else
|
||||
textStream.setCodec("UTF-8");
|
||||
#endif
|
||||
if (!exist)
|
||||
{
|
||||
textStream << logTemplate << "\r\n";
|
||||
@ -127,7 +131,11 @@ namespace Logger
|
||||
bool exist = file.exists();
|
||||
file.open(QIODevice::WriteOnly | QIODevice::Append);
|
||||
QTextStream textStream(&file);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
textStream.setEncoding(QStringConverter::Utf8);
|
||||
#else
|
||||
textStream.setCodec("UTF-8");
|
||||
#endif
|
||||
if (!exist)
|
||||
{
|
||||
textStream << logTemplate << "\r\n";
|
||||
|
@ -1,6 +1,4 @@
|
||||
lessThan(QT_MAJOR_VERSION, 5) {
|
||||
error("current Qt version $$QT_VERSION, this project need grather than 5.12.0")
|
||||
} else: lessThan(QT_MINOR_VERSION, 12){
|
||||
lessThan(QT_MAJOR_VERSION, 5): lessThan(QT_MINOR_VERSION, 12) {
|
||||
error("current Qt version $$QT_VERSION, this project need grather than 5.12.0")
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import QtGraphicalEffects 1.0
|
||||
|
||||
Item {
|
||||
Rectangle {
|
||||
id: rootView
|
||||
width: 1440
|
||||
height: 900
|
||||
|
@ -94,8 +94,11 @@ void TaoView::setIsMax(bool isMax)
|
||||
|
||||
#if WIN32
|
||||
const long border_width = 6;
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
bool TaoView::nativeEvent(const QByteArray &eventType, void *message, qintptr *result)
|
||||
#else
|
||||
bool TaoView::nativeEvent(const QByteArray &eventType, void *message, long *result)
|
||||
#endif
|
||||
{
|
||||
if (!result) {
|
||||
return false;
|
||||
|
@ -25,8 +25,12 @@ signals:
|
||||
protected:
|
||||
|
||||
#if WIN32
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result) override;
|
||||
#else
|
||||
bool nativeEvent(const QByteArray &eventType, void *message, long *result) override;
|
||||
#endif
|
||||
#endif
|
||||
private:
|
||||
bool m_isMax;
|
||||
};
|
||||
|
@ -38,7 +38,7 @@ void Trans::loadFolder(const QString& folder)
|
||||
// res.waitForFinished();
|
||||
|
||||
initEnglish();
|
||||
auto langs = m_map.uniqueKeys();
|
||||
auto langs = m_map.keys();
|
||||
if (langs.contains(cChineseStr)) {
|
||||
langs.removeAll(cChineseStr);
|
||||
langs.push_front(cChineseStr);
|
||||
@ -96,7 +96,7 @@ void Trans::initEnglish()
|
||||
} else {
|
||||
map = m_map.value(m_map.keys().first());
|
||||
}
|
||||
for (auto key : map.uniqueKeys()) {
|
||||
for (auto key : map.keys()) {
|
||||
m_map[cEnglisthStr][key] = key;
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,8 @@ int main(int argc, char** argv)
|
||||
prepareApp();
|
||||
QGuiApplication app(argc, argv);
|
||||
Logger::initLog();
|
||||
qWarning() << "appPath" << app.applicationDirPath();
|
||||
const auto appPath = QDir(app.applicationDirPath()).absolutePath();
|
||||
qWarning() << "appPath" << appPath;
|
||||
|
||||
TaoView view;
|
||||
|
||||
@ -39,7 +40,7 @@ int main(int argc, char** argv)
|
||||
view.rootContext()->setContextProperty("qmlPath", qmlPath);
|
||||
view.rootContext()->setContextProperty("imgPath", imgPath);
|
||||
view.rootContext()->setContextProperty("contentsPath", contentsPath);
|
||||
view.rootContext()->setContextProperty("appPath", app.applicationDirPath());
|
||||
view.rootContext()->setContextProperty("appPath", appPath);
|
||||
view.rootContext()->setContextProperty("view", &view);
|
||||
|
||||
const QUrl url(qmlPath + QStringLiteral("main.qml"));
|
||||
|
Loading…
x
Reference in New Issue
Block a user