Compare commits

...

11 Commits

Author SHA1 Message Date
5fd7c7d10e update 2024-04-24 10:37:15 +08:00
83507a6ed5 update 2024-04-24 09:57:28 +08:00
789d9164a1 Merge branch '1.7.5-dev' 2024-04-24 09:53:59 +08:00
cb44759978 update 2024-04-23 22:38:39 +08:00
04c52b1b25 fix bug 2024-04-23 21:19:32 +08:00
b8ef9169b9 update 2024-04-23 19:33:05 +08:00
c7de653ba2 update 2024-04-23 13:41:26 +08:00
2ddb7e3290 update 2024-04-23 00:32:15 +08:00
e8d79e3c7b update 2024-04-23 00:31:20 +08:00
f0f00b9eba Merge pull request #483 from mariuszmaximus/main
fix for msys2
2024-04-15 12:39:47 +08:00
956f2e0ad0 fix for msys2 2024-04-14 19:38:52 +02:00
36 changed files with 255 additions and 284 deletions

View File

@ -28,8 +28,8 @@ find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Quick Svg Network)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Quick Svg Network)
#添加国际化脚本
find_program(QT_LUPDATE NAMES lupdate)
find_program(QT_LRELEASE NAMES lrelease)
find_program(QT_LUPDATE NAMES lupdate lupdate-qt6)
find_program(QT_LRELEASE NAMES lrelease lrelease-qt6)
file(GLOB TS_FILE_PATHS ${CMAKE_CURRENT_LIST_DIR}/ *.ts)
add_custom_target(Script-UpdateTranslations
COMMAND ${QT_LUPDATE} ${CMAKE_CURRENT_LIST_DIR} -ts ${PROJECT_NAME}_en_US.ts WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}

View File

@ -180,7 +180,6 @@
<file>qml/window/PageWindow.qml</file>
<file>qml/page/T_StaggeredLayout.qml</file>
<file>qml/page/T_Clip.qml</file>
<file>qml/page/T_3D.qml</file>
<file>qml/page/T_Network.qml</file>
<file>qml/page/T_ShortcutPicker.qml</file>
<file>qml/chart/T_BarChart.qml</file>

View File

@ -515,11 +515,6 @@
</message>
<message>
<location filename="qml/global/ItemsOriginal.qml" line="487"/>
<source>3D</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/global/ItemsOriginal.qml" line="493"/>
<source>Test Crash</source>
<translation type="unfinished"></translation>
</message>
@ -1930,26 +1925,6 @@ Some contents...</source>
<source>StatusLayout</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_StatusLayout.qml" line="63"/>
<source>Loading...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_StatusLayout.qml" line="64"/>
<source>Empty</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_StatusLayout.qml" line="65"/>
<source>The page went wrong...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_StatusLayout.qml" line="66"/>
<source>Reload</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>T_TabView</name>

View File

@ -514,12 +514,11 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/global/ItemsOriginal.qml" line="487"/>
<source>3D</source>
<translation type="unfinished">3D</translation>
<translation type="obsolete">3D</translation>
</message>
<message>
<location filename="qml/global/ItemsOriginal.qml" line="493"/>
<location filename="qml/global/ItemsOriginal.qml" line="487"/>
<source>Test Crash</source>
<translation type="unfinished"></translation>
</message>
@ -2053,24 +2052,20 @@ Some contents...</source>
<translation type="unfinished">状态布局</translation>
</message>
<message>
<location filename="qml/page/T_StatusLayout.qml" line="63"/>
<source>Loading...</source>
<translation type="unfinished">正在加载...</translation>
<translation type="obsolete">正在加载...</translation>
</message>
<message>
<location filename="qml/page/T_StatusLayout.qml" line="64"/>
<source>Empty</source>
<translation type="unfinished">空空如也</translation>
<translation type="obsolete">空空如也</translation>
</message>
<message>
<location filename="qml/page/T_StatusLayout.qml" line="65"/>
<source>The page went wrong...</source>
<translation type="unfinished">页面出错了...</translation>
<translation type="obsolete">页面出错了...</translation>
</message>
<message>
<location filename="qml/page/T_StatusLayout.qml" line="66"/>
<source>Reload</source>
<translation type="unfinished">重新加载</translation>
<translation type="obsolete">重新加载</translation>
</message>
</context>
<context>

View File

@ -483,12 +483,6 @@ FluObject{
FluRouter.navigate("/hotload")
}
}
FluPaneItem{
title: qsTr("3D")
menuDelegate: paneItemMenu
url: "qrc:/example/qml/page/T_3D.qml"
onTap: { navigationView.push(url) }
}
FluPaneItem{
title: qsTr("Test Crash")
onTapListener: function(){

View File

@ -1,116 +0,0 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Controls 2.15
import QtQuick.Window 2.15
import Qt3D.Core 2.15
import Qt3D.Render 2.15
import Qt3D.Input 2.12
import Qt3D.Extras 2.15
import QtQuick.Scene3D 2.15
import Qt.labs.platform 1.1
import FluentUI 1.0
import "../component"
FluContentPage{
id:root
title:"3D"
Scene3D{
id:scene_3d
anchors.fill: parent
focus: true
aspects: ["input", "logic"]
cameraAspectRatioMode: Scene3D.AutomaticAspectRatio
Entity {
Camera {
id: camera
projectionType: CameraLens.PerspectiveProjection
fieldOfView: 22.5
aspectRatio: scene_3d.width / scene_3d.height
nearPlane: 1
farPlane: 1000.0
viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
position: Qt.vector3d( 0.0, 0.0, 15.0 )
}
FirstPersonCameraController {
linearSpeed: 100
lookSpeed: 50
camera: camera
}
components: [
RenderSettings{
activeFrameGraph: ForwardRenderer{
clearColor: Qt.rgba(0,0,0,0);
camera: camera
}
},
InputSettings{}
]
Mesh {
id: mesh
source: "https://zhu-zichu.gitee.io/test.obj"
}
PhongMaterial {
id: material
ambient: color_picker.current
}
Transform{
id:transform
scale: 1.0
translation: Qt.vector3d(0, 0, 0)
rotation: fromEulerAngles(0, 0, 0)
property real hAngle:0.0
NumberAnimation on hAngle{
from:0
to:360.0
duration: 5000
loops: Animation.Infinite
}
matrix:{
var m=Qt.matrix4x4();
m.rotate(hAngle,Qt.vector3d(0,1,0));
m.translate(Qt.vector3d(0,0,0));
return m;
}
}
Entity {
id: entity
components: [mesh, material,transform]
}
}
}
ColumnLayout{
RowLayout{
spacing: 10
Layout.topMargin: 20
FluText{
text:"tintColor:"
Layout.alignment: Qt.AlignVCenter
}
FluColorPicker{
id:color_picker
current: "gray"
}
}
FluButton{
text:"选择obj资源"
onClicked: {
file_dialog.open()
}
}
}
FileDialog {
id: file_dialog
nameFilters: ["Obj files (*.obj)"]
folder: StandardPaths.writableLocation(StandardPaths.DocumentsLocation)
onAccepted: {
var fileUrl = file_dialog.currentFile
mesh.source = fileUrl
}
}
}

View File

@ -24,7 +24,7 @@ FluContentPage {
leftMargin: 14
}
onClicked: {
grid_view.model = FluTheme.awesomeList(text_box.text)
grid_view.model = FluApp.iconDatas(text_box.text)
}
}
GridView{

View File

@ -60,12 +60,8 @@ FluScrollablePage{
FluStatusLayout{
id:status_view
anchors.fill: parent
loadingText: qsTr("Loading...")
emptyText: qsTr("Empty")
errorText: qsTr("The page went wrong...")
errorButtonText: qsTr("Reload")
onErrorClicked:{
showError("Click Reload")
status_view.statusMode = FluStatusLayoutType.Loading
}
Rectangle {
anchors.fill: parent

View File

@ -20,7 +20,7 @@ FluWindowDialog {
showError(message)
}
function onSuccess(path){
FluTools.showFileInFolder(path+"/CMakeLists.txt")
FluTools.showFileInFolder(path)
window.close()
}
}

View File

@ -15,7 +15,7 @@ public:
void paint(QPainter *painter) override;
Q_INVOKABLE [[maybe_unused]] void start(int w, int h, const QPoint &center, int radius);
[[maybe_unused]] Q_INVOKABLE void start(int w, int h, const QPoint &center, int radius);
Q_SIGNAL void imageChanged();

View File

@ -97,5 +97,5 @@ void InitializrHelper::copyFile(const QString &source, const QString &dest) {
copyFile(":/example/res/template/src/qml.qrc.in", projectDir.filePath("src/qml.qrc"));
copyFile(":/example/res/template/src/logo.ico.in", projectDir.filePath("src/logo.ico"));
copyFile(":/example/res/template/src/README.md.in", projectDir.filePath("src/README.md"));
return this->success(projectPath);
return this->success(projectPath+"/CMakeLists.txt");
}

View File

@ -22,7 +22,7 @@ SINGLETON(InitializrHelper)
~InitializrHelper() override;
Q_INVOKABLE [[maybe_unused]] void generate(const QString &name, const QString &path);
[[maybe_unused]] Q_INVOKABLE void generate(const QString &name, const QString &path);
Q_SIGNAL void error(const QString &message);

View File

@ -54,7 +54,7 @@ int main(int argc, char *argv[])
QGuiApplication::setOrganizationName("ZhuZiChu");
QGuiApplication::setOrganizationDomain("https://zhuzichu520.github.io");
QGuiApplication::setApplicationName("FluentUI");
QGuiApplication::setApplicationDisplayName("FluentUI Exmaple");
QGuiApplication::setApplicationDisplayName("FluentUI Example");
QGuiApplication::setApplicationVersion(APPLICATION_VERSION);
QGuiApplication::setQuitOnLastWindowClosed(false);
SettingsHelper::getInstance()->init(argv);

View File

@ -1,5 +1,4 @@
#include "FluAccentColor.h"
FluAccentColor::FluAccentColor(QObject *parent) : QObject{parent} {
}

View File

@ -109,7 +109,7 @@ FluColors::FluColors(QObject *parent) : QObject{parent} {
_Green = green;
}
[[maybe_unused]] FluAccentColor *FluColors::createAccentColor(const QColor& primaryColor) {
[[maybe_unused]] FluAccentColor *FluColors::createAccentColor(const QColor &primaryColor) {
auto accentColor = new FluAccentColor(this);
accentColor->normal(primaryColor);
accentColor->dark(FluTools::getInstance()->withOpacity(primaryColor, 0.9));

View File

@ -55,7 +55,7 @@ private:
public:
SINGLETON(FluColors)
[[maybe_unused]] Q_INVOKABLE FluAccentColor *createAccentColor(const QColor& primaryColor);
[[maybe_unused]] Q_INVOKABLE FluAccentColor *createAccentColor(const QColor &primaryColor);
static FluColors *create(QQmlEngine *, QJSEngine *) { return getInstance(); }
};

View File

@ -4,6 +4,7 @@
#include <QGuiApplication>
#include <QScreen>
#include <QDateTime>
#include "FluTools.h"
#ifdef Q_OS_WIN
#pragma comment (lib, "user32.lib")
@ -13,6 +14,7 @@
#include <windowsx.h>
#include <dwmapi.h>
static inline QByteArray qtNativeEventType() {
static const auto result = "windows_generic_MSG";
return result;
@ -55,6 +57,7 @@ FluFrameless::FluFrameless(QQuickItem *parent) : QQuickItem{parent} {
_closeButton = nullptr;
_topmost = false;
_disabled = false;
_isWindows11OrGreater = FluTools::getInstance()->isWindows11OrGreater();
}
FluFrameless::~FluFrameless() = default;
@ -109,12 +112,12 @@ void FluFrameless::componentComplete() {
::RedrawWindow(hwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW);
});
#endif
h = h + _appbar->height();
if(_fixSize){
window()->setMaximumSize(QSize(w,h));
window()->setMinimumSize(QSize(w,h));
h = qRound(h + _appbar->height());
if (_fixSize) {
window()->setMaximumSize(QSize(w, h));
window()->setMinimumSize(QSize(w, h));
}
window()->resize(QSize(w,h));
window()->resize(QSize(w, h));
connect(this, &FluFrameless::topmostChanged, this, [this] {
_setWindowTopmost(topmost());
});
@ -143,7 +146,7 @@ void FluFrameless::componentComplete() {
auto *wp = reinterpret_cast<WINDOWPOS *>(lParam);
if (wp != nullptr && (wp->flags & SWP_NOSIZE) == 0) {
wp->flags |= SWP_NOCOPYBITS;
*result = ::DefWindowProcW(hwnd, uMsg, wParam, lParam);
*result = static_cast<QT_NATIVE_EVENT_RESULT_TYPE>(::DefWindowProcW(hwnd, uMsg, wParam, lParam));
return true;
}
return false;
@ -155,12 +158,15 @@ void FluFrameless::componentComplete() {
const LONG originalBottom = clientRect->bottom;
const LRESULT hitTestResult = ::DefWindowProcW(hwnd, WM_NCCALCSIZE, wParam, lParam);
if ((hitTestResult != HTERROR) && (hitTestResult != HTNOWHERE)) {
*result = hitTestResult;
*result = static_cast<QT_NATIVE_EVENT_RESULT_TYPE>(hitTestResult);
return true;
}
int offsetSize;
bool isMaximum = ::IsZoomed(hwnd);
offsetXY = QPoint(abs(clientRect->left - originalLeft), abs(clientRect->top - originalTop));
auto _offsetXY = QPoint(abs(clientRect->left - originalLeft), abs(clientRect->top - originalTop));
if (_offsetXY.x() != 0) {
offsetXY = _offsetXY;
}
if (isMaximum || _isFullScreen()) {
offsetSize = 0;
} else {
@ -169,25 +175,34 @@ void FluFrameless::componentComplete() {
if (!isCompositionEnabled()) {
offsetSize = 0;
}
if (!isMaximum || QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
clientRect->top = originalTop + offsetSize;
clientRect->bottom = originalBottom - offsetSize;
clientRect->left = originalLeft + offsetSize;
clientRect->right = originalRight - offsetSize;
#else
if (!isMaximum) {
clientRect->top = originalTop + offsetSize;
clientRect->bottom = originalBottom - offsetSize;
clientRect->left = originalLeft + offsetSize;
clientRect->right = originalRight - offsetSize;
}
#endif
_setMaximizeHovered(false);
*result = WVR_REDRAW;
return true;
} else if (uMsg == WM_NCHITTEST) {
if (_hitMaximizeButton()) {
if (*result == HTNOWHERE) {
*result = HTZOOM;
if (_isWindows11OrGreater) {
if (_hitMaximizeButton()) {
if (*result == HTNOWHERE) {
*result = HTZOOM;
}
_setMaximizeHovered(true);
return true;
}
_setMaximizeHovered(true);
return true;
_setMaximizeHovered(false);
_setMaximizePressed(false);
}
_setMaximizeHovered(false);
_setMaximizePressed(false);
*result = 0;
POINT nativeGlobalPos{GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)};
POINT nativeLocalPos = nativeGlobalPos;
@ -229,14 +244,14 @@ void FluFrameless::componentComplete() {
}
*result = HTCLIENT;
return true;
} else if (uMsg == WM_NCLBUTTONDBLCLK || uMsg == WM_NCLBUTTONDOWN) {
} else if (_isWindows11OrGreater && (uMsg == WM_NCLBUTTONDBLCLK || uMsg == WM_NCLBUTTONDOWN)) {
if (_hitMaximizeButton()) {
QMouseEvent event = QMouseEvent(QEvent::MouseButtonPress, QPoint(), QPoint(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
QGuiApplication::sendEvent(_maximizeButton, &event);
_setMaximizePressed(true);
return true;
}
} else if (uMsg == WM_NCLBUTTONUP || uMsg == WM_NCRBUTTONUP) {
} else if (_isWindows11OrGreater && (uMsg == WM_NCLBUTTONUP || uMsg == WM_NCRBUTTONUP)) {
if (_hitMaximizeButton()) {
QMouseEvent event = QMouseEvent(QEvent::MouseButtonRelease, QPoint(), QPoint(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
QGuiApplication::sendEvent(_maximizeButton, &event);
@ -247,26 +262,31 @@ void FluFrameless::componentComplete() {
*result = FALSE;
return true;
} else if (uMsg == WM_NCACTIVATE) {
*result = ::DefWindowProcW(hwnd, WM_NCACTIVATE, wParam, -1);
*result = static_cast<QT_NATIVE_EVENT_RESULT_TYPE>(::DefWindowProcW(hwnd, WM_NCACTIVATE, wParam, -1));
return true;
} else if (uMsg == WM_GETMINMAXINFO) {
auto *minmaxInfo = reinterpret_cast<MINMAXINFO *>(lParam);
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
minmaxInfo->ptMaxPosition.x = 0;
minmaxInfo->ptMaxPosition.y = 0;
minmaxInfo->ptMaxSize.x = 0;
minmaxInfo->ptMaxSize.y = 0;
return false;
#else
auto pixelRatio = window()->devicePixelRatio();
auto geometry = window()->screen()->availableGeometry();
RECT rect;
SystemParametersInfo(SPI_GETWORKAREA, 0, &rect, 0);
if (!_fixSize) {
minmaxInfo->ptMinTrackSize.x = qRound(window()->minimumWidth() * pixelRatio + offsetXY.x());
minmaxInfo->ptMinTrackSize.y = qRound(window()->minimumHeight() * pixelRatio + offsetXY.y() + _appbar->height() * pixelRatio);
}
minmaxInfo->ptMaxPosition.x = rect.left - offsetXY.x();
minmaxInfo->ptMaxPosition.y = rect.top - offsetXY.x();
minmaxInfo->ptMaxSize.x = qRound(geometry.width() * pixelRatio) + offsetXY.x() * 2;
minmaxInfo->ptMaxSize.y = qRound(geometry.height() * pixelRatio) + offsetXY.y() * 2;
return true;
#endif
return false;
} else if (uMsg == WM_NCRBUTTONDOWN) {
if (wParam == HTCAPTION) {
_showSystemMenu(QCursor::pos());
@ -281,9 +301,11 @@ void FluFrameless::componentComplete() {
} else if (uMsg == WM_SYSCOMMAND) {
if (wParam == SC_MINIMIZE) {
if (window()->transientParent()) {
window()->transientParent()->showMinimized();
auto _hwnd = reinterpret_cast<HWND>(window()->transientParent()->winId());
::ShowWindow(_hwnd, 2);
} else {
window()->showMinimized();
auto _hwnd = reinterpret_cast<HWND>(window()->winId());
::ShowWindow(_hwnd, 2);
}
return true;
}
@ -395,16 +417,21 @@ void FluFrameless::showMaximized() {
HWND hwnd = reinterpret_cast<HWND>(window()->winId());
::ShowWindow(hwnd, 3);
#else
window()->showMaximized();
window()->setVisibility(QQuickWindow::Maximized);
#endif
}
[[maybe_unused]] void FluFrameless::showMinimized() {
window()->showMinimized();
#ifdef Q_OS_WIN
HWND hwnd = reinterpret_cast<HWND>(window()->winId());
::ShowWindow(hwnd, 2);
#else
window()->setVisibility(QQuickWindow::Minimized);
#endif
}
void FluFrameless::showNormal() {
window()->showNormal();
window()->setVisibility(QQuickWindow::Windowed);
}
void FluFrameless::setHitTestVisible(QQuickItem *val) {
@ -413,7 +440,6 @@ void FluFrameless::setHitTestVisible(QQuickItem *val) {
}
}
void FluFrameless::_setWindowTopmost(bool topmost) {
#ifdef Q_OS_WIN
HWND hwnd = reinterpret_cast<HWND>(window()->winId());

View File

@ -73,5 +73,6 @@ private:
int _edges = 0;
int _margins = 8;
quint64 _clickTimer = 0;
bool _isWindows11OrGreater = false;
QList<QPointer<QQuickItem>> _hitTestList;
};

View File

@ -29,9 +29,10 @@ FluTheme::FluTheme(QObject *parent) : QObject{parent} {
});
connect(this, &FluTheme::darkChanged, this, [=] { refreshColors(); });
connect(this, &FluTheme::accentColorChanged, this, [=] { refreshColors(); });
connect(&_watcher, &QFileSystemWatcher::fileChanged, this, [=](const QString &path){
connect(&_watcher, &QFileSystemWatcher::fileChanged, this, [=](const QString &path) {
Q_EMIT desktopImagePathChanged();
});
connect(this, &FluTheme::blurBehindWindowEnabledChanged, this, [=] { checkUpdateDesktopImage(); });
startTimer(1000);
}
@ -46,7 +47,7 @@ void FluTheme::refreshColors() {
fontSecondaryColor(isDark ? QColor(222, 222, 222, 255) : QColor(102, 102, 102, 255));
fontTertiaryColor(isDark ? QColor(200, 200, 200, 255) : QColor(153, 153, 153, 255));
itemNormalColor(isDark ? QColor(255, 255, 255, 0) : QColor(0, 0, 0, 0));
frameColor(isDark ? QColor(56, 56, 56, qRound(255 * 0.8)) : QColor(233, 233, 233, qRound(255 * 0.8)));
frameColor(isDark ? QColor(56, 56, 56, qRound(255 * 0.8)) : QColor(243, 243, 243, qRound(255 * 0.8)));
frameActiveColor(isDark ? QColor(48, 48, 48, qRound(255 * 0.8)) : QColor(255, 255, 255, qRound(255 * 0.8)));
itemHoverColor(isDark ? QColor(255, 255, 255, qRound(255 * 0.06)) : QColor(0, 0, 0, qRound(255 * 0.03)));
itemPressColor(isDark ? QColor(255, 255, 255, qRound(255 * 0.09)) : QColor(0, 0, 0, qRound(255 * 0.06)));
@ -73,12 +74,15 @@ bool FluTheme::dark() const {
}
}
void FluTheme::checkUpdateDesktopImage(){
void FluTheme::checkUpdateDesktopImage() {
if (!_blurBehindWindowEnabled) {
return;
}
QThreadPool::globalInstance()->start([=]() {
_mutex.lock();
auto path = FluTools::getInstance()->getWallpaperFilePath();
if(_desktopImagePath != path){
if(!_desktopImagePath.isEmpty()){
if (_desktopImagePath != path) {
if (!_desktopImagePath.isEmpty()) {
_watcher.removePath(_desktopImagePath);
}
desktopImagePath(path);
@ -88,9 +92,6 @@ void FluTheme::checkUpdateDesktopImage(){
});
}
void FluTheme::timerEvent(QTimerEvent *event)
{
if(_blurBehindWindowEnabled){
checkUpdateDesktopImage();
}
void FluTheme::timerEvent(QTimerEvent *event) {
checkUpdateDesktopImage();
}

View File

@ -1,5 +1,4 @@
#ifndef FLUTHEME_H
#define FLUTHEME_H
#pragma once
#include <QObject>
#include <QtQml/qqml.h>
@ -18,7 +17,7 @@
*/
class FluTheme : public QObject {
Q_OBJECT
Q_PROPERTY(bool dark READ dark NOTIFY darkChanged)
Q_PROPERTY(bool dark READ dark NOTIFY darkChanged)
Q_PROPERTY_AUTO_P(FluAccentColor*, accentColor);
Q_PROPERTY_AUTO(QColor, primaryColor);
Q_PROPERTY_AUTO(QColor, backgroundColor);
@ -49,8 +48,6 @@ private:
void refreshColors();
void updateBackgroundMainColor();
protected:
void timerEvent(QTimerEvent *event) override;
@ -70,6 +67,4 @@ private:
bool _systemDark;
QFileSystemWatcher _watcher;
QMutex _mutex;
};
#endif // FLUTHEME_H
};

View File

@ -59,12 +59,8 @@ FluTextBox{
duration: FluTheme.animationEnabled ? 83 : 0
}
}
contentItem: FluRectangle{
radius: [4,4,4,4]
FluShadow{
radius: 4
}
color: FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(248/255,250/255,253/255,1)
contentItem: FluClip{
radius: [5,5,5,5]
ListView{
id:list_view
anchors.fill: parent
@ -97,10 +93,13 @@ FluTextBox{
radius:4
}
color: {
if(hovered){
return FluTheme.dark ? Qt.rgba(63/255,60/255,61/255,1) : Qt.rgba(237/255,237/255,242/255,1)
if(pressed){
return FluTheme.itemPressColor
}
return FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(0,0,0,0)
if(hovered){
return FluTheme.itemHoverColor
}
return FluTheme.itemNormalColor
}
}
contentItem: FluText{
@ -112,22 +111,28 @@ FluTextBox{
}
}
}
background: Item{
id:container
background:Rectangle{
id: rect_background
implicitWidth: control.width
implicitHeight: 38*Math.min(Math.max(list_view.count,1),8)
radius: 5
color: FluTheme.dark ? Qt.rgba(43/255,43/255,43/255,1) : Qt.rgba(1,1,1,1)
border.color: FluTheme.dark ? Qt.rgba(26/255,26/255,26/255,1) : Qt.rgba(191/255,191/255,191/255,1)
FluShadow{
radius: 5
}
}
}
onTextChanged: {
d.loadData()
if(d.flagVisible){
var pos = control.mapToItem(null, 0, 0)
if(d.window.height>pos.y+control.height+container.implicitHeight){
if(d.window.height>pos.y+control.height+rect_background.implicitHeight){
control_popup.y = control.height
} else if(pos.y>container.implicitHeight){
control_popup.y = -container.implicitHeight
} else if(pos.y>rect_background.implicitHeight){
control_popup.y = -rect_background.implicitHeight
} else {
control_popup.y = d.window.height-(pos.y+container.implicitHeight)
control_popup.y = d.window.height-(pos.y+rect_background.implicitHeight) - 1
}
control_popup.visible = true
}

View File

@ -57,12 +57,12 @@ Item {
Layout.alignment: Qt.AlignVCenter
color: {
if(item_mouse.pressed){
return FluTheme.dark ? Qt.rgba(150/255,150/255,150/235,1) : Qt.rgba(134/255,134/255,134/235,1)
return FluTheme.dark ? Qt.rgba(150/255,150/255,150/255,1) : Qt.rgba(134/255,134/255,134/255,1)
}
if(item_mouse.containsMouse){
return FluTheme.dark ? Qt.rgba(204/255,204/255,204/235,1) : Qt.rgba(92/255,92/255,92/235,1)
return FluTheme.dark ? Qt.rgba(204/255,204/255,204/255,1) : Qt.rgba(92/255,92/255,92/255,1)
}
return FluTheme.dark ? Qt.rgba(255/255,255/255,255/235,1) : Qt.rgba(26/255,26/255,26/235,1)
return FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(26/255,26/255,26/255,1)
}
MouseArea{
id:item_mouse

View File

@ -19,16 +19,20 @@ FluButton {
}
iconColor:control.textColor
}
Item{
id: d
property var window: Window.window
}
onClicked: {
if(menu.count !==0){
var pos = control.mapToItem(null, 0, 0)
var containerHeight = menu.count*36
if(window.height>pos.y+control.height+containerHeight){
if(d.window.height>pos.y+control.height+containerHeight){
menu.y = control.height
}else if(pos.y>containerHeight){
menu.y = -containerHeight
}else{
menu.y = window.height-(pos.y+containerHeight)
menu.y = d.window.height-(pos.y+containerHeight)
}
menu.open()
}

View File

@ -8,11 +8,11 @@ Item{
id:control
default property alias content: container.data
property int statusMode: FluStatusLayoutType.Loading
property string loadingText:"正在加载..."
property string emptyText: "空空如也"
property string errorText: "页面出错了.."
property string errorButtonText: "重新加载"
property color color: FluTheme.dark ? Window.active ? Qt.rgba(38/255,44/255,54/255,1) : Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
property string loadingText: qsTr("Loading...")
property string emptyText: qsTr("Empty")
property string errorText: qsTr("Error")
property string errorButtonText: qsTr("Reload")
property color color: Qt.rgba(0,0,0,0)
signal errorClicked
property Component loadingItem : com_loading
property Component emptyItem : com_empty

View File

@ -23,16 +23,27 @@ FluControlBackground{
GradientStop { position: 1 - d.offsetSize/control.height; color: d.startColor }
GradientStop { position: 1.0; color: d.endColor }
}
bottomMargin: inputItem && inputItem.activeFocus ? 2 : 1
bottomMargin: 1
QtObject{
id:d
property int offsetSize : inputItem && inputItem.activeFocus ? 2 : 3
property color startColor: FluTheme.dark ? Qt.rgba(66/255,66/255,66/255,1) : Qt.rgba(232/255,232/255,232/255,1)
property int offsetSize : 3
property color startColor : FluTheme.dark ? Qt.rgba(66/255,66/255,66/255,1) : Qt.rgba(232/255,232/255,232/255,1)
property color endColor: {
if(!control.enabled){
return d.startColor
}
return inputItem && inputItem.activeFocus ? FluTheme.primaryColor : FluTheme.dark ? Qt.rgba(123/255,123/255,123/255,1) : Qt.rgba(132/255,132/255,132/255,1)
return FluTheme.dark ? Qt.rgba(123/255,123/255,123/255,1) : Qt.rgba(132/255,132/255,132/255,1)
}
}
FluClip{
anchors.fill: parent
radius: [control.radius,control.radius,control.radius,control.radius]
visible: inputItem && inputItem.activeFocus
Rectangle{
width: parent.width
height: 2
anchors.bottom: parent.bottom
color: FluTheme.primaryColor
}
}
}

View File

@ -330,6 +330,12 @@ Window {
function showMaximized(){
frameless.showMaximized()
}
function showMinimized(){
frameless.showMinimized()
}
function showNormal(){
frameless.showNormal()
}
function showLoading(text = "",cancel = true){
if(text===""){
text = qsTr("Loading...")

View File

@ -32,9 +32,9 @@ FluWindow {
}
}
}
function showDialog(){
var x = transientParent.x + (transientParent.width - width)/2
var y = transientParent.y + (transientParent.height - height)/2
function showDialog(offsetX=0,offsetY=0){
var x = transientParent.x + (transientParent.width - width)/2 + offsetX
var y = transientParent.y + (transientParent.height - height)/2 + offsetY
control.stayTop = Qt.binding(function(){return transientParent.stayTop})
control.setGeometry(x,y,width,height)
control.visibility = Window.Windowed

View File

@ -58,12 +58,8 @@ FluTextBox{
duration: FluTheme.animationEnabled ? 83 : 0
}
}
contentItem: FluRectangle{
radius: [4,4,4,4]
FluShadow{
radius: 4
}
color: FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(248/255,250/255,253/255,1)
contentItem: FluClip{
radius: [5,5,5,5]
ListView{
id:list_view
anchors.fill: parent
@ -96,10 +92,13 @@ FluTextBox{
radius:4
}
color: {
if(hovered){
return FluTheme.dark ? Qt.rgba(63/255,60/255,61/255,1) : Qt.rgba(237/255,237/255,242/255,1)
if(pressed){
return FluTheme.itemPressColor
}
return FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(0,0,0,0)
if(hovered){
return FluTheme.itemHoverColor
}
return FluTheme.itemNormalColor
}
}
contentItem: FluText{
@ -111,22 +110,28 @@ FluTextBox{
}
}
}
background: Item{
id:container
background:Rectangle{
id: rect_background
implicitWidth: control.width
implicitHeight: 38*Math.min(Math.max(list_view.count,1),8)
radius: 5
color: FluTheme.dark ? Qt.rgba(43/255,43/255,43/255,1) : Qt.rgba(1,1,1,1)
border.color: FluTheme.dark ? Qt.rgba(26/255,26/255,26/255,1) : Qt.rgba(191/255,191/255,191/255,1)
FluShadow{
radius: 5
}
}
}
onTextChanged: {
d.loadData()
if(d.flagVisible){
var pos = control.mapToItem(null, 0, 0)
if(d.window.height>pos.y+control.height+container.implicitHeight){
if(d.window.height>pos.y+control.height+rect_background.implicitHeight){
control_popup.y = control.height
} else if(pos.y>container.implicitHeight){
control_popup.y = -container.implicitHeight
} else if(pos.y>rect_background.implicitHeight){
control_popup.y = -rect_background.implicitHeight
} else {
control_popup.y = d.window.height-(pos.y+container.implicitHeight)
control_popup.y = d.window.height-(pos.y+rect_background.implicitHeight) - 1
}
control_popup.visible = true
}

View File

@ -57,12 +57,12 @@ Item {
Layout.alignment: Qt.AlignVCenter
color: {
if(item_mouse.pressed){
return FluTheme.dark ? Qt.rgba(150/255,150/255,150/235,1) : Qt.rgba(134/255,134/255,134/235,1)
return FluTheme.dark ? Qt.rgba(150/255,150/255,150/255,1) : Qt.rgba(134/255,134/255,134/255,1)
}
if(item_mouse.containsMouse){
return FluTheme.dark ? Qt.rgba(204/255,204/255,204/235,1) : Qt.rgba(92/255,92/255,92/235,1)
return FluTheme.dark ? Qt.rgba(204/255,204/255,204/255,1) : Qt.rgba(92/255,92/255,92/255,1)
}
return FluTheme.dark ? Qt.rgba(255/255,255/255,255/235,1) : Qt.rgba(26/255,26/255,26/235,1)
return FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(26/255,26/255,26/255,1)
}
MouseArea{
id:item_mouse

View File

@ -20,16 +20,20 @@ FluButton {
}
iconColor:control.textColor
}
Item{
id: d
property var window: Window.window
}
onClicked: {
if(menu.count !==0){
var pos = control.mapToItem(null, 0, 0)
var containerHeight = menu.count*36
if(window.height>pos.y+control.height+containerHeight){
if(d.window.height>pos.y+control.height+containerHeight){
menu.y = control.height
}else if(pos.y>containerHeight){
menu.y = -containerHeight
}else{
menu.y = window.height-(pos.y+containerHeight)
menu.y = d.window.height-(pos.y+containerHeight)
}
menu.open()
}

View File

@ -7,11 +7,11 @@ Item{
id:control
default property alias content: container.data
property int statusMode: FluStatusLayoutType.Loading
property string loadingText:"正在加载..."
property string emptyText: "空空如也"
property string errorText: "页面出错了.."
property string errorButtonText: "重新加载"
property color color: FluTheme.dark ? Window.active ? Qt.rgba(38/255,44/255,54/255,1) : Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
property string loadingText: qsTr("Loading...")
property string emptyText: qsTr("Empty")
property string errorText: qsTr("Error")
property string errorButtonText: qsTr("Reload")
property color color: Qt.rgba(0,0,0,0)
signal errorClicked
property Component loadingItem : com_loading
property Component emptyItem : com_empty

View File

@ -23,16 +23,27 @@ FluControlBackground{
GradientStop { position: 1 - d.offsetSize/control.height; color: d.startColor }
GradientStop { position: 1.0; color: d.endColor }
}
bottomMargin: inputItem && inputItem.activeFocus ? 2 : 1
bottomMargin: 1
QtObject{
id:d
property int offsetSize : inputItem && inputItem.activeFocus ? 2 : 3
property color startColor: FluTheme.dark ? Qt.rgba(66/255,66/255,66/255,1) : Qt.rgba(232/255,232/255,232/255,1)
property int offsetSize : 3
property color startColor : FluTheme.dark ? Qt.rgba(66/255,66/255,66/255,1) : Qt.rgba(232/255,232/255,232/255,1)
property color endColor: {
if(!control.enabled){
return d.startColor
}
return inputItem && inputItem.activeFocus ? FluTheme.primaryColor : FluTheme.dark ? Qt.rgba(123/255,123/255,123/255,1) : Qt.rgba(132/255,132/255,132/255,1)
return FluTheme.dark ? Qt.rgba(123/255,123/255,123/255,1) : Qt.rgba(132/255,132/255,132/255,1)
}
}
FluClip{
anchors.fill: parent
radius: [control.radius,control.radius,control.radius,control.radius]
visible: inputItem && inputItem.activeFocus
Rectangle{
width: parent.width
height: 2
anchors.bottom: parent.bottom
color: FluTheme.primaryColor
}
}
}

View File

@ -329,6 +329,12 @@ Window {
function showMaximized(){
frameless.showMaximized()
}
function showMinimized(){
frameless.showMinimized()
}
function showNormal(){
frameless.showNormal()
}
function showLoading(text = "",cancel = true){
if(text===""){
text = qsTr("Loading...")

View File

@ -32,9 +32,9 @@ FluWindow {
}
}
}
function showDialog(){
var x = transientParent.x + (transientParent.width - width)/2
var y = transientParent.y + (transientParent.height - height)/2
function showDialog(offsetX=0,offsetY=0){
var x = transientParent.x + (transientParent.width - width)/2 + offsetX
var y = transientParent.y + (transientParent.height - height)/2 + offsetY
control.stayTop = Qt.binding(function(){return transientParent.stayTop})
control.setGeometry(x,y,width,height)
control.visibility = Window.Windowed

View File

@ -232,6 +232,33 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FluStatusLayout</name>
<message>
<location filename="Qt5/imports/FluentUI/Controls/FluStatusLayout.qml" line="11"/>
<location filename="Qt6/imports/FluentUI/Controls/FluStatusLayout.qml" line="10"/>
<source>Loading...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="Qt5/imports/FluentUI/Controls/FluStatusLayout.qml" line="12"/>
<location filename="Qt6/imports/FluentUI/Controls/FluStatusLayout.qml" line="11"/>
<source>Empty</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="Qt5/imports/FluentUI/Controls/FluStatusLayout.qml" line="13"/>
<location filename="Qt6/imports/FluentUI/Controls/FluStatusLayout.qml" line="12"/>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="Qt5/imports/FluentUI/Controls/FluStatusLayout.qml" line="14"/>
<location filename="Qt6/imports/FluentUI/Controls/FluStatusLayout.qml" line="13"/>
<source>Reload</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FluTextBoxMenu</name>
<message>

View File

@ -232,6 +232,33 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FluStatusLayout</name>
<message>
<location filename="Qt5/imports/FluentUI/Controls/FluStatusLayout.qml" line="11"/>
<location filename="Qt6/imports/FluentUI/Controls/FluStatusLayout.qml" line="10"/>
<source>Loading...</source>
<translation type="unfinished">...</translation>
</message>
<message>
<location filename="Qt5/imports/FluentUI/Controls/FluStatusLayout.qml" line="12"/>
<location filename="Qt6/imports/FluentUI/Controls/FluStatusLayout.qml" line="11"/>
<source>Empty</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="Qt5/imports/FluentUI/Controls/FluStatusLayout.qml" line="13"/>
<location filename="Qt6/imports/FluentUI/Controls/FluStatusLayout.qml" line="12"/>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="Qt5/imports/FluentUI/Controls/FluStatusLayout.qml" line="14"/>
<location filename="Qt6/imports/FluentUI/Controls/FluStatusLayout.qml" line="13"/>
<source>Reload</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FluTextBoxMenu</name>
<message>