This commit is contained in:
zhuzichu 2024-01-04 14:28:51 +08:00
parent 28a42d7ecc
commit 3a0f6355c8
7 changed files with 20 additions and 30 deletions

View File

@ -27,7 +27,6 @@ FluScrollablePage{
id: bg id: bg
fillMode:Image.PreserveAspectCrop fillMode:Image.PreserveAspectCrop
anchors.fill: parent anchors.fill: parent
asynchronous: true
verticalAlignment: Qt.AlignTop verticalAlignment: Qt.AlignTop
sourceSize: Qt.size(960,640) sourceSize: Qt.size(960,640)
source: "qrc:/example/res/image/bg_home_header.png" source: "qrc:/example/res/image/bg_home_header.png"

View File

@ -27,7 +27,6 @@ FluScrollablePage{
id: bg id: bg
fillMode:Image.PreserveAspectCrop fillMode:Image.PreserveAspectCrop
anchors.fill: parent anchors.fill: parent
asynchronous: true
verticalAlignment: Qt.AlignTop verticalAlignment: Qt.AlignTop
sourceSize: Qt.size(960,640) sourceSize: Qt.size(960,640)
source: "qrc:/example/res/image/bg_home_header.png" source: "qrc:/example/res/image/bg_home_header.png"

View File

@ -26,6 +26,9 @@ Q_IMPORT_QML_PLUGIN(FluentUIPlugin)
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
qputenv("QT_QUICK_CONTROLS_STYLE","Basic"); qputenv("QT_QUICK_CONTROLS_STYLE","Basic");
#ifdef Q_OS_WIN
qputenv("QT_QPA_PLATFORM","windows:darkmode=2");
#endif
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
//fix bug UOSv20 does not print logs //fix bug UOSv20 does not print logs
qputenv("QT_LOGGING_RULES",""); qputenv("QT_LOGGING_RULES","");
@ -35,6 +38,7 @@ int main(int argc, char *argv[])
QGuiApplication::setOrganizationName("ZhuZiChu"); QGuiApplication::setOrganizationName("ZhuZiChu");
QGuiApplication::setOrganizationDomain("https://zhuzichu520.github.io"); QGuiApplication::setOrganizationDomain("https://zhuzichu520.github.io");
QGuiApplication::setApplicationName("FluentUI"); QGuiApplication::setApplicationName("FluentUI");
QGuiApplication::setApplicationDisplayName("FluentUI Exmaple");
QGuiApplication::setApplicationVersion(APPLICATION_VERSION); QGuiApplication::setApplicationVersion(APPLICATION_VERSION);
SettingsHelper::getInstance()->init(argv); SettingsHelper::getInstance()->init(argv);
Log::setup("example"); Log::setup("example");

View File

@ -2,43 +2,30 @@
#define SINGLETON_H #define SINGLETON_H
#include <QMutex> #include <QMutex>
#include <QScopedPointer>
#include <memory>
#include <mutex>
template <typename T> template <typename T>
class Singleton { class Singleton {
public: public:
static T* getInstance(); static T* getInstance();
Singleton(const Singleton& other) = delete;
Singleton<T>& operator=(const Singleton& other) = delete;
private: private:
static std::mutex mutex; Q_DISABLE_COPY_MOVE(Singleton)
static T* instance;
}; };
template <typename T>
std::mutex Singleton<T>::mutex;
template <typename T>
T* Singleton<T>::instance;
template <typename T> template <typename T>
T* Singleton<T>::getInstance() { T* Singleton<T>::getInstance() {
if (instance == nullptr) { static QMutex mutex;
std::lock_guard<std::mutex> locker(mutex); QMutexLocker locker(&mutex);
static T* instance = nullptr;
if (instance == nullptr) { if (instance == nullptr) {
instance = new T(); instance = new T();
} }
}
return instance; return instance;
} }
#define SINGLETON(Class) \ #define SINGLETON(Class) \
private: \ private: \
friend class Singleton<Class>; \ friend class Singleton<Class>; \
friend struct QScopedPointerDeleter<Class>; \
\
public: \ public: \
static Class* getInstance() { \ static Class* getInstance() { \
return Singleton<Class>::getInstance(); \ return Singleton<Class>::getInstance(); \
@ -48,6 +35,6 @@ private: \
private: \ private: \
Class() = default; \ Class() = default; \
Class(const Class& other) = delete; \ Class(const Class& other) = delete; \
Class& operator=(const Class& other) = delete; Q_DISABLE_COPY_MOVE(Class);
#endif // SINGLETON_H #endif // SINGLETON_H

View File

@ -102,6 +102,7 @@ T.ComboBox {
height: Math.min(contentItem.implicitHeight, control.Window.height - topMargin - bottomMargin) height: Math.min(contentItem.implicitHeight, control.Window.height - topMargin - bottomMargin)
topMargin: 6 topMargin: 6
bottomMargin: 6 bottomMargin: 6
modal: true
contentItem: ListView { contentItem: ListView {
clip: true clip: true
implicitHeight: contentHeight implicitHeight: contentHeight

View File

@ -102,6 +102,7 @@ T.ComboBox {
height: Math.min(contentItem.implicitHeight, control.Window.height - topMargin - bottomMargin) height: Math.min(contentItem.implicitHeight, control.Window.height - topMargin - bottomMargin)
topMargin: 6 topMargin: 6
bottomMargin: 6 bottomMargin: 6
modal: true
contentItem: ListView { contentItem: ListView {
clip: true clip: true
implicitHeight: contentHeight implicitHeight: contentHeight

View File

@ -26,7 +26,6 @@ T* Singleton<T>::getInstance() {
#define SINGLETON(Class) \ #define SINGLETON(Class) \
private: \ private: \
friend class Singleton<Class>; \ friend class Singleton<Class>; \
\
public: \ public: \
static Class* getInstance() { \ static Class* getInstance() { \
return Singleton<Class>::getInstance(); \ return Singleton<Class>::getInstance(); \