Compare commits
No commits in common. "5ea480afcb03961055582179939e23b587c565bb" and "3a0f6355c8bfb0477b1c9e62a0f89c841df28de6" have entirely different histories.
5ea480afcb
...
3a0f6355c8
|
@ -2,12 +2,6 @@ cmake_minimum_required(VERSION 3.20)
|
||||||
|
|
||||||
project(FluentUI VERSION 1.0)
|
project(FluentUI VERSION 1.0)
|
||||||
|
|
||||||
if(MSVC)
|
|
||||||
#让Release也生成pdb文件
|
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF")
|
|
||||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(FLUENTUI_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
|
set(FLUENTUI_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
|
||||||
list(APPEND CMAKE_MODULE_PATH ${FLUENTUI_DIRECTORY}/.cmake/)
|
list(APPEND CMAKE_MODULE_PATH ${FLUENTUI_DIRECTORY}/.cmake/)
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
cmake_minimum_required(VERSION 3.20)
|
cmake_minimum_required(VERSION 3.20)
|
||||||
|
|
||||||
project(example VERSION 1.0 LANGUAGES CXX)
|
project(example VERSION 1.0)
|
||||||
|
|
||||||
#配置通用编译
|
#配置通用编译
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
@ -50,10 +50,6 @@ foreach(filepath ${CPP_FILES})
|
||||||
list(APPEND sources_files ${filename})
|
list(APPEND sources_files ${filename})
|
||||||
endforeach(filepath)
|
endforeach(filepath)
|
||||||
|
|
||||||
if(WIN32)
|
|
||||||
list(APPEND sources_files "src/app_dmp.h")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(QT_VERSION VERSION_GREATER_EQUAL "6.2")
|
if(QT_VERSION VERSION_GREATER_EQUAL "6.2")
|
||||||
#遍历所有qml文件
|
#遍历所有qml文件
|
||||||
file(GLOB_RECURSE QML_PATHS *.qml qmldir)
|
file(GLOB_RECURSE QML_PATHS *.qml qmldir)
|
||||||
|
|
|
@ -196,7 +196,5 @@
|
||||||
<file>qml/chart/T_ScatterChart.qml</file>
|
<file>qml/chart/T_ScatterChart.qml</file>
|
||||||
<file>qml/chart/T_BubbleChart.qml</file>
|
<file>qml/chart/T_BubbleChart.qml</file>
|
||||||
<file>qml/chart/T_PolarAreaChart.qml</file>
|
<file>qml/chart/T_PolarAreaChart.qml</file>
|
||||||
<file>res/image/ic_crash.png</file>
|
|
||||||
<file>qml/window/CrashWindow.qml</file>
|
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
|
@ -36,17 +36,12 @@ Item {
|
||||||
"/about":"qrc:/example/qml/window/AboutWindow.qml",
|
"/about":"qrc:/example/qml/window/AboutWindow.qml",
|
||||||
"/login":"qrc:/example/qml/window/LoginWindow.qml",
|
"/login":"qrc:/example/qml/window/LoginWindow.qml",
|
||||||
"/hotload":"qrc:/example/qml/window/HotloadWindow.qml",
|
"/hotload":"qrc:/example/qml/window/HotloadWindow.qml",
|
||||||
"/crash":"qrc:/example/qml/window/CrashWindow.qml",
|
|
||||||
"/singleTaskWindow":"qrc:/example/qml/window/SingleTaskWindow.qml",
|
"/singleTaskWindow":"qrc:/example/qml/window/SingleTaskWindow.qml",
|
||||||
"/standardWindow":"qrc:/example/qml/window/StandardWindow.qml",
|
"/standardWindow":"qrc:/example/qml/window/StandardWindow.qml",
|
||||||
"/singleInstanceWindow":"qrc:/example/qml/window/SingleInstanceWindow.qml",
|
"/singleInstanceWindow":"qrc:/example/qml/window/SingleInstanceWindow.qml",
|
||||||
"/pageWindow":"qrc:/example/qml/window/PageWindow.qml"
|
"/pageWindow":"qrc:/example/qml/window/PageWindow.qml"
|
||||||
}
|
}
|
||||||
var args = Qt.application.arguments
|
FluApp.initialRoute = "/"
|
||||||
if(args.length>=2 && args[1].startsWith("-crashed=")){
|
FluApp.run()
|
||||||
FluApp.navigate("/crash",{crashFilePath:args[1].replace("-crashed=","")})
|
|
||||||
}else{
|
|
||||||
FluApp.navigate("/")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -466,13 +466,6 @@ FluObject{
|
||||||
url:"qrc:/example/qml/page/T_3D.qml"
|
url:"qrc:/example/qml/page/T_3D.qml"
|
||||||
onTap:{ navigationView.push(url) }
|
onTap:{ navigationView.push(url) }
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
|
||||||
title:"Test Crash"
|
|
||||||
visible: FluTools.isWin()
|
|
||||||
onTapListener: function(){
|
|
||||||
AppInfo.testCrash()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRecentlyAddedData(){
|
function getRecentlyAddedData(){
|
||||||
|
|
|
@ -1,72 +0,0 @@
|
||||||
import QtQuick
|
|
||||||
import QtQuick.Controls
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import FluentUI
|
|
||||||
import Qt.labs.platform
|
|
||||||
import "qrc:///example/qml/component"
|
|
||||||
|
|
||||||
FluWindow {
|
|
||||||
|
|
||||||
id:window
|
|
||||||
title:"友情提示"
|
|
||||||
width: 300
|
|
||||||
height: 400
|
|
||||||
fixSize: true
|
|
||||||
showMinimize: false
|
|
||||||
showStayTop: false
|
|
||||||
|
|
||||||
property string crashFilePath
|
|
||||||
|
|
||||||
onInitArgument:
|
|
||||||
(argument)=>{
|
|
||||||
crashFilePath = argument.crashFilePath
|
|
||||||
}
|
|
||||||
|
|
||||||
Image{
|
|
||||||
width: 540/2
|
|
||||||
height: 285/2
|
|
||||||
anchors{
|
|
||||||
horizontalCenter: parent.horizontalCenter
|
|
||||||
top: parent.top
|
|
||||||
topMargin: 40
|
|
||||||
}
|
|
||||||
source: "qrc:/example/res/image/ic_crash.png"
|
|
||||||
}
|
|
||||||
|
|
||||||
FluText{
|
|
||||||
id:text_info
|
|
||||||
anchors{
|
|
||||||
horizontalCenter: parent.horizontalCenter
|
|
||||||
top: parent.top
|
|
||||||
topMargin: 240
|
|
||||||
}
|
|
||||||
text:"发生意外错误\n给您带来的不便,我们深表歉意"
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout{
|
|
||||||
anchors{
|
|
||||||
horizontalCenter: parent.horizontalCenter
|
|
||||||
bottom: parent.bottom
|
|
||||||
bottomMargin: 20
|
|
||||||
}
|
|
||||||
FluButton{
|
|
||||||
text:"日志上报"
|
|
||||||
onClicked: {
|
|
||||||
FluTools.showFileInFolder(crashFilePath)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Item{
|
|
||||||
width: 30
|
|
||||||
height: 1
|
|
||||||
}
|
|
||||||
FluFilledButton{
|
|
||||||
text:"重启程序"
|
|
||||||
onClicked: {
|
|
||||||
FluApp.exit(931)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -36,17 +36,12 @@ Item {
|
||||||
"/about":"qrc:/example/qml/window/AboutWindow.qml",
|
"/about":"qrc:/example/qml/window/AboutWindow.qml",
|
||||||
"/login":"qrc:/example/qml/window/LoginWindow.qml",
|
"/login":"qrc:/example/qml/window/LoginWindow.qml",
|
||||||
"/hotload":"qrc:/example/qml/window/HotloadWindow.qml",
|
"/hotload":"qrc:/example/qml/window/HotloadWindow.qml",
|
||||||
"/crash":"qrc:/example/qml/window/CrashWindow.qml",
|
|
||||||
"/singleTaskWindow":"qrc:/example/qml/window/SingleTaskWindow.qml",
|
"/singleTaskWindow":"qrc:/example/qml/window/SingleTaskWindow.qml",
|
||||||
"/standardWindow":"qrc:/example/qml/window/StandardWindow.qml",
|
"/standardWindow":"qrc:/example/qml/window/StandardWindow.qml",
|
||||||
"/singleInstanceWindow":"qrc:/example/qml/window/SingleInstanceWindow.qml",
|
"/singleInstanceWindow":"qrc:/example/qml/window/SingleInstanceWindow.qml",
|
||||||
"/pageWindow":"qrc:/example/qml/window/PageWindow.qml"
|
"/pageWindow":"qrc:/example/qml/window/PageWindow.qml"
|
||||||
}
|
}
|
||||||
var args = Qt.application.arguments
|
FluApp.initialRoute = "/"
|
||||||
if(args.length>=2 && args[1].startsWith("-crashed=")){
|
FluApp.run()
|
||||||
FluApp.navigate("/crash",{crashFilePath:args[1].replace("-crashed=","")})
|
|
||||||
}else{
|
|
||||||
FluApp.navigate("/")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -466,13 +466,6 @@ FluObject{
|
||||||
url:"qrc:/example/qml/page/T_3D.qml"
|
url:"qrc:/example/qml/page/T_3D.qml"
|
||||||
onTap:{ navigationView.push(url) }
|
onTap:{ navigationView.push(url) }
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
|
||||||
title:"Test Crash"
|
|
||||||
visible: FluTools.isWin()
|
|
||||||
onTapListener: function(){
|
|
||||||
AppInfo.testCrash()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRecentlyAddedData(){
|
function getRecentlyAddedData(){
|
||||||
|
|
|
@ -1,72 +0,0 @@
|
||||||
import QtQuick 2.15
|
|
||||||
import QtQuick.Controls 2.15
|
|
||||||
import QtQuick.Layouts 1.15
|
|
||||||
import FluentUI 1.0
|
|
||||||
import Qt.labs.platform 1.0
|
|
||||||
import "qrc:///example/qml/component"
|
|
||||||
|
|
||||||
FluWindow {
|
|
||||||
|
|
||||||
id:window
|
|
||||||
title:"友情提示"
|
|
||||||
width: 300
|
|
||||||
height: 400
|
|
||||||
fixSize: true
|
|
||||||
showMinimize: false
|
|
||||||
showStayTop: false
|
|
||||||
|
|
||||||
property string crashFilePath
|
|
||||||
|
|
||||||
onInitArgument:
|
|
||||||
(argument)=>{
|
|
||||||
crashFilePath = argument.crashFilePath
|
|
||||||
}
|
|
||||||
|
|
||||||
Image{
|
|
||||||
width: 540/2
|
|
||||||
height: 285/2
|
|
||||||
anchors{
|
|
||||||
horizontalCenter: parent.horizontalCenter
|
|
||||||
top: parent.top
|
|
||||||
topMargin: 40
|
|
||||||
}
|
|
||||||
source: "qrc:/example/res/image/ic_crash.png"
|
|
||||||
}
|
|
||||||
|
|
||||||
FluText{
|
|
||||||
id:text_info
|
|
||||||
anchors{
|
|
||||||
horizontalCenter: parent.horizontalCenter
|
|
||||||
top: parent.top
|
|
||||||
topMargin: 240
|
|
||||||
}
|
|
||||||
text:"发生意外错误\n给您带来的不便,我们深表歉意"
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout{
|
|
||||||
anchors{
|
|
||||||
horizontalCenter: parent.horizontalCenter
|
|
||||||
bottom: parent.bottom
|
|
||||||
bottomMargin: 20
|
|
||||||
}
|
|
||||||
FluButton{
|
|
||||||
text:"日志上报"
|
|
||||||
onClicked: {
|
|
||||||
FluTools.showFileInFolder(crashFilePath)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Item{
|
|
||||||
width: 30
|
|
||||||
height: 1
|
|
||||||
}
|
|
||||||
FluFilledButton{
|
|
||||||
text:"重启程序"
|
|
||||||
onClicked: {
|
|
||||||
FluApp.exit(931)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Binary file not shown.
Before Width: | Height: | Size: 11 KiB |
|
@ -10,8 +10,3 @@ AppInfo::AppInfo(QObject *parent)
|
||||||
{
|
{
|
||||||
version(APPLICATION_VERSION);
|
version(APPLICATION_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppInfo::testCrash(){
|
|
||||||
auto *crash = reinterpret_cast<volatile int *>(0);
|
|
||||||
*crash = 0;
|
|
||||||
}
|
|
||||||
|
|
|
@ -14,7 +14,6 @@ private:
|
||||||
explicit AppInfo(QObject *parent = nullptr);
|
explicit AppInfo(QObject *parent = nullptr);
|
||||||
public:
|
public:
|
||||||
SINGLETON(AppInfo)
|
SINGLETON(AppInfo)
|
||||||
Q_INVOKABLE void testCrash();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // APPINFO_H
|
#endif // APPINFO_H
|
||||||
|
|
|
@ -1,82 +0,0 @@
|
||||||
#ifndef APP_DUMP_H
|
|
||||||
#define APP_DUMP_H
|
|
||||||
|
|
||||||
#include <Windows.h>
|
|
||||||
#include <DbgHelp.h>
|
|
||||||
#include <QDateTime>
|
|
||||||
#include <QDir>
|
|
||||||
#include <QGuiApplication>
|
|
||||||
#include <QProcess>
|
|
||||||
#include <QStandardPaths>
|
|
||||||
#include <QString>
|
|
||||||
|
|
||||||
#pragma comment(lib, "Dbghelp.lib")
|
|
||||||
|
|
||||||
static void miniDumpWriteDump(HANDLE hProcess,DWORD ProcessId,HANDLE hFile,MINIDUMP_TYPE DumpType,CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam){
|
|
||||||
typedef HRESULT (WINAPI* MiniDumpWriteDumpPtr)(HANDLE hProcess,DWORD ProcessId,HANDLE hFile,MINIDUMP_TYPE DumpType,CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam);
|
|
||||||
HMODULE module = LoadLibraryW(L"Dbghelp.dll");
|
|
||||||
if (module)
|
|
||||||
{
|
|
||||||
MiniDumpWriteDumpPtr mini_dump_write_dump;
|
|
||||||
mini_dump_write_dump= reinterpret_cast<MiniDumpWriteDumpPtr>(GetProcAddress(module, "MiniDumpWriteDump"));
|
|
||||||
if (mini_dump_write_dump)
|
|
||||||
{
|
|
||||||
mini_dump_write_dump(hProcess,ProcessId,hFile,DumpType,ExceptionParam,UserStreamParam,CallbackParam);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL CALLBACK MyMiniDumpCallback(PVOID, const PMINIDUMP_CALLBACK_INPUT input, PMINIDUMP_CALLBACK_OUTPUT output) {
|
|
||||||
if (input == NULL || output == NULL)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
BOOL ret = FALSE;
|
|
||||||
switch (input->CallbackType) {
|
|
||||||
case IncludeModuleCallback:
|
|
||||||
case IncludeThreadCallback:
|
|
||||||
case ThreadCallback:
|
|
||||||
case ThreadExCallback:
|
|
||||||
ret = TRUE;
|
|
||||||
break;
|
|
||||||
case ModuleCallback: {
|
|
||||||
if (!(output->ModuleWriteFlags & ModuleReferencedByMemory)) {
|
|
||||||
output->ModuleWriteFlags &= ~ModuleWriteModule;
|
|
||||||
}
|
|
||||||
ret = TRUE;
|
|
||||||
} break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
void WriteDump(EXCEPTION_POINTERS* exp, const std::wstring& path) {
|
|
||||||
HANDLE h = ::CreateFileW(path.c_str(), GENERIC_WRITE | GENERIC_READ, FILE_SHARE_WRITE | FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
|
||||||
MINIDUMP_EXCEPTION_INFORMATION info;
|
|
||||||
info.ThreadId = ::GetCurrentThreadId();
|
|
||||||
info.ExceptionPointers = exp;
|
|
||||||
info.ClientPointers = FALSE;
|
|
||||||
MINIDUMP_CALLBACK_INFORMATION mci;
|
|
||||||
mci.CallbackRoutine = (MINIDUMP_CALLBACK_ROUTINE)MyMiniDumpCallback;
|
|
||||||
mci.CallbackParam = 0;
|
|
||||||
MINIDUMP_TYPE mdt = (MINIDUMP_TYPE)(MiniDumpWithIndirectlyReferencedMemory | MiniDumpScanMemory);
|
|
||||||
miniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), h, mdt, &info, NULL, &mci);
|
|
||||||
::CloseHandle(h);
|
|
||||||
}
|
|
||||||
|
|
||||||
LONG WINAPI MyUnhandledExceptionFilter(EXCEPTION_POINTERS* exp) {
|
|
||||||
const QString dumpFileName = QString("%1_%2.dmp").arg("crash",QDateTime::currentDateTime().toString("yyyyMMdd_hhmmss"));
|
|
||||||
const QString dumpDirPath = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)+"/dmp";
|
|
||||||
const QDir dumpDir(dumpDirPath);
|
|
||||||
if(!dumpDir.exists()){
|
|
||||||
dumpDir.mkpath(dumpDirPath);
|
|
||||||
}
|
|
||||||
QString dumpFilePath = dumpDir.filePath(dumpFileName);
|
|
||||||
WriteDump(exp, dumpFilePath.toStdWString());
|
|
||||||
QStringList arguments;
|
|
||||||
arguments << "-crashed=" + dumpFilePath;
|
|
||||||
QProcess::startDetached(qApp->applicationFilePath(), arguments);
|
|
||||||
return EXCEPTION_EXECUTE_HANDLER;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // APP_DUMP_H
|
|
|
@ -92,7 +92,7 @@ QString Log::prettyProductInfoWrapper()
|
||||||
return productName;
|
return productName;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void messageHandler(const QtMsgType type, const QMessageLogContext &context, const QString &message)
|
static inline void myMessageHandler(const QtMsgType type, const QMessageLogContext &context, const QString &message)
|
||||||
{
|
{
|
||||||
if(message == "Could not get the INetworkConnection instance for the adapter GUID."){
|
if(message == "Could not get the INetworkConnection instance for the adapter GUID."){
|
||||||
return;
|
return;
|
||||||
|
@ -188,7 +188,7 @@ void Log::setup(const QString &app,int level)
|
||||||
logDir.mkpath(logDirPath);
|
logDir.mkpath(logDirPath);
|
||||||
}
|
}
|
||||||
g_file_path = logDir.filePath(logFileName);
|
g_file_path = logDir.filePath(logFileName);
|
||||||
qInstallMessageHandler(messageHandler);
|
qInstallMessageHandler(myMessageHandler);
|
||||||
qInfo()<<"===================================================";
|
qInfo()<<"===================================================";
|
||||||
qInfo()<<"[AppName]"<<g_app;
|
qInfo()<<"[AppName]"<<g_app;
|
||||||
qInfo()<<"[AppVersion]"<<APPLICATION_VERSION;
|
qInfo()<<"[AppVersion]"<<APPLICATION_VERSION;
|
||||||
|
|
|
@ -23,17 +23,12 @@ Q_IMPORT_QML_PLUGIN(FluentUIPlugin)
|
||||||
#include <FluentUI.h>
|
#include <FluentUI.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
#include "app_dmp.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
qputenv("QT_QUICK_CONTROLS_STYLE","Basic");
|
||||||
::SetUnhandledExceptionFilter(MyUnhandledExceptionFilter);
|
#ifdef Q_OS_WIN
|
||||||
qputenv("QT_QPA_PLATFORM","windows:darkmode=2");
|
qputenv("QT_QPA_PLATFORM","windows:darkmode=2");
|
||||||
#endif
|
#endif
|
||||||
qputenv("QT_QUICK_CONTROLS_STYLE","Basic");
|
|
||||||
#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","");
|
||||||
|
|
|
@ -41,22 +41,15 @@ Item {
|
||||||
function handleItems(){
|
function handleItems(){
|
||||||
var _idx = 0
|
var _idx = 0
|
||||||
var data = []
|
var data = []
|
||||||
var comEmpty = Qt.createComponent("FluPaneItemEmpty.qml");
|
|
||||||
if(items){
|
if(items){
|
||||||
for(var i=0;i<items.children.length;i++){
|
for(var i=0;i<items.children.length;i++){
|
||||||
var item = items.children[i]
|
var item = items.children[i]
|
||||||
if(item.visible !== true){
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
item._idx = _idx
|
item._idx = _idx
|
||||||
data.push(item)
|
data.push(item)
|
||||||
_idx++
|
_idx++
|
||||||
if(item instanceof FluPaneItemExpander){
|
if(item instanceof FluPaneItemExpander){
|
||||||
for(var j=0;j<item.children.length;j++){
|
for(var j=0;j<item.children.length;j++){
|
||||||
var itemChild = item.children[j]
|
var itemChild = item.children[j]
|
||||||
if(itemChild.visible !== true){
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
itemChild._parent = item
|
itemChild._parent = item
|
||||||
itemChild._idx = _idx
|
itemChild._idx = _idx
|
||||||
data.push(itemChild)
|
data.push(itemChild)
|
||||||
|
@ -65,11 +58,10 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(footerItems){
|
if(footerItems){
|
||||||
|
var comEmpty = Qt.createComponent("FluPaneItemEmpty.qml");
|
||||||
for(var k=0;k<footerItems.children.length;k++){
|
for(var k=0;k<footerItems.children.length;k++){
|
||||||
var itemFooter = footerItems.children[k]
|
var itemFooter = footerItems.children[k]
|
||||||
if(itemFooter.visible !== true){
|
if (comEmpty.status === Component.Ready) {
|
||||||
continue
|
|
||||||
}
|
|
||||||
var objEmpty = comEmpty.createObject(items,{_idx:_idx});
|
var objEmpty = comEmpty.createObject(items,{_idx:_idx});
|
||||||
itemFooter._idx = _idx;
|
itemFooter._idx = _idx;
|
||||||
data.push(objEmpty)
|
data.push(objEmpty)
|
||||||
|
@ -77,21 +69,9 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
function handleFooterItems(){
|
|
||||||
var data = []
|
|
||||||
if(footerItems){
|
|
||||||
for(var i=0;i<footerItems.children.length;i++){
|
|
||||||
var item = footerItems.children[i]
|
|
||||||
if(item.visible !== true){
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
data.push(item)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
d.displayMode = Qt.binding(function(){
|
d.displayMode = Qt.binding(function(){
|
||||||
|
@ -277,9 +257,6 @@ Item {
|
||||||
}
|
}
|
||||||
for(var i=0;i<model.children.length;i++){
|
for(var i=0;i<model.children.length;i++){
|
||||||
var item = model.children[i]
|
var item = model.children[i]
|
||||||
if(item.visible !== true){
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if(item._idx === nav_list.currentIndex && !model.isExpand){
|
if(item._idx === nav_list.currentIndex && !model.isExpand){
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -1062,7 +1039,11 @@ Item {
|
||||||
interactive: false
|
interactive: false
|
||||||
boundsBehavior: ListView.StopAtBounds
|
boundsBehavior: ListView.StopAtBounds
|
||||||
currentIndex: -1
|
currentIndex: -1
|
||||||
model: d.handleFooterItems()
|
model: {
|
||||||
|
if(footerItems){
|
||||||
|
return footerItems.children
|
||||||
|
}
|
||||||
|
}
|
||||||
highlightMoveDuration: 150
|
highlightMoveDuration: 150
|
||||||
highlight: Item{
|
highlight: Item{
|
||||||
clip: true
|
clip: true
|
||||||
|
|
|
@ -7,7 +7,6 @@ QtObject {
|
||||||
property int _idx
|
property int _idx
|
||||||
property var _ext
|
property var _ext
|
||||||
property var _parent
|
property var _parent
|
||||||
property bool visible: true
|
|
||||||
property string title
|
property string title
|
||||||
property var url
|
property var url
|
||||||
property bool disabled: false
|
property bool disabled: false
|
||||||
|
|
|
@ -7,5 +7,4 @@ QtObject {
|
||||||
property int _idx
|
property int _idx
|
||||||
property var _ext
|
property var _ext
|
||||||
property var _parent
|
property var _parent
|
||||||
property bool visible: true
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ import FluentUI 1.0
|
||||||
FluObject {
|
FluObject {
|
||||||
readonly property string key : FluTools.uuid()
|
readonly property string key : FluTools.uuid()
|
||||||
property int _idx
|
property int _idx
|
||||||
property bool visible: true
|
|
||||||
property string title
|
property string title
|
||||||
property var icon
|
property var icon
|
||||||
property bool disabled: false
|
property bool disabled: false
|
||||||
|
|
|
@ -5,7 +5,6 @@ import FluentUI 1.0
|
||||||
QtObject {
|
QtObject {
|
||||||
readonly property string key : FluTools.uuid()
|
readonly property string key : FluTools.uuid()
|
||||||
property int _idx
|
property int _idx
|
||||||
property bool visible: true
|
|
||||||
property string title
|
property string title
|
||||||
property var parent
|
property var parent
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ import FluentUI 1.0
|
||||||
QtObject {
|
QtObject {
|
||||||
readonly property string key : FluTools.uuid()
|
readonly property string key : FluTools.uuid()
|
||||||
property int _idx
|
property int _idx
|
||||||
property bool visible: true
|
|
||||||
property var parent
|
property var parent
|
||||||
property real spacing
|
property real spacing
|
||||||
property int size:1
|
property int size:1
|
||||||
|
|
|
@ -42,22 +42,15 @@ Item {
|
||||||
function handleItems(){
|
function handleItems(){
|
||||||
var _idx = 0
|
var _idx = 0
|
||||||
var data = []
|
var data = []
|
||||||
var comEmpty = Qt.createComponent("FluPaneItemEmpty.qml");
|
|
||||||
if(items){
|
if(items){
|
||||||
for(var i=0;i<items.children.length;i++){
|
for(var i=0;i<items.children.length;i++){
|
||||||
var item = items.children[i]
|
var item = items.children[i]
|
||||||
if(item.visible !== true){
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
item._idx = _idx
|
item._idx = _idx
|
||||||
data.push(item)
|
data.push(item)
|
||||||
_idx++
|
_idx++
|
||||||
if(item instanceof FluPaneItemExpander){
|
if(item instanceof FluPaneItemExpander){
|
||||||
for(var j=0;j<item.children.length;j++){
|
for(var j=0;j<item.children.length;j++){
|
||||||
var itemChild = item.children[j]
|
var itemChild = item.children[j]
|
||||||
if(itemChild.visible !== true){
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
itemChild._parent = item
|
itemChild._parent = item
|
||||||
itemChild._idx = _idx
|
itemChild._idx = _idx
|
||||||
data.push(itemChild)
|
data.push(itemChild)
|
||||||
|
@ -66,11 +59,10 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(footerItems){
|
if(footerItems){
|
||||||
|
var comEmpty = Qt.createComponent("FluPaneItemEmpty.qml");
|
||||||
for(var k=0;k<footerItems.children.length;k++){
|
for(var k=0;k<footerItems.children.length;k++){
|
||||||
var itemFooter = footerItems.children[k]
|
var itemFooter = footerItems.children[k]
|
||||||
if(itemFooter.visible !== true){
|
if (comEmpty.status === Component.Ready) {
|
||||||
continue
|
|
||||||
}
|
|
||||||
var objEmpty = comEmpty.createObject(items,{_idx:_idx});
|
var objEmpty = comEmpty.createObject(items,{_idx:_idx});
|
||||||
itemFooter._idx = _idx;
|
itemFooter._idx = _idx;
|
||||||
data.push(objEmpty)
|
data.push(objEmpty)
|
||||||
|
@ -78,21 +70,9 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
function handleFooterItems(){
|
|
||||||
var data = []
|
|
||||||
if(footerItems){
|
|
||||||
for(var i=0;i<footerItems.children.length;i++){
|
|
||||||
var item = footerItems.children[i]
|
|
||||||
if(item.visible !== true){
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
data.push(item)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
d.displayMode = Qt.binding(function(){
|
d.displayMode = Qt.binding(function(){
|
||||||
|
@ -278,9 +258,6 @@ Item {
|
||||||
}
|
}
|
||||||
for(var i=0;i<model.children.length;i++){
|
for(var i=0;i<model.children.length;i++){
|
||||||
var item = model.children[i]
|
var item = model.children[i]
|
||||||
if(item.visible !== true){
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if(item._idx === nav_list.currentIndex && !model.isExpand){
|
if(item._idx === nav_list.currentIndex && !model.isExpand){
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -1063,7 +1040,11 @@ Item {
|
||||||
interactive: false
|
interactive: false
|
||||||
boundsBehavior: ListView.StopAtBounds
|
boundsBehavior: ListView.StopAtBounds
|
||||||
currentIndex: -1
|
currentIndex: -1
|
||||||
model: d.handleFooterItems()
|
model: {
|
||||||
|
if(footerItems){
|
||||||
|
return footerItems.children
|
||||||
|
}
|
||||||
|
}
|
||||||
highlightMoveDuration: 150
|
highlightMoveDuration: 150
|
||||||
highlight: Item{
|
highlight: Item{
|
||||||
clip: true
|
clip: true
|
||||||
|
|
|
@ -7,7 +7,6 @@ QtObject {
|
||||||
property int _idx
|
property int _idx
|
||||||
property var _ext
|
property var _ext
|
||||||
property var _parent
|
property var _parent
|
||||||
property bool visible: true
|
|
||||||
property string title
|
property string title
|
||||||
property var url
|
property var url
|
||||||
property bool disabled: false
|
property bool disabled: false
|
||||||
|
|
|
@ -7,5 +7,4 @@ QtObject {
|
||||||
property int _idx
|
property int _idx
|
||||||
property var _ext
|
property var _ext
|
||||||
property var _parent
|
property var _parent
|
||||||
property bool visible: true
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ import FluentUI
|
||||||
FluObject {
|
FluObject {
|
||||||
readonly property string key : FluTools.uuid()
|
readonly property string key : FluTools.uuid()
|
||||||
property int _idx
|
property int _idx
|
||||||
property bool visible: true
|
|
||||||
property string title
|
property string title
|
||||||
property var icon
|
property var icon
|
||||||
property bool disabled: false
|
property bool disabled: false
|
||||||
|
|
|
@ -5,7 +5,6 @@ import FluentUI
|
||||||
QtObject {
|
QtObject {
|
||||||
readonly property string key : FluTools.uuid()
|
readonly property string key : FluTools.uuid()
|
||||||
property int _idx
|
property int _idx
|
||||||
property bool visible: true
|
|
||||||
property string title
|
property string title
|
||||||
property var parent
|
property var parent
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ import FluentUI
|
||||||
QtObject {
|
QtObject {
|
||||||
readonly property string key : FluTools.uuid()
|
readonly property string key : FluTools.uuid()
|
||||||
property int _idx
|
property int _idx
|
||||||
property bool visible: true
|
|
||||||
property var parent
|
property var parent
|
||||||
property real spacing
|
property real spacing
|
||||||
property int size:1
|
property int size:1
|
||||||
|
|
Loading…
Reference in New Issue