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
fillMode:Image.PreserveAspectCrop
anchors.fill: parent
asynchronous: true
verticalAlignment: Qt.AlignTop
sourceSize: Qt.size(960,640)
source: "qrc:/example/res/image/bg_home_header.png"

View File

@ -27,7 +27,6 @@ FluScrollablePage{
id: bg
fillMode:Image.PreserveAspectCrop
anchors.fill: parent
asynchronous: true
verticalAlignment: Qt.AlignTop
sourceSize: Qt.size(960,640)
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[])
{
qputenv("QT_QUICK_CONTROLS_STYLE","Basic");
#ifdef Q_OS_WIN
qputenv("QT_QPA_PLATFORM","windows:darkmode=2");
#endif
#ifdef Q_OS_LINUX
//fix bug UOSv20 does not print logs
qputenv("QT_LOGGING_RULES","");
@ -35,6 +38,7 @@ int main(int argc, char *argv[])
QGuiApplication::setOrganizationName("ZhuZiChu");
QGuiApplication::setOrganizationDomain("https://zhuzichu520.github.io");
QGuiApplication::setApplicationName("FluentUI");
QGuiApplication::setApplicationDisplayName("FluentUI Exmaple");
QGuiApplication::setApplicationVersion(APPLICATION_VERSION);
SettingsHelper::getInstance()->init(argv);
Log::setup("example");

View File

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

View File

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

View File

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

View File

@ -23,12 +23,11 @@ T* Singleton<T>::getInstance() {
return instance;
}
#define SINGLETON(Class) \
private: \
#define SINGLETON(Class) \
private: \
friend class Singleton<Class>; \
\
public: \
static Class* getInstance() { \
public: \
static Class* getInstance() { \
return Singleton<Class>::getInstance(); \
}