diff --git a/example/App.qml b/example/App.qml index 67daac1..1734d3a 100644 --- a/example/App.qml +++ b/example/App.qml @@ -7,7 +7,7 @@ import FluentUI 1.0 Window { id:app - + color: "#00000000" Component.onCompleted: { FluApp.setAppWindow(app) FluApp.routes = { diff --git a/example/MainPage.qml b/example/MainPage.qml index 707fabe..b1cbefe 100644 --- a/example/MainPage.qml +++ b/example/MainPage.qml @@ -5,11 +5,15 @@ import QtQuick.Layouts 1.15 import QtGraphicalEffects 1.15 import FluentUI 1.0 -Rectangle { +FluWindow { id:rootwindow width: 800 height: 600 - color : "#F3F3F3" + + FluAppBar{ + id:appbar + title: "FluentUI" + } ListModel{ id:nav_items @@ -26,7 +30,7 @@ Rectangle { ListView{ id:nav_list anchors{ - top: parent.top + top: appbar.bottom bottom: parent.bottom topMargin: 20 bottomMargin: 20 @@ -75,13 +79,13 @@ Rectangle { } Rectangle{ - color: "#FFFFFF" + color: FluApp.isDark ? "#323232" : "#FFFFFF" radius: 10 clip: true anchors{ left: nav_list.right leftMargin: 2 - top: parent.top + top: appbar.bottom topMargin: 20 right: parent.right rightMargin: 10 @@ -89,7 +93,7 @@ Rectangle { bottomMargin: 20 } border.width: 1 - border.color: "#EEEEEE" + border.color: FluApp.isDark ? "#666666" : "#EEEEEE" Loader{ anchors.fill: parent diff --git a/example/SettingPage.qml b/example/SettingPage.qml index 568f325..7c62635 100644 --- a/example/SettingPage.qml +++ b/example/SettingPage.qml @@ -1,11 +1,14 @@ import QtQuick 2.15 import FluentUI 1.0 -Item { +FluWindow { width: 500 height: 500 + FluAppBar{ + id:appbar + } FluText{ text:"Display" diff --git a/example/T_Controls.qml b/example/T_Controls.qml index ee02072..c728b49 100644 --- a/example/T_Controls.qml +++ b/example/T_Controls.qml @@ -14,24 +14,23 @@ Item { fontStyle: FluText.TitleLarge } - - FluButton{ - Layout.topMargin: 20 + onClicked: { + FluApp.getWIdByWindow(Window.window) +// FluApp.navigate("/Setting") + } } FluFilledButton{ onClicked:{ FluApp.navigate("/Setting") - console.debug("FluFilledButton:"+Window.window.x) } } FluFilledButton{ disabled: true onClicked:{ - console.debug("FluFilledButton-disabled") } } @@ -39,7 +38,7 @@ Item { Component.onCompleted: { } - icon:FluentIcons.FA_android + icon:FluentIcons.FA_close } FluToggleSwitch{ diff --git a/example/example.pro b/example/example.pro index b77b477..a1d3a41 100644 --- a/example/example.pro +++ b/example/example.pro @@ -1,7 +1,6 @@ QT += quick CONFIG += c++11 - DEFINES += QT_DEPRECATED_WARNINGS QT_NO_WARNING_OUTPUT SOURCES += \ @@ -18,28 +17,28 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin #### 如果你正在使用静态库.a 那么你还需要将下面的配置注释取消掉。 #### 其它项目使用方法也是如此。 - DEFINES += STATICLIB +# DEFINES += STATICLIB - LIBNAME = FluentUI +# LIBNAME = FluentUI - CONFIG(debug, debug|release) { - contains(QMAKE_HOST.os,Windows) { - LIBNAME = FluentUI - }else{ - LIBNAME = FluentUI_debug - } - } +# CONFIG(debug, debug|release) { +# contains(QMAKE_HOST.os,Windows) { +# LIBNAME = FluentUId +# }else{ +# LIBNAME = FluentUI_debug +# } +# } - # Additional import path used to resolve QML modules in Qt Creator's code model - QML_IMPORT_PATH = $$OUT_PWD/../bin/ +# # Additional import path used to resolve QML modules in Qt Creator's code model +# QML_IMPORT_PATH = $$OUT_PWD/../bin/ - # Additional import path used to resolve QML modules just for Qt Quick Designer - QML_DESIGNER_IMPORT_PATH = $$OUT_PWD/../bin/ +# # Additional import path used to resolve QML modules just for Qt Quick Designer +# QML_DESIGNER_IMPORT_PATH = $$OUT_PWD/../bin/ - INCLUDEPATH += $$OUT_PWD/../bin/FluentUI/ - DEPENDPATH += $$OUT_PWD/../bin/FluentUI/ +# INCLUDEPATH += $$OUT_PWD/../bin/FluentUI/ +# DEPENDPATH += $$OUT_PWD/../bin/FluentUI/ - LIBS += -L$$OUT_PWD/../bin/FluentUI/ -l$${LIBNAME} +# LIBS += -L$$OUT_PWD/../bin/FluentUI/ -l$${LIBNAME} # PRE_TARGETDEPS += $$OUT_PWD/../bin/FluentUI/lib$${LIBNAME}.a ### 注意:静态库 .so .dylib .dll 是自动安装的Qt qml plugin目录中,不需要此步配置 diff --git a/example/main.cpp b/example/main.cpp index 65f0030..dd62784 100644 --- a/example/main.cpp +++ b/example/main.cpp @@ -7,12 +7,9 @@ int main(int argc, char *argv[]) { - QCoreApplication::setAttribute(Qt::AA_UseSoftwareOpenGL); -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +// qputenv("QSG_RENDER_LOOP","basic"); QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); -#endif QGuiApplication app(argc, argv); - QQmlApplicationEngine engine; #if defined(STATICLIB) FluentUI::create(&engine); diff --git a/src/FluApp.cpp b/src/FluApp.cpp index 86dcb0a..c5ca1f7 100644 --- a/src/FluApp.cpp +++ b/src/FluApp.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include "FramelessView.h" @@ -16,6 +17,13 @@ FluApp *FluApp::getInstance() return FluApp::m_instance; } +FluApp::FluApp(QObject *parent) + : QObject{parent} +{ + isDark(true); +} + + void FluApp::setAppWindow(QWindow *window){ appWindow = window; @@ -28,29 +36,37 @@ void FluApp::run(){ } FramelessView *view = new FramelessView(); view->engine()->rootContext()->setContextProperty("FluApp",FluApp::getInstance()); + view->setColor(QColor(255,0,0,1)); const QUrl url(routes().value(initialRoute()).toString()); QObject::connect(view, &QQuickView::statusChanged, view, [&](QQuickView::Status status) { if (status == QQuickView::Status::Ready) { + qDebug()<<"-----------winId:"<winId(); } }); QObject::connect(view->engine(), &QQmlEngine::quit, qApp, &QCoreApplication::quit); QObject::connect(qApp, &QGuiApplication::aboutToQuit, qApp, [&view](){view->setSource({});}); +// view->setTitle("FluentUI"); view->setSource(url); view->moveToScreenCenter(); view->show(); } void FluApp::navigate(const QString& route){ - qDebug()<<"开始路由跳转->"<engine()->rootContext()->setContextProperty("FluApp",FluApp::getInstance()); + view->setColor(isDark() ? QColor(0,0,0,1) : QColor(255, 255, 255, 1)); view->setSource((routes().value(route).toString())); view->closeDeleteLater(); view->moveToScreenCenter(); view->show(); } + +void FluApp::getWIdByWindow(QWindow *window){ + qDebug()<< window->winId(); + window->winId(); +} diff --git a/src/FluApp.h b/src/FluApp.h index 2facdee..b460ae2 100644 --- a/src/FluApp.h +++ b/src/FluApp.h @@ -10,17 +10,22 @@ class FluApp : public QObject { Q_OBJECT Q_PROPERTY_AUTO(QString,initialRoute); + Q_PROPERTY_AUTO(bool,isDark); Q_PROPERTY_AUTO(QJsonObject,routes); public: static FluApp *getInstance(); + explicit FluApp(QObject *parent = nullptr); + Q_INVOKABLE void run(); Q_INVOKABLE void navigate(const QString& route); Q_INVOKABLE void setAppWindow(QWindow *window); + Q_INVOKABLE void getWIdByWindow(QWindow *window); + private: static FluApp* m_instance; QWindow *appWindow; diff --git a/src/Fluent.cpp b/src/Fluent.cpp index fa039dc..91996c6 100644 --- a/src/Fluent.cpp +++ b/src/Fluent.cpp @@ -4,6 +4,7 @@ #include #include #include +#include "WindowHelper.h" #include "FluApp.h" #include "Def.h" @@ -27,6 +28,12 @@ void Fluent::registerTypes(const char *uri){ int major = 1; int minor = 0; + qmlRegisterType(uri,major,minor,"WindowHelper"); + + qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluWindow.qml"),uri,major,minor,"FluWindow"); + qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluRectangle.qml"),uri,major,minor,"FluRectangle"); + qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluAppBar.qml"),uri,major,minor,"FluAppBar"); + qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluAppBar.qml"),uri,major,minor,"FluAppBar"); qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluButton.qml"),uri,major,minor,"FluButton"); qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluCheckBox.qml"),uri,major,minor,"FluCheckBox"); qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluComboBox.qml"),uri,major,minor,"FluComboBox"); diff --git a/src/FluentUI.pro b/src/FluentUI.pro index fb2e7c8..717ea49 100644 --- a/src/FluentUI.pro +++ b/src/FluentUI.pro @@ -6,7 +6,7 @@ TARGET = $$qtLibraryTarget($$TARGET) uri = FluentUI ########################################## -CONFIG += staticlib # staticlib or sharedlib +CONFIG += sharedlib # staticlib or sharedlib #** 多次切换编译构建模式,建议先清理缓存。项目右键->清理 #*[staticlib] 构建静态库.a @@ -29,6 +29,7 @@ HEADERS += \ Fluent.h \ FluentUI.h \ FramelessView.h \ + WindowHelper.h \ qml_plugin.h \ stdafx.h @@ -38,6 +39,7 @@ SOURCES += \ FluApp.cpp \ Fluent.cpp \ FluentUI.cpp \ + WindowHelper.cpp \ qml_plugin.cpp \ win32 { diff --git a/src/FramelessView_win.cpp b/src/FramelessView_win.cpp index 31f981f..1226915 100644 --- a/src/FramelessView_win.cpp +++ b/src/FramelessView_win.cpp @@ -177,7 +177,6 @@ void FramelessView::showEvent(QShowEvent* e) } FramelessView::~FramelessView() { - qInfo()<<"FramelessView析构了"; if (d->mMenuHandler != NULL) { ::DestroyMenu(d->mMenuHandler); diff --git a/src/WindowHelper.cpp b/src/WindowHelper.cpp new file mode 100644 index 0000000..b185906 --- /dev/null +++ b/src/WindowHelper.cpp @@ -0,0 +1,27 @@ +#include "WindowHelper.h" + +WindowHelper::WindowHelper(QObject *parent) + : QObject{parent} +{ + +} + +void WindowHelper::classBegin() +{ +} + +void WindowHelper::componentComplete() +{ + + auto rootItem = qobject_cast(parent()); + if (auto window = rootItem->window()) + { + this->window = window; + this->window->setTitle("FluentUI"); + qDebug()<<"--------->--------->"; + } +} + +void WindowHelper::setTitle(const QString& text){ + window->setTitle(text); +} diff --git a/src/WindowHelper.h b/src/WindowHelper.h new file mode 100644 index 0000000..a9f77c7 --- /dev/null +++ b/src/WindowHelper.h @@ -0,0 +1,24 @@ +#ifndef WINDOWHELPER_H +#define WINDOWHELPER_H + +#include +#include +#include + +class WindowHelper : public QObject, public QQmlParserStatus +{ + Q_OBJECT + +public: + explicit WindowHelper(QObject *parent = nullptr); + void classBegin() override; + void componentComplete() override; + + Q_INVOKABLE void setTitle(const QString& text); +private: + + QQuickWindow* window; + +}; + +#endif // WINDOWHELPER_H diff --git a/src/build-preset/plugin.qmltypes b/src/build-preset/plugin.qmltypes deleted file mode 100644 index e69de29..0000000 diff --git a/src/build-preset/plugins.qmltypes b/src/build-preset/plugins.qmltypes new file mode 100644 index 0000000..3cbfa74 --- /dev/null +++ b/src/build-preset/plugins.qmltypes @@ -0,0 +1,1048 @@ +import QtQuick.tooling 1.2 + +// This file describes the plugin-supplied types contained in the library. +// It is used for QML tooling purposes only. +// +// This file was auto-generated by: +// 'qmlplugindump -nonrelocatable FluentUI 1.0 .\' + +Module { + dependencies: ["QtQuick 2.0"] + Component { + name: "Fluent_Awesome" + exports: ["FluentUI/FluentIcons 1.0"] + isCreatable: false + exportMetaObjectRevisions: [0] + Enum { + name: "Fluent_AwesomeType" + values: { + "FA_glass": 61440, + "FA_music": 61441, + "FA_search": 61442, + "FA_envelope_o": 61443, + "FA_heart": 61444, + "FA_star": 61445, + "FA_star_o": 61446, + "FA_user": 61447, + "FA_film": 61448, + "FA_th_large": 61449, + "FA_th": 61450, + "FA_th_list": 61451, + "FA_check": 61452, + "FA_remove": 61453, + "FA_close": 61453, + "FA_times": 61453, + "FA_search_plus": 61454, + "FA_search_minus": 61456, + "FA_power_off": 61457, + "FA_signal": 61458, + "FA_gear": 61459, + "FA_cog": 61459, + "FA_trash_o": 61460, + "FA_home": 61461, + "FA_file_o": 61462, + "FA_clock_o": 61463, + "FA_road": 61464, + "FA_download": 61465, + "FA_arrow_circle_o_down": 61466, + "FA_arrow_circle_o_up": 61467, + "FA_inbox": 61468, + "FA_play_circle_o": 61469, + "FA_rotate_right": 61470, + "FA_repeat": 61470, + "FA_refresh": 61473, + "FA_list_alt": 61474, + "FA_lock": 61475, + "FA_flag": 61476, + "FA_headphones": 61477, + "FA_volume_off": 61478, + "FA_volume_down": 61479, + "FA_volume_up": 61480, + "FA_qrcode": 61481, + "FA_barcode": 61482, + "FA_tag": 61483, + "FA_tags": 61484, + "FA_book": 61485, + "FA_bookmark": 61486, + "FA_print": 61487, + "FA_camera": 61488, + "FA_font": 61489, + "FA_bold": 61490, + "FA_italic": 61491, + "FA_text_height": 61492, + "FA_text_width": 61493, + "FA_align_left": 61494, + "FA_align_center": 61495, + "FA_align_right": 61496, + "FA_align_justify": 61497, + "FA_list": 61498, + "FA_dedent": 61499, + "FA_outdent": 61499, + "FA_indent": 61500, + "FA_video_camera": 61501, + "FA_photo": 61502, + "FA_image": 61502, + "FA_picture_o": 61502, + "FA_pencil": 61504, + "FA_map_marker": 61505, + "FA_adjust": 61506, + "FA_tint": 61507, + "FA_edit": 61508, + "FA_pencil_square_o": 61508, + "FA_share_square_o": 61509, + "FA_check_square_o": 61510, + "FA_arrows": 61511, + "FA_step_backward": 61512, + "FA_fast_backward": 61513, + "FA_backward": 61514, + "FA_play": 61515, + "FA_pause": 61516, + "FA_stop": 61517, + "FA_forward": 61518, + "FA_fast_forward": 61520, + "FA_step_forward": 61521, + "FA_eject": 61522, + "FA_chevron_left": 61523, + "FA_chevron_right": 61524, + "FA_plus_circle": 61525, + "FA_minus_circle": 61526, + "FA_times_circle": 61527, + "FA_check_circle": 61528, + "FA_question_circle": 61529, + "FA_info_circle": 61530, + "FA_crosshairs": 61531, + "FA_times_circle_o": 61532, + "FA_check_circle_o": 61533, + "FA_ban": 61534, + "FA_arrow_left": 61536, + "FA_arrow_right": 61537, + "FA_arrow_up": 61538, + "FA_arrow_down": 61539, + "FA_mail_forward": 61540, + "FA_share": 61540, + "FA_expand": 61541, + "FA_compress": 61542, + "FA_plus": 61543, + "FA_minus": 61544, + "FA_asterisk": 61545, + "FA_exclamation_circle": 61546, + "FA_gift": 61547, + "FA_leaf": 61548, + "FA_fire": 61549, + "FA_eye": 61550, + "FA_eye_slash": 61552, + "FA_warning": 61553, + "FA_exclamation_triangle": 61553, + "FA_plane": 61554, + "FA_calendar": 61555, + "FA_random": 61556, + "FA_comment": 61557, + "FA_magnet": 61558, + "FA_chevron_up": 61559, + "FA_chevron_down": 61560, + "FA_retweet": 61561, + "FA_shopping_cart": 61562, + "FA_folder": 61563, + "FA_folder_open": 61564, + "FA_arrows_v": 61565, + "FA_arrows_h": 61566, + "FA_bar_chart_o": 61568, + "FA_bar_chart": 61568, + "FA_twitter_square": 61569, + "FA_facebook_square": 61570, + "FA_camera_retro": 61571, + "FA_key": 61572, + "FA_gears": 61573, + "FA_cogs": 61573, + "FA_comments": 61574, + "FA_thumbs_o_up": 61575, + "FA_thumbs_o_down": 61576, + "FA_star_half": 61577, + "FA_heart_o": 61578, + "FA_sign_out": 61579, + "FA_linkedin_square": 61580, + "FA_thumb_tack": 61581, + "FA_external_link": 61582, + "FA_sign_in": 61584, + "FA_trophy": 61585, + "FA_github_square": 61586, + "FA_upload": 61587, + "FA_lemon_o": 61588, + "FA_phone": 61589, + "FA_square_o": 61590, + "FA_bookmark_o": 61591, + "FA_phone_square": 61592, + "FA_twitter": 61593, + "FA_facebook_f": 61594, + "FA_facebook": 61594, + "FA_github": 61595, + "FA_unlock": 61596, + "FA_credit_card": 61597, + "FA_feed": 61598, + "FA_rss": 61598, + "FA_hdd_o": 61600, + "FA_bullhorn": 61601, + "FA_bell": 61683, + "FA_certificate": 61603, + "FA_hand_o_right": 61604, + "FA_hand_o_left": 61605, + "FA_hand_o_up": 61606, + "FA_hand_o_down": 61607, + "FA_arrow_circle_left": 61608, + "FA_arrow_circle_right": 61609, + "FA_arrow_circle_up": 61610, + "FA_arrow_circle_down": 61611, + "FA_globe": 61612, + "FA_wrench": 61613, + "FA_tasks": 61614, + "FA_filter": 61616, + "FA_briefcase": 61617, + "FA_arrows_alt": 61618, + "FA_group": 61632, + "FA_users": 61632, + "FA_chain": 61633, + "FA_link": 61633, + "FA_cloud": 61634, + "FA_flask": 61635, + "FA_cut": 61636, + "FA_scissors": 61636, + "FA_copy": 61637, + "FA_files_o": 61637, + "FA_paperclip": 61638, + "FA_save": 61639, + "FA_floppy_o": 61639, + "FA_square": 61640, + "FA_navicon": 61641, + "FA_reorder": 61641, + "FA_bars": 61641, + "FA_list_ul": 61642, + "FA_list_ol": 61643, + "FA_strikethrough": 61644, + "FA_underline": 61645, + "FA_table": 61646, + "FA_magic": 61648, + "FA_truck": 61649, + "FA_pinterest": 61650, + "FA_pinterest_square": 61651, + "FA_google_plus_square": 61652, + "FA_google_plus": 61653, + "FA_money": 61654, + "FA_caret_down": 61655, + "FA_caret_up": 61656, + "FA_caret_left": 61657, + "FA_caret_right": 61658, + "FA_columns": 61659, + "FA_unsorted": 61660, + "FA_sort": 61660, + "FA_sort_down": 61661, + "FA_sort_desc": 61661, + "FA_sort_up": 61662, + "FA_sort_asc": 61662, + "FA_envelope": 61664, + "FA_linkedin": 61665, + "FA_rotate_left": 61666, + "FA_undo": 61666, + "FA_legal": 61667, + "FA_gavel": 61667, + "FA_dashboard": 61668, + "FA_tachometer": 61668, + "FA_comment_o": 61669, + "FA_comments_o": 61670, + "FA_flash": 61671, + "FA_bolt": 61671, + "FA_sitemap": 61672, + "FA_umbrella": 61673, + "FA_paste": 61674, + "FA_clipboard": 61674, + "FA_lightbulb_o": 61675, + "FA_exchange": 61676, + "FA_cloud_download": 61677, + "FA_cloud_upload": 61678, + "FA_user_md": 61680, + "FA_stethoscope": 61681, + "FA_suitcase": 61682, + "FA_bell_o": 61602, + "FA_coffee": 61684, + "FA_cutlery": 61685, + "FA_file_text_o": 61686, + "FA_building_o": 61687, + "FA_hospital_o": 61688, + "FA_ambulance": 61689, + "FA_medkit": 61690, + "FA_fighter_jet": 61691, + "FA_beer": 61692, + "FA_h_square": 61693, + "FA_plus_square": 61694, + "FA_angle_double_left": 61696, + "FA_angle_double_right": 61697, + "FA_angle_double_up": 61698, + "FA_angle_double_down": 61699, + "FA_angle_left": 61700, + "FA_angle_right": 61701, + "FA_angle_up": 61702, + "FA_angle_down": 61703, + "FA_desktop": 61704, + "FA_laptop": 61705, + "FA_tablet": 61706, + "FA_mobile_phone": 61707, + "FA_mobile": 61707, + "FA_circle_o": 61708, + "FA_quote_left": 61709, + "FA_quote_right": 61710, + "FA_spinner": 61712, + "FA_circle": 61713, + "FA_mail_reply": 61714, + "FA_reply": 61714, + "FA_github_alt": 61715, + "FA_folder_o": 61716, + "FA_folder_open_o": 61717, + "FA_smile_o": 61720, + "FA_frown_o": 61721, + "FA_meh_o": 61722, + "FA_gamepad": 61723, + "FA_keyboard_o": 61724, + "FA_flag_o": 61725, + "FA_flag_checkered": 61726, + "FA_terminal": 61728, + "FA_code": 61729, + "FA_mail_reply_all": 61730, + "FA_reply_all": 61730, + "FA_star_half_empty": 61731, + "FA_star_half_full": 61731, + "FA_star_half_o": 61731, + "FA_location_arrow": 61732, + "FA_crop": 61733, + "FA_code_fork": 61734, + "FA_unlink": 61735, + "FA_chain_broken": 61735, + "FA_question": 61736, + "FA_info": 61737, + "FA_exclamation": 61738, + "FA_superscript": 61739, + "FA_subscript": 61740, + "FA_eraser": 61741, + "FA_puzzle_piece": 61742, + "FA_microphone": 61744, + "FA_microphone_slash": 61745, + "FA_shield": 61746, + "FA_calendar_o": 61747, + "FA_fire_extinguisher": 61748, + "FA_rocket": 61749, + "FA_maxcdn": 61750, + "FA_chevron_circle_left": 61751, + "FA_chevron_circle_right": 61752, + "FA_chevron_circle_up": 61753, + "FA_chevron_circle_down": 61754, + "FA_html5": 61755, + "FA_css3": 61756, + "FA_anchor": 61757, + "FA_unlock_alt": 61758, + "FA_bullseye": 61760, + "FA_ellipsis_h": 61761, + "FA_ellipsis_v": 61762, + "FA_rss_square": 61763, + "FA_play_circle": 61764, + "FA_ticket": 61765, + "FA_minus_square": 61766, + "FA_minus_square_o": 61767, + "FA_level_up": 61768, + "FA_level_down": 61769, + "FA_check_square": 61770, + "FA_pencil_square": 61771, + "FA_external_link_square": 61772, + "FA_share_square": 61773, + "FA_compass": 61774, + "FA_toggle_down": 61776, + "FA_caret_square_o_down": 61776, + "FA_toggle_up": 61777, + "FA_caret_square_o_up": 61777, + "FA_toggle_right": 61778, + "FA_caret_square_o_right": 61778, + "FA_euro": 61779, + "FA_eur": 61779, + "FA_gbp": 61780, + "FA_dollar": 61781, + "FA_usd": 61781, + "FA_rupee": 61782, + "FA_inr": 61782, + "FA_cny": 61783, + "FA_rmb": 61783, + "FA_yen": 61783, + "FA_jpy": 61783, + "FA_ruble": 61784, + "FA_rouble": 61784, + "FA_rub": 61784, + "FA_won": 61785, + "FA_krw": 61785, + "FA_bitcoin": 61786, + "FA_btc": 61786, + "FA_file": 61787, + "FA_file_text": 61788, + "FA_sort_alpha_asc": 61789, + "FA_sort_alpha_desc": 61790, + "FA_sort_amount_asc": 61792, + "FA_sort_amount_desc": 61793, + "FA_sort_numeric_asc": 61794, + "FA_sort_numeric_desc": 61795, + "FA_thumbs_up": 61796, + "FA_thumbs_down": 61797, + "FA_youtube_square": 61798, + "FA_youtube": 61799, + "FA_xing": 61800, + "FA_xing_square": 61801, + "FA_youtube_play": 61802, + "FA_dropbox": 61803, + "FA_stack_overflow": 61804, + "FA_instagram": 61805, + "FA_flickr": 61806, + "FA_adn": 61808, + "FA_bitbucket": 61809, + "FA_bitbucket_square": 61810, + "FA_tumblr": 61811, + "FA_tumblr_square": 61812, + "FA_long_arrow_down": 61813, + "FA_long_arrow_up": 61814, + "FA_long_arrow_left": 61815, + "FA_long_arrow_right": 61816, + "FA_apple": 61817, + "FA_windows": 61818, + "FA_android": 61819, + "FA_linux": 61820, + "FA_dribbble": 61821, + "FA_skype": 61822, + "FA_foursquare": 61824, + "FA_trello": 61825, + "FA_female": 61826, + "FA_male": 61827, + "FA_gittip": 61828, + "FA_gratipay": 61828, + "FA_sun_o": 61829, + "FA_moon_o": 61830, + "FA_archive": 61831, + "FA_bug": 61832, + "FA_vk": 61833, + "FA_weibo": 61834, + "FA_renren": 61835, + "FA_pagelines": 61836, + "FA_stack_exchange": 61837, + "FA_arrow_circle_o_right": 61838, + "FA_arrow_circle_o_left": 61840, + "FA_toggle_left": 61841, + "FA_caret_square_o_left": 61841, + "FA_dot_circle_o": 61842, + "FA_wheelchair": 61843, + "FA_vimeo_square": 61844, + "FA_turkish_lira": 61845, + "FA_try": 61845, + "FA_plus_square_o": 61846, + "FA_space_shuttle": 61847, + "FA_slack": 61848, + "FA_envelope_square": 61849, + "FA_wordpress": 61850, + "FA_openid": 61851, + "FA_institution": 61852, + "FA_bank": 61852, + "FA_university": 61852, + "FA_mortar_board": 61853, + "FA_graduation_cap": 61853, + "FA_yahoo": 61854, + "FA_google": 61856, + "FA_reddit": 61857, + "FA_reddit_square": 61858, + "FA_stumbleupon_circle": 61859, + "FA_stumbleupon": 61860, + "FA_delicious": 61861, + "FA_digg": 61862, + "FA_pied_piper_pp": 61863, + "FA_pied_piper_alt": 61864, + "FA_drupal": 61865, + "FA_joomla": 61866, + "FA_language": 61867, + "FA_fax": 61868, + "FA_building": 61869, + "FA_child": 61870, + "FA_paw": 61872, + "FA_spoon": 61873, + "FA_cube": 61874, + "FA_cubes": 61875, + "FA_behance": 61876, + "FA_behance_square": 61877, + "FA_steam": 61878, + "FA_steam_square": 61879, + "FA_recycle": 61880, + "FA_automobile": 61881, + "FA_car": 61881, + "FA_cab": 61882, + "FA_taxi": 61882, + "FA_tree": 61883, + "FA_spotify": 61884, + "FA_deviantart": 61885, + "FA_soundcloud": 61886, + "FA_database": 61888, + "FA_file_pdf_o": 61889, + "FA_file_word_o": 61890, + "FA_file_excel_o": 61891, + "FA_file_powerpoint_o": 61892, + "FA_file_photo_o": 61893, + "FA_file_picture_o": 61893, + "FA_file_image_o": 61893, + "FA_file_zip_o": 61894, + "FA_file_archive_o": 61894, + "FA_file_sound_o": 61895, + "FA_file_audio_o": 61895, + "FA_file_movie_o": 61896, + "FA_file_video_o": 61896, + "FA_file_code_o": 61897, + "FA_vine": 61898, + "FA_codepen": 61899, + "FA_jsfiddle": 61900, + "FA_life_bouy": 61901, + "FA_life_buoy": 61901, + "FA_life_saver": 61901, + "FA_support": 61901, + "FA_life_ring": 61901, + "FA_circle_o_notch": 61902, + "FA_ra": 61904, + "FA_resistance": 61904, + "FA_rebel": 61904, + "FA_ge": 61905, + "FA_empire": 61905, + "FA_git_square": 61906, + "FA_git": 61907, + "FA_y_combinator_square": 61908, + "FA_yc_square": 61908, + "FA_hacker_news": 61908, + "FA_tencent_weibo": 61909, + "FA_qq": 61910, + "FA_wechat": 61911, + "FA_weixin": 61911, + "FA_send": 61912, + "FA_paper_plane": 61912, + "FA_send_o": 61913, + "FA_paper_plane_o": 61913, + "FA_history": 61914, + "FA_circle_thin": 61915, + "FA_header": 61916, + "FA_paragraph": 61917, + "FA_sliders": 61918, + "FA_share_alt": 61920, + "FA_share_alt_square": 61921, + "FA_bomb": 61922, + "FA_soccer_ball_o": 61923, + "FA_futbol_o": 61923, + "FA_tty": 61924, + "FA_binoculars": 61925, + "FA_plug": 61926, + "FA_slideshare": 61927, + "FA_twitch": 61928, + "FA_yelp": 61929, + "FA_newspaper_o": 61930, + "FA_wifi": 61931, + "FA_calculator": 61932, + "FA_paypal": 61933, + "FA_google_wallet": 61934, + "FA_cc_visa": 61936, + "FA_cc_mastercard": 61937, + "FA_cc_discover": 61938, + "FA_cc_amex": 61939, + "FA_cc_paypal": 61940, + "FA_cc_stripe": 61941, + "FA_bell_slash": 61942, + "FA_bell_slash_o": 61943, + "FA_trash": 61944, + "FA_copyright": 61945, + "FA_at": 61946, + "FA_eyedropper": 61947, + "FA_paint_brush": 61948, + "FA_birthday_cake": 61949, + "FA_area_chart": 61950, + "FA_pie_chart": 61952, + "FA_line_chart": 61953, + "FA_lastfm": 61954, + "FA_lastfm_square": 61955, + "FA_toggle_off": 61956, + "FA_toggle_on": 61957, + "FA_bicycle": 61958, + "FA_bus": 61959, + "FA_ioxhost": 61960, + "FA_angellist": 61961, + "FA_cc": 61962, + "FA_shekel": 61963, + "FA_sheqel": 61963, + "FA_ils": 61963, + "FA_meanpath": 61964, + "FA_buysellads": 61965, + "FA_connectdevelop": 61966, + "FA_dashcube": 61968, + "FA_forumbee": 61969, + "FA_leanpub": 61970, + "FA_sellsy": 61971, + "FA_shirtsinbulk": 61972, + "FA_simplybuilt": 61973, + "FA_skyatlas": 61974, + "FA_cart_plus": 61975, + "FA_cart_arrow_down": 61976, + "FA_diamond": 61977, + "FA_ship": 61978, + "FA_user_secret": 61979, + "FA_motorcycle": 61980, + "FA_street_view": 61981, + "FA_heartbeat": 61982, + "FA_venus": 61985, + "FA_mars": 61986, + "FA_mercury": 61987, + "FA_intersex": 61988, + "FA_transgender": 61988, + "FA_transgender_alt": 61989, + "FA_venus_double": 61990, + "FA_mars_double": 61991, + "FA_venus_mars": 61992, + "FA_mars_stroke": 61993, + "FA_mars_stroke_v": 61994, + "FA_mars_stroke_h": 61995, + "FA_neuter": 61996, + "FA_genderless": 61997, + "FA_facebook_official": 62000, + "FA_pinterest_p": 62001, + "FA_whatsapp": 62002, + "FA_server": 62003, + "FA_user_plus": 62004, + "FA_user_times": 62005, + "FA_hotel": 62006, + "FA_bed": 62006, + "FA_viacoin": 62007, + "FA_train": 62008, + "FA_subway": 62009, + "FA_medium": 62010, + "FA_yc": 62011, + "FA_y_combinator": 62011, + "FA_optin_monster": 62012, + "FA_opencart": 62013, + "FA_expeditedssl": 62014, + "FA_battery_4": 62016, + "FA_battery": 62016, + "FA_battery_full": 62016, + "FA_battery_3": 62017, + "FA_battery_three_quarters": 62017, + "FA_battery_2": 62018, + "FA_battery_half": 62018, + "FA_battery_1": 62019, + "FA_battery_quarter": 62019, + "FA_battery_0": 62020, + "FA_battery_empty": 62020, + "FA_mouse_pointer": 62021, + "FA_i_cursor": 62022, + "FA_object_group": 62023, + "FA_object_ungroup": 62024, + "FA_sticky_note": 62025, + "FA_sticky_note_o": 62026, + "FA_cc_jcb": 62027, + "FA_cc_diners_club": 62028, + "FA_clone": 62029, + "FA_balance_scale": 62030, + "FA_hourglass_o": 62032, + "FA_hourglass_1": 62033, + "FA_hourglass_start": 62033, + "FA_hourglass_2": 62034, + "FA_hourglass_half": 62034, + "FA_hourglass_3": 62035, + "FA_hourglass_end": 62035, + "FA_hourglass": 62036, + "FA_hand_grab_o": 62037, + "FA_hand_rock_o": 62037, + "FA_hand_stop_o": 62038, + "FA_hand_paper_o": 62038, + "FA_hand_scissors_o": 62039, + "FA_hand_lizard_o": 62040, + "FA_hand_spock_o": 62041, + "FA_hand_pointer_o": 62042, + "FA_hand_peace_o": 62043, + "FA_trademark": 62044, + "FA_registered": 62045, + "FA_creative_commons": 62046, + "FA_gg": 62048, + "FA_gg_circle": 62049, + "FA_tripadvisor": 62050, + "FA_odnoklassniki": 62051, + "FA_odnoklassniki_square": 62052, + "FA_get_pocket": 62053, + "FA_wikipedia_w": 62054, + "FA_safari": 62055, + "FA_chrome": 62056, + "FA_firefox": 62057, + "FA_opera": 62058, + "FA_internet_explorer": 62059, + "FA_tv": 62060, + "FA_television": 62060, + "FA_contao": 62061, + "FA_amazon": 62064, + "FA_calendar_plus_o": 62065, + "FA_calendar_minus_o": 62066, + "FA_calendar_times_o": 62067, + "FA_calendar_check_o": 62068, + "FA_industry": 62069, + "FA_map_pin": 62070, + "FA_map_signs": 62071, + "FA_map_o": 62072, + "FA_map": 62073, + "FA_commenting": 62074, + "FA_commenting_o": 62075, + "FA_houzz": 62076, + "FA_vimeo": 62077, + "FA_black_tie": 62078, + "FA_fonticons": 62080, + "FA_reddit_alien": 62081, + "FA_edge": 62082, + "FA_credit_card_alt": 62083, + "FA_codiepie": 62084, + "FA_modx": 62085, + "FA_fort_awesome": 62086, + "FA_usb": 62087, + "FA_product_hunt": 62088, + "FA_mixcloud": 62089, + "FA_scribd": 62090, + "FA_pause_circle": 62091, + "FA_pause_circle_o": 62092, + "FA_stop_circle": 62093, + "FA_stop_circle_o": 62094, + "FA_shopping_bag": 62096, + "FA_shopping_basket": 62097, + "FA_hashtag": 62098, + "FA_bluetooth": 62099, + "FA_bluetooth_b": 62100, + "FA_percent": 62101, + "FA_gitlab": 62102, + "FA_wpbeginner": 62103, + "FA_wpforms": 62104, + "FA_envira": 62105, + "FA_universal_access": 62106, + "FA_wheelchair_alt": 62107, + "FA_question_circle_o": 62108, + "FA_blind": 62109, + "FA_audio_description": 62110, + "FA_volume_control_phone": 62112, + "FA_braille": 62113, + "FA_assistive_listening_systems": 62114, + "FA_asl_interpreting": 62115, + "FA_american_sign_language_interpreting": 62115, + "FA_deafness": 62116, + "FA_hard_of_hearing": 62116, + "FA_deaf": 62116, + "FA_glide": 62117, + "FA_glide_g": 62118, + "FA_signing": 62119, + "FA_sign_language": 62119, + "FA_low_vision": 62120, + "FA_viadeo": 62121, + "FA_viadeo_square": 62122, + "FA_snapchat": 62123, + "FA_snapchat_ghost": 62124, + "FA_snapchat_square": 62125, + "FA_pied_piper": 62126, + "FA_first_order": 62128, + "FA_yoast": 62129, + "FA_themeisle": 62130, + "FA_google_plus_circle": 62131, + "FA_google_plus_official": 62131, + "FA_fa": 62132, + "FA_font_awesome": 62132, + "FA_handshake_o": 62133, + "FA_envelope_open": 62134, + "FA_envelope_open_o": 62135, + "FA_linode": 62136, + "FA_address_book": 62137, + "FA_address_book_o": 62138, + "FA_vcard": 62139, + "FA_address_card": 62139, + "FA_vcard_o": 62140, + "FA_address_card_o": 62140, + "FA_user_circle": 62141, + "FA_user_circle_o": 62142, + "FA_user_o": 62144, + "FA_id_badge": 62145, + "FA_drivers_license": 62146, + "FA_id_card": 62146, + "FA_drivers_license_o": 62147, + "FA_id_card_o": 62147, + "FA_quora": 62148, + "FA_free_code_camp": 62149, + "FA_telegram": 62150, + "FA_thermometer_4": 62151, + "FA_thermometer": 62151, + "FA_thermometer_full": 62151, + "FA_thermometer_3": 62152, + "FA_thermometer_three_quarters": 62152, + "FA_thermometer_2": 62153, + "FA_thermometer_half": 62153, + "FA_thermometer_1": 62154, + "FA_thermometer_quarter": 62154, + "FA_thermometer_0": 62155, + "FA_thermometer_empty": 62155, + "FA_shower": 62156, + "FA_bathtub": 62157, + "FA_s15": 62157, + "FA_bath": 62157, + "FA_podcast": 62158, + "FA_window_maximize": 62160, + "FA_window_minimize": 62161, + "FA_window_restore": 62162, + "FA_times_rectangle": 62163, + "FA_window_close": 62163, + "FA_times_rectangle_o": 62164, + "FA_window_close_o": 62164, + "FA_bandcamp": 62165, + "FA_grav": 62166, + "FA_etsy": 62167, + "FA_imdb": 62168, + "FA_ravelry": 62169, + "FA_eercast": 62170, + "FA_microchip": 62171, + "FA_snowflake_o": 62172, + "FA_superpowers": 62173, + "FA_wpexplorer": 62174, + "FA_meetup": 62176 + } + } + } + Component { + name: "WindowHelper" + prototype: "QObject" + exports: ["FluentUI/WindowHelper 1.0"] + exportMetaObjectRevisions: [0] + Method { + name: "setTitle" + Parameter { name: "text"; type: "string" } + } + } + Component { + prototype: "QQuickRectangle" + name: "FluentUI/FluAppBar 1.0" + exports: ["FluentUI/FluAppBar 1.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + Property { name: "title"; type: "string" } + Method { name: "toggleMaximized"; type: "QVariant" } + } + Component { + prototype: "QQuickRectangle" + name: "FluentUI/FluAppBar 1.0" + exports: ["FluentUI/FluAppBar 1.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + Property { name: "title"; type: "string" } + Method { name: "toggleMaximized"; type: "QVariant" } + } + Component { + prototype: "QQuickRectangle" + name: "FluentUI/FluAppBar 1.0" + exports: ["FluentUI/FluAppBar 1.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + Property { name: "title"; type: "string" } + Method { name: "toggleMaximized"; type: "QVariant" } + } + Component { + prototype: "QQuickRectangle" + name: "FluentUI/FluButton 1.0" + exports: ["FluentUI/FluButton 1.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + Property { name: "startPadding"; type: "int" } + Property { name: "endPadding"; type: "int" } + Property { name: "topPadding"; type: "int" } + Property { name: "bottomPadding"; type: "int" } + Property { name: "disabled"; type: "bool" } + Property { name: "primaryColor"; type: "QColor" } + Signal { name: "clicked" } + } + Component { + prototype: "QQuickItem" + name: "FluentUI/FluCheckBox 1.0" + exports: ["FluentUI/FluCheckBox 1.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickItem" + name: "FluentUI/FluComboBox 1.0" + exports: ["FluentUI/FluComboBox 1.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickItem" + name: "FluentUI/FluDropDownButton 1.0" + exports: ["FluentUI/FluDropDownButton 1.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickRectangle" + name: "FluentUI/FluFilledButton 1.0" + exports: ["FluentUI/FluFilledButton 1.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + Property { name: "startPadding"; type: "int" } + Property { name: "endPadding"; type: "int" } + Property { name: "topPadding"; type: "int" } + Property { name: "bottomPadding"; type: "int" } + Property { name: "disabled"; type: "bool" } + Property { name: "primaryColor"; type: "QColor" } + Signal { name: "clicked" } + } + Component { + prototype: "QQuickRectangle" + name: "FluentUI/FluFilledButton 1.0" + exports: ["FluentUI/FluFilledButton 1.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + Property { name: "startPadding"; type: "int" } + Property { name: "endPadding"; type: "int" } + Property { name: "topPadding"; type: "int" } + Property { name: "bottomPadding"; type: "int" } + Property { name: "disabled"; type: "bool" } + Property { name: "primaryColor"; type: "QColor" } + Signal { name: "clicked" } + } + Component { + prototype: "QQuickRectangle" + name: "FluentUI/FluFilledButton 1.0" + exports: ["FluentUI/FluFilledButton 1.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + Property { name: "startPadding"; type: "int" } + Property { name: "endPadding"; type: "int" } + Property { name: "topPadding"; type: "int" } + Property { name: "bottomPadding"; type: "int" } + Property { name: "disabled"; type: "bool" } + Property { name: "primaryColor"; type: "QColor" } + Signal { name: "clicked" } + } + Component { + prototype: "QQuickRectangle" + name: "FluentUI/FluIconButton 1.0" + exports: ["FluentUI/FluIconButton 1.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + Property { name: "iconSize"; type: "int" } + Property { name: "icon"; type: "int" } + Property { name: "iconColor"; type: "QColor" } + Signal { name: "clicked" } + } + Component { + prototype: "QQuickItem" + name: "FluentUI/FluProgressBar 1.0" + exports: ["FluentUI/FluProgressBar 1.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickItem" + name: "FluentUI/FluProgressRing 1.0" + exports: ["FluentUI/FluProgressRing 1.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickItem" + name: "FluentUI/FluRadioButton 1.0" + exports: ["FluentUI/FluRadioButton 1.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickItem" + name: "FluentUI/FluRectangle 1.0" + exports: ["FluentUI/FluRectangle 1.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickItem" + name: "FluentUI/FluSlider 1.0" + exports: ["FluentUI/FluSlider 1.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickText" + name: "FluentUI/FluText 1.0" + exports: ["FluentUI/FluText 1.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + Enum { + name: "FontStyle" + values: { + "Display": 0, + "TitleLarge": 1, + "Title": 2, + "Subtitle": 3, + "BodyLarge": 4, + "BodyStrong": 5, + "Body": 6, + "Caption": 7 + } + } + Property { name: "fontStyle"; type: "int" } + Property { name: "textColor"; type: "QColor" } + Property { name: "pixelSize"; type: "int" } + Method { + name: "setFontStyle" + type: "QVariant" + Parameter { name: "fontStyle"; type: "QVariant" } + } + } + Component { + prototype: "QQuickItem" + name: "FluentUI/FluTextBox 1.0" + exports: ["FluentUI/FluTextBox 1.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickItem" + name: "FluentUI/FluTimePicker 1.0" + exports: ["FluentUI/FluTimePicker 1.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + } + Component { + prototype: "QQuickSwitch" + name: "FluentUI/FluToggleSwitch 1.0" + exports: ["FluentUI/FluToggleSwitch 1.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + Property { name: "checkedColor"; type: "QColor" } + Signal { name: "clicked2" } + } + Component { + prototype: "QQuickRectangle" + name: "FluentUI/FluWindow 1.0" + exports: ["FluentUI/FluWindow 1.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + Property { name: "isMax"; type: "bool" } + Property { name: "title"; type: "string" } + } +} diff --git a/src/controls/FluAppBar.qml b/src/controls/FluAppBar.qml new file mode 100644 index 0000000..82448b3 --- /dev/null +++ b/src/controls/FluAppBar.qml @@ -0,0 +1,112 @@ +import QtQuick 2.15 +import QtQuick.Window 2.15 +import QtQuick.Layouts 1.15 +import FluentUI 1.0 + + +Rectangle{ + + color: FluApp.isDark ? "#323232" : "#FFFFFF" + height: 50 + width: { + if(parent==null) + return 200 + return parent.width + } + + property string title: "标题" + + MouseArea{ + property var lastClickTime: new Date() + anchors.fill: parent + anchors.topMargin: 5 + acceptedButtons: Qt.LeftButton + onPressed: Window.window.startSystemMove() + onDoubleClicked: { + toggleMaximized(); + } + } + + function toggleMaximized() { + if (Window.window.visibility === Window.Maximized) { + Window.window.showNormal(); + } else { + Window.window.showMaximized(); + } + } + + + + FluText { + text: title + anchors{ + verticalCenter: parent.verticalCenter + left: parent.left + leftMargin: 14 + } + fontStyle: FluText.Title + font.pixelSize: 14 + font.bold: true + } + + RowLayout{ + anchors.right: parent.right; + height: parent.height + spacing: 5 + + RowLayout{ + Layout.alignment: Qt.AlignVCenter + spacing: 5 + FluText{ + text:"夜间模式" + fontStyle: FluText.Body + } + FluToggleSwitch{ + checked: FluApp.isDark + onClicked2:{ + FluApp.isDark = !FluApp.isDark + } + } + } + + FluIconButton{ + icon : FluentIcons.FA_window_minimize + Layout.alignment: Qt.AlignVCenter + iconSize: 15 + iconColor: FluApp.isDark ? "#FFFFFF" : "#000000" + onClicked: { + Window.window.showMinimized() + } + } + FluIconButton{ + icon : { + if(Window.window == null) + return false + return Window.Maximized === Window.window.visibility ? FluentIcons.FA_window_restore : FluentIcons.FA_window_maximize + } + Layout.alignment: Qt.AlignVCenter + iconColor: FluApp.isDark ? "#FFFFFF" : "#000000" + iconSize: 15 + onClicked: { + toggleMaximized() + } + } + FluIconButton{ + icon : FluentIcons.FA_close + Layout.alignment: Qt.AlignVCenter + iconSize: 15 + iconColor: FluApp.isDark ? "#FFFFFF" : "#000000" + onClicked: { + Window.window.close() + } + } + } + + Rectangle{ + width: parent.width; + height: 1; + anchors.bottom: parent.bottom; + color: FluApp.isDark ? "#666666" : "#EEEEEE" + } + +} diff --git a/src/controls/FluButton.qml b/src/controls/FluButton.qml index 0eecf04..494af32 100644 --- a/src/controls/FluButton.qml +++ b/src/controls/FluButton.qml @@ -1,6 +1,5 @@ import QtQuick 2.15 import QtQuick.Controls 2.15 -import QtQuick.Controls.Material 2.15 Rectangle { id: button @@ -10,19 +9,33 @@ Rectangle { property int topPadding: 8 property int bottomPadding: 8 property bool disabled: false + property color primaryColor : "#0064B0" signal clicked radius: 4 - color: button_mouse.containsMouse ? "#eeeeee" : "#FFFFFF" + color:{ + if(FluApp.isDark){ + if(disabled){ + return "#C7C7C7" + } + return button_mouse.containsMouse ? "#444444" : "#3e3e3e" + }else{ + if(disabled){ + return "#C7C7C7" + } + return button_mouse.containsMouse ? "#FBFBFB" : "#FFFFFF" + } + } width: button_text.implicitWidth height: button_text.implicitHeight - border.color: "#cccccc" + + border.color: FluApp.isDark ? "#505050" : "#DFDFDF" border.width: 1 - Text { + + FluText { id: button_text text: "Standard Button" - color: "#000000" - font.pixelSize: 13 + font.pixelSize: 14 leftPadding: button.startPadding rightPadding: button.endPadding topPadding: button.topPadding @@ -35,6 +48,8 @@ Rectangle { anchors.fill: parent hoverEnabled: true onClicked: { + if(disabled) + return button.clicked() } } diff --git a/src/controls/FluFilledButton.qml b/src/controls/FluFilledButton.qml index 9c18828..1f6f1f2 100644 --- a/src/controls/FluFilledButton.qml +++ b/src/controls/FluFilledButton.qml @@ -1,6 +1,5 @@ import QtQuick 2.15 import QtQuick.Controls 2.15 -import QtQuick.Controls.Material 2.15 Rectangle { id: button @@ -21,14 +20,12 @@ Rectangle { } width: button_text.implicitWidth height: button_text.implicitHeight - border.color: "#cccccc" - border.width: 1 - Text { + FluText { id: button_text - text: "Standard Button" + text: "Filled Button" color: "#FFFFFFFF" - font.pixelSize: 13 + font.pixelSize: 14 leftPadding: button.startPadding rightPadding: button.endPadding topPadding: button.topPadding diff --git a/src/controls/FluIconButton.qml b/src/controls/FluIconButton.qml index 7a02b07..2005fa3 100644 --- a/src/controls/FluIconButton.qml +++ b/src/controls/FluIconButton.qml @@ -2,19 +2,43 @@ Rectangle { - width: text.implicitWidth - height: text.implicitHeight + id:button + width: 30 + height: 30 + property int iconSize: 20 property int icon + property color iconColor: "#000000" + signal clicked + + radius: 4 + + color: { + if(FluApp.isDark){ + return button_mouse.containsMouse ? "#000000" : "#00000000" + }else{ + return button_mouse.containsMouse ? "#F4F4F4" : "#00000000" + } + } Text { - id:text + id:text_icon font.family: "fontawesome" - font.pixelSize: 16 + font.pixelSize: iconSize horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter -// text:icon + anchors.centerIn: parent + color: iconColor text: (String.fromCharCode(icon).toString(16)); } + MouseArea{ + id:button_mouse + anchors.fill: parent + hoverEnabled: true + onClicked: { + button.clicked() + } + } + } diff --git a/src/controls/FluRectangle.qml b/src/controls/FluRectangle.qml new file mode 100644 index 0000000..68c2108 --- /dev/null +++ b/src/controls/FluRectangle.qml @@ -0,0 +1,5 @@ +import QtQuick 2.15 + +Item { + +} diff --git a/src/controls/FluText.qml b/src/controls/FluText.qml index 127654a..ff4a507 100644 --- a/src/controls/FluText.qml +++ b/src/controls/FluText.qml @@ -16,10 +16,10 @@ Text { Caption } - property int fontStyle: FluText.Display - property color textColor: "#333333" + property int fontStyle: FluText.Body + property color textColor: FluApp.isDark ? "#FFFFFF" : "#1A1A1A" - property int pixelSize : 16 + property int pixelSize : 14 color: textColor @@ -66,6 +66,7 @@ Text { font.pixelSize = text.pixelSize * 0.8 break default: + font.pixelSize = text.pixelSize * 1.0 break } } diff --git a/src/controls/FluToggleSwitch.qml b/src/controls/FluToggleSwitch.qml index e854918..845c7dc 100644 --- a/src/controls/FluToggleSwitch.qml +++ b/src/controls/FluToggleSwitch.qml @@ -4,10 +4,15 @@ import QtQuick.Controls 2.0 Switch { id: root property color checkedColor: "#0064B0" - + signal clicked2 + width: 40 + implicitWidth: 40 + height: 20 + implicitHeight: 20 + checkable: false indicator: Rectangle { - width: 40 - height: 20 + width: root.width + height: root.height radius: height / 2 color: root.checked ? checkedColor : "white" border.width: 1 @@ -21,10 +26,17 @@ Switch { anchors.verticalCenter: parent.verticalCenter color: root.checked ? "#FFFFFF" : "#666666" // border.color: "#D5D5D5" - Behavior on x { NumberAnimation { duration: 200 } } } } + MouseArea{ + id:switch_mouse + anchors.fill: parent + hoverEnabled: true + onClicked: { + root.clicked2() + } + } } diff --git a/src/controls/FluWindow.qml b/src/controls/FluWindow.qml new file mode 100644 index 0000000..c76aca1 --- /dev/null +++ b/src/controls/FluWindow.qml @@ -0,0 +1,36 @@ +import QtQuick 2.15 +import QtQuick.Window 2.15 +import QtQuick.Layouts 1.15 +import FluentUI 1.0 + +Rectangle { + + id:root + property bool isMax: { + if(Window.window == null) + return false + return Window.Maximized === Window.window.visibility + } + property string title: "FluentUI" + + onIsMaxChanged: { + if(isMax){ + root.anchors.margins = 4 + root.anchors.fill = parent + }else{ + root.anchors.margins = 0 + root.anchors.fill = null + } + } + + color : FluApp.isDark ? "#202020" : "#F3F3F3" + + Component.onCompleted: { + + } + + WindowHelper{ + id:helper + } + +} diff --git a/src/res.qrc b/src/res.qrc index 9a34dbb..4bd00c4 100644 --- a/src/res.qrc +++ b/src/res.qrc @@ -15,5 +15,8 @@ controls/FluTextBox.qml controls/FluTimePicker.qml res/font/fontawesome-webfont.ttf + controls/FluAppBar.qml + controls/FluRectangle.qml + controls/FluWindow.qml diff --git a/src/win_install.bat b/src/win_install.bat index dc1dfab..91ff9f6 100644 --- a/src/win_install.bat +++ b/src/win_install.bat @@ -20,7 +20,10 @@ if %ANDROID% == YES copy /y %LIBFILE_PATH% %BUILDER_BIN_PATH% if %1 == SHARED ( echo running install to qtqml folder + del /s /q %PRESET_PATH%\plugins.qmltypes + %QT_QML_FLUENT_PATH%\..\..\bin\qmlplugindump.exe -nonrelocatable FluentUI 1.0 .\ > %PRESET_PATH%\plugins.qmltypes rmdir /s /q %QT_QML_FLUENT_PATH% & md %QT_QML_FLUENT_PATH% copy /y %BUILDER_BIN_PATH% %QT_QML_FLUENT_PATH% + xcopy %PRESET_PATH% %QT_QML_FLUENT_PATH% /s/e/i/y cd %QT_QML_FLUENT_PATH% ) \ No newline at end of file