mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-07-01 15:42:20 +08:00
Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
e2cefb6114 | |||
bdf4da81dd | |||
f4cebb5c14 | |||
88b15b92ea | |||
d43e661388 |
2
.github/workflows/windows-mingw.yml
vendored
2
.github/workflows/windows-mingw.yml
vendored
@ -66,7 +66,7 @@ jobs:
|
||||
- name: package
|
||||
id: package
|
||||
env:
|
||||
archiveName: ${{ matrix.qt_ver }}-${{ env.fileName }}-${{ matrix.qt_arch }}
|
||||
archiveName: ${{ env.fileName }}-${{ matrix.qt_ver }}-${{ matrix.qt_arch }}
|
||||
shell: pwsh
|
||||
run: |
|
||||
& scripts\windows-mingw-publish.ps1 ${env:archiveName} ${env:targetName}
|
||||
|
2
.github/workflows/windows.yml
vendored
2
.github/workflows/windows.yml
vendored
@ -67,7 +67,7 @@ jobs:
|
||||
- name: package
|
||||
id: package
|
||||
env:
|
||||
archiveName: ${{ matrix.qt_ver }}-${{ env.fileName }}-${{ matrix.qt_arch }}
|
||||
archiveName: ${{ env.fileName }}-${{ matrix.qt_ver }}-${{ matrix.qt_arch }}
|
||||
msvcArch: ${{ matrix.msvc_arch }}
|
||||
shell: pwsh
|
||||
run: |
|
||||
|
@ -6,8 +6,11 @@ FluWindow {
|
||||
|
||||
width: 500
|
||||
height: 600
|
||||
minimumWidth: 300
|
||||
minimumHeight: 400
|
||||
minimumWidth: 500
|
||||
minimumHeight: 600
|
||||
maximumWidth: 500
|
||||
maximumHeight: 600
|
||||
|
||||
title:"关于"
|
||||
|
||||
FluAppBar{
|
||||
@ -31,7 +34,7 @@ FluWindow {
|
||||
fontStyle: FluText.Title
|
||||
}
|
||||
FluText{
|
||||
text:"v1.0.1"
|
||||
text:"v1.0.2"
|
||||
fontStyle: FluText.Body
|
||||
Layout.alignment: Qt.AlignBottom
|
||||
}
|
||||
|
@ -18,7 +18,6 @@ FluWindow {
|
||||
id:appbar
|
||||
title: "FluentUI"
|
||||
showDark: true
|
||||
showFps: true
|
||||
}
|
||||
|
||||
ListModel{
|
||||
@ -92,7 +91,7 @@ FluWindow {
|
||||
FluMenuItem{
|
||||
text:"意见反馈"
|
||||
onClicked:{
|
||||
showInfo("正在建设中...")
|
||||
Qt.openUrlExternally("https://github.com/zhuzichu520/FluentUI/issues/new")
|
||||
}
|
||||
}
|
||||
FluMenuItem{
|
||||
|
@ -127,6 +127,30 @@ Item {
|
||||
text:"Disabled"
|
||||
}
|
||||
}
|
||||
FluDivider{
|
||||
Layout.fillWidth: true ; height:1
|
||||
}
|
||||
RowLayout{
|
||||
Layout.topMargin: 20
|
||||
width: parent.width
|
||||
FluCheckBox{
|
||||
disabled:icon_button_check.checked
|
||||
}
|
||||
Item{
|
||||
height: 1
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
FluToggleSwitch{
|
||||
id:icon_button_check
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
FluText{
|
||||
text:"Disabled"
|
||||
}
|
||||
}
|
||||
FluDivider{
|
||||
Layout.fillWidth: true ; height:1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,12 @@ Item {
|
||||
Layout.leftMargin: 15
|
||||
value: 50
|
||||
}
|
||||
FluSlider{
|
||||
orientation:FluSlider.Vertical
|
||||
Layout.topMargin: 20
|
||||
Layout.leftMargin: 15
|
||||
value: 50
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,6 +31,33 @@ Item {
|
||||
Layout.preferredWidth: 300
|
||||
placeholderText: "多行输入框"
|
||||
}
|
||||
FluAutoSuggestBox{
|
||||
Layout.topMargin: 20
|
||||
values:generateRandomNames(100)
|
||||
placeholderText: "AutoSuggestBox"
|
||||
Layout.preferredWidth: 300
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function generateRandomNames(numNames) {
|
||||
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
const names = [];
|
||||
function generateRandomName() {
|
||||
const nameLength = Math.floor(Math.random() * 5) + 4;
|
||||
let name = '';
|
||||
for (let i = 0; i < nameLength; i++) {
|
||||
const letterIndex = Math.floor(Math.random() * 26);
|
||||
name += alphabet.charAt(letterIndex);
|
||||
}
|
||||
return name;
|
||||
}
|
||||
for (let i = 0; i < numNames; i++) {
|
||||
const name = generateRandomName();
|
||||
names.push(name);
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -59,6 +59,17 @@ Item {
|
||||
FluTheme.isDark = !FluTheme.isDark
|
||||
}
|
||||
}
|
||||
FluText{
|
||||
text:"无边框"
|
||||
fontStyle: FluText.Subtitle
|
||||
Layout.topMargin: 20
|
||||
}
|
||||
FluToggleSwitch{
|
||||
checked: FluTheme.isFrameless
|
||||
onClickFunc:function(){
|
||||
FluTheme.isFrameless = !FluTheme.isFrameless
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QQmlContext>
|
||||
#include <QDir>
|
||||
#include <QQuickWindow>
|
||||
#include <QProcess>
|
||||
|
||||
QMap<QString, QVariant> properties(){
|
||||
@ -16,6 +17,7 @@ int main(int argc, char *argv[])
|
||||
QCoreApplication::setOrganizationDomain("https://zhuzichu520.github.io");
|
||||
QCoreApplication::setApplicationName("FluentUI");
|
||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
// QQuickWindow::setSceneGraphBackend(QSGRendererInterface::Software);
|
||||
QGuiApplication app(argc, argv);
|
||||
QQmlApplicationEngine engine;
|
||||
QMapIterator<QString, QVariant> iterator(properties());
|
||||
|
@ -59,7 +59,7 @@ void FluApp::navigate(const QString& route){
|
||||
view->setSource((routes().value(route).toString()));
|
||||
if(isAppWindow){
|
||||
QObject::connect(view->engine(), &QQmlEngine::quit, qApp, &QCoreApplication::quit);
|
||||
QObject::connect(qApp, &QGuiApplication::aboutToQuit, qApp, [&view](){view->setSource({});});
|
||||
// QObject::connect(qApp, &QGuiApplication::aboutToQuit, qApp, [&view](){view->setSource({});});
|
||||
}else{
|
||||
view->closeDeleteLater();
|
||||
}
|
||||
|
@ -16,5 +16,6 @@ FluTheme::FluTheme(QObject *parent)
|
||||
: QObject{parent}
|
||||
{
|
||||
primaryColor(FluColors::getInstance()->Blue());
|
||||
isFrameless(true);
|
||||
isDark(false);
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ class FluTheme : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY_AUTO(FluColorSet*,primaryColor)
|
||||
Q_PROPERTY_AUTO(bool,isFrameless);
|
||||
Q_PROPERTY_AUTO(bool,isDark);
|
||||
public:
|
||||
explicit FluTheme(QObject *parent = nullptr);
|
||||
|
@ -33,6 +33,7 @@ void Fluent::registerTypes(const char *uri){
|
||||
qmlRegisterType<WindowHelper>(uri,major,minor,"WindowHelper");
|
||||
qmlRegisterType<FluColorSet>(uri,major,minor,"FluColorSet");
|
||||
|
||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluAutoSuggestBox.qml"),uri,major,minor,"FluAutoSuggestBox");
|
||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluExpander.qml"),uri,major,minor,"FluExpander");
|
||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluTreeView.qml"),uri,major,minor,"FluTreeView");
|
||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluContentDialog.qml"),uri,major,minor,"FluContentDialog");
|
||||
|
@ -21,6 +21,7 @@ public:
|
||||
void closeDeleteLater();
|
||||
bool isMax() const;
|
||||
bool isFull() const;
|
||||
void refreshWindow();
|
||||
QQuickItem *titleItem() const;
|
||||
|
||||
static QMap<WId,FramelessView*> *windowCache;
|
||||
@ -38,6 +39,7 @@ signals:
|
||||
protected:
|
||||
void showEvent(QShowEvent *e) override;
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
bool event(QEvent *ev) override;
|
||||
# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result) override;
|
||||
# else
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <QQuickItem>
|
||||
#include <QScreen>
|
||||
#include <QWindow>
|
||||
#include <FluTheme.h>
|
||||
|
||||
class FramelessViewPrivate
|
||||
{
|
||||
@ -12,10 +13,10 @@ public:
|
||||
bool m_deleteLater = false;
|
||||
QQuickItem *m_titleItem = nullptr;
|
||||
};
|
||||
|
||||
FramelessView::FramelessView(QWindow *parent) : Super(parent), d(new FramelessViewPrivate)
|
||||
{
|
||||
setFlags(Qt::CustomizeWindowHint | Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinMaxButtonsHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint);
|
||||
setResizeMode(SizeRootObjectToView);
|
||||
refreshWindow();
|
||||
setIsMax(windowState() == Qt::WindowMaximized);
|
||||
setIsFull(windowState() == Qt::WindowFullScreen);
|
||||
connect(this, &QWindow::windowStateChanged, this, [&](Qt::WindowState state) {
|
||||
@ -23,15 +24,31 @@ FramelessView::FramelessView(QWindow *parent) : Super(parent), d(new FramelessVi
|
||||
setIsMax(windowState() == Qt::WindowMaximized);
|
||||
setIsFull(windowState() == Qt::WindowFullScreen);
|
||||
});
|
||||
connect(FluTheme::getInstance(),&FluTheme::isFramelessChanged,this,[=](){
|
||||
refreshWindow();
|
||||
});
|
||||
}
|
||||
|
||||
void FramelessView::refreshWindow(){
|
||||
if(FluTheme::getInstance()->isFrameless()){
|
||||
setFlags(Qt::CustomizeWindowHint | Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinMaxButtonsHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint);
|
||||
}else{
|
||||
setFlags(Qt::Window);
|
||||
}
|
||||
setResizeMode(SizeViewToRootObject);
|
||||
setResizeMode(SizeRootObjectToView);
|
||||
}
|
||||
|
||||
FramelessView::~FramelessView()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
void FramelessView::showEvent(QShowEvent *e)
|
||||
{
|
||||
Super::showEvent(e);
|
||||
}
|
||||
|
||||
QRect FramelessView::calcCenterGeo(const QRect &screenGeo, const QSize &normalSize)
|
||||
{
|
||||
int w = normalSize.width();
|
||||
@ -46,9 +63,9 @@ QRect FramelessView::calcCenterGeo(const QRect &screenGeo, const QSize &normalSi
|
||||
y = screenGeo.y();
|
||||
h = screenGeo.height();
|
||||
}
|
||||
|
||||
return { x, y, w, h };
|
||||
}
|
||||
|
||||
void FramelessView::moveToScreenCenter()
|
||||
{
|
||||
auto geo = calcCenterGeo(screen()->availableGeometry(), size());
|
||||
@ -58,6 +75,7 @@ void FramelessView::moveToScreenCenter()
|
||||
setGeometry(geo);
|
||||
update();
|
||||
}
|
||||
|
||||
void FramelessView::closeDeleteLater(){
|
||||
d->m_deleteLater = true;
|
||||
}
|
||||
@ -66,14 +84,17 @@ bool FramelessView::isMax() const
|
||||
{
|
||||
return d->m_isMax;
|
||||
}
|
||||
|
||||
bool FramelessView::isFull() const
|
||||
{
|
||||
return d->m_isFull;
|
||||
}
|
||||
|
||||
QQuickItem *FramelessView::titleItem() const
|
||||
{
|
||||
return d->m_titleItem;
|
||||
}
|
||||
|
||||
void FramelessView::setIsMax(bool isMax)
|
||||
{
|
||||
if (d->m_isMax == isMax)
|
||||
@ -82,6 +103,7 @@ void FramelessView::setIsMax(bool isMax)
|
||||
d->m_isMax = isMax;
|
||||
emit isMaxChanged(d->m_isMax);
|
||||
}
|
||||
|
||||
void FramelessView::setIsFull(bool isFull)
|
||||
{
|
||||
if(d->m_isFull == isFull)
|
||||
@ -90,6 +112,7 @@ void FramelessView::setIsFull(bool isFull)
|
||||
d->m_isFull = isFull;
|
||||
emit isFullChanged(d->m_isFull);
|
||||
}
|
||||
|
||||
void FramelessView::setTitleItem(QQuickItem *item)
|
||||
{
|
||||
d->m_titleItem = item;
|
||||
@ -107,3 +130,15 @@ void FramelessView::resizeEvent(QResizeEvent *e)
|
||||
{
|
||||
Super::resizeEvent(e);
|
||||
}
|
||||
|
||||
bool FramelessView::event(QEvent *ev)
|
||||
{
|
||||
if (ev->type() == QEvent::Close) {
|
||||
if(d->m_deleteLater){
|
||||
deleteLater();
|
||||
ev->setAccepted(false);
|
||||
}
|
||||
}
|
||||
return QQuickWindow::event(ev);
|
||||
}
|
||||
|
||||
|
@ -3,27 +3,7 @@
|
||||
#include <QQuickItem>
|
||||
#include <QScreen>
|
||||
#include <QWindow>
|
||||
|
||||
#include <VersionHelpers.h>
|
||||
#include <WinUser.h>
|
||||
#include <dwmapi.h>
|
||||
#include <objidl.h> // Fixes error C2504: 'IUnknown' : base class undefined
|
||||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
#include <wtypes.h>
|
||||
#pragma comment(lib, "Dwmapi.lib") // Adds missing library, fixes error LNK2019: unresolved
|
||||
#pragma comment(lib, "User32.lib")
|
||||
#pragma comment(lib, "Gdi32.lib")
|
||||
|
||||
static bool isMaxWin(QWindow* win)
|
||||
{
|
||||
return win->windowState() == Qt::WindowMaximized;
|
||||
}
|
||||
static bool isFullWin(QQuickView* win)
|
||||
{
|
||||
return win->windowState() == Qt::WindowFullScreen;
|
||||
}
|
||||
|
||||
#include <FluTheme.h>
|
||||
|
||||
class FramelessViewPrivate
|
||||
{
|
||||
@ -33,10 +13,10 @@ public:
|
||||
bool m_deleteLater = false;
|
||||
QQuickItem *m_titleItem = nullptr;
|
||||
};
|
||||
|
||||
FramelessView::FramelessView(QWindow *parent) : Super(parent), d(new FramelessViewPrivate)
|
||||
{
|
||||
setFlags(Qt::CustomizeWindowHint | Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinMaxButtonsHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint);
|
||||
setResizeMode(SizeRootObjectToView);
|
||||
refreshWindow();
|
||||
setIsMax(windowState() == Qt::WindowMaximized);
|
||||
setIsFull(windowState() == Qt::WindowFullScreen);
|
||||
connect(this, &QWindow::windowStateChanged, this, [&](Qt::WindowState state) {
|
||||
@ -44,15 +24,31 @@ FramelessView::FramelessView(QWindow *parent) : Super(parent), d(new FramelessVi
|
||||
setIsMax(windowState() == Qt::WindowMaximized);
|
||||
setIsFull(windowState() == Qt::WindowFullScreen);
|
||||
});
|
||||
connect(FluTheme::getInstance(),&FluTheme::isFramelessChanged,this,[=](){
|
||||
refreshWindow();
|
||||
});
|
||||
}
|
||||
|
||||
void FramelessView::refreshWindow(){
|
||||
if(FluTheme::getInstance()->isFrameless()){
|
||||
setFlags(Qt::CustomizeWindowHint | Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinMaxButtonsHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint);
|
||||
}else{
|
||||
setFlags(Qt::Window);
|
||||
}
|
||||
setResizeMode(SizeViewToRootObject);
|
||||
setResizeMode(SizeRootObjectToView);
|
||||
}
|
||||
|
||||
FramelessView::~FramelessView()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
void FramelessView::showEvent(QShowEvent *e)
|
||||
{
|
||||
Super::showEvent(e);
|
||||
}
|
||||
|
||||
QRect FramelessView::calcCenterGeo(const QRect &screenGeo, const QSize &normalSize)
|
||||
{
|
||||
int w = normalSize.width();
|
||||
@ -67,9 +63,9 @@ QRect FramelessView::calcCenterGeo(const QRect &screenGeo, const QSize &normalSi
|
||||
y = screenGeo.y();
|
||||
h = screenGeo.height();
|
||||
}
|
||||
|
||||
return { x, y, w, h };
|
||||
}
|
||||
|
||||
void FramelessView::moveToScreenCenter()
|
||||
{
|
||||
auto geo = calcCenterGeo(screen()->availableGeometry(), size());
|
||||
@ -79,6 +75,7 @@ void FramelessView::moveToScreenCenter()
|
||||
setGeometry(geo);
|
||||
update();
|
||||
}
|
||||
|
||||
void FramelessView::closeDeleteLater(){
|
||||
d->m_deleteLater = true;
|
||||
}
|
||||
@ -87,14 +84,17 @@ bool FramelessView::isMax() const
|
||||
{
|
||||
return d->m_isMax;
|
||||
}
|
||||
|
||||
bool FramelessView::isFull() const
|
||||
{
|
||||
return d->m_isFull;
|
||||
}
|
||||
|
||||
QQuickItem *FramelessView::titleItem() const
|
||||
{
|
||||
return d->m_titleItem;
|
||||
}
|
||||
|
||||
void FramelessView::setIsMax(bool isMax)
|
||||
{
|
||||
if (d->m_isMax == isMax)
|
||||
@ -103,6 +103,7 @@ void FramelessView::setIsMax(bool isMax)
|
||||
d->m_isMax = isMax;
|
||||
emit isMaxChanged(d->m_isMax);
|
||||
}
|
||||
|
||||
void FramelessView::setIsFull(bool isFull)
|
||||
{
|
||||
if(d->m_isFull == isFull)
|
||||
@ -111,6 +112,7 @@ void FramelessView::setIsFull(bool isFull)
|
||||
d->m_isFull = isFull;
|
||||
emit isFullChanged(d->m_isFull);
|
||||
}
|
||||
|
||||
void FramelessView::setTitleItem(QQuickItem *item)
|
||||
{
|
||||
d->m_titleItem = item;
|
||||
@ -121,43 +123,16 @@ bool FramelessView::nativeEvent(const QByteArray &eventType, void *message, qint
|
||||
bool FramelessView::nativeEvent(const QByteArray &eventType, void *message, long *result)
|
||||
#endif
|
||||
{
|
||||
#if (QT_VERSION == QT_VERSION_CHECK(5, 11, 1))
|
||||
// Work-around a bug caused by typo which only exists in Qt 5.11.1
|
||||
const auto msg = *reinterpret_cast<MSG**>(message);
|
||||
#else
|
||||
const auto msg = static_cast<LPMSG>(message);
|
||||
#endif
|
||||
if (!msg || !msg->hwnd)
|
||||
MSG* msg = static_cast<MSG*>(message);
|
||||
if (msg->message == WM_WINDOWPOSCHANGING)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
switch (msg->message)
|
||||
{
|
||||
case WM_NCCALCSIZE: {
|
||||
const auto mode = static_cast<BOOL>(msg->wParam);
|
||||
const auto clientRect = mode ? &(reinterpret_cast<LPNCCALCSIZE_PARAMS>(msg->lParam)->rgrc[0]) : reinterpret_cast<LPRECT>(msg->lParam);
|
||||
if (mode == TRUE)
|
||||
WINDOWPOS* wp = reinterpret_cast<WINDOWPOS*>(msg->lParam);
|
||||
if (wp != nullptr && (wp->flags & SWP_NOSIZE) == 0)
|
||||
{
|
||||
*result = WVR_REDRAW;
|
||||
//规避 拖动border进行resize时界面闪烁
|
||||
if (!isMaxWin(this) && !isFullWin(this))
|
||||
{
|
||||
if (clientRect->top != 0)
|
||||
{
|
||||
clientRect->top -= 0.1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (clientRect->top != 0)
|
||||
{
|
||||
clientRect->top += 0.1;
|
||||
}
|
||||
}
|
||||
wp->flags |= SWP_NOCOPYBITS;
|
||||
*result = 0;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return Super::nativeEvent(eventType, message, result);
|
||||
}
|
||||
@ -166,3 +141,15 @@ void FramelessView::resizeEvent(QResizeEvent *e)
|
||||
{
|
||||
Super::resizeEvent(e);
|
||||
}
|
||||
|
||||
bool FramelessView::event(QEvent *ev)
|
||||
{
|
||||
if (ev->type() == QEvent::Close) {
|
||||
if(d->m_deleteLater){
|
||||
deleteLater();
|
||||
ev->setAccepted(false);
|
||||
}
|
||||
}
|
||||
return QQuickWindow::event(ev);
|
||||
}
|
||||
|
||||
|
@ -13,13 +13,15 @@ Rectangle{
|
||||
return borerlessColor
|
||||
return Window.window.active ? borerlessColor : Qt.lighter(borerlessColor,1.1)
|
||||
}
|
||||
height: 50
|
||||
visible: FluTheme.isFrameless
|
||||
height: visible ? 50 : 0
|
||||
width: {
|
||||
if(parent==null)
|
||||
return 200
|
||||
return parent.width
|
||||
}
|
||||
z: 65535
|
||||
clip: true
|
||||
property string title: "标题"
|
||||
property color textColor: FluTheme.isDark ? "#000000" : "#FFFFFF"
|
||||
property bool showDark: false
|
||||
|
134
src/controls/FluAutoSuggestBox.qml
Normal file
134
src/controls/FluAutoSuggestBox.qml
Normal file
@ -0,0 +1,134 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import FluentUI 1.0
|
||||
|
||||
TextField{
|
||||
id:input
|
||||
width: 300
|
||||
property var values:[]
|
||||
color: FluTheme.isDark ? "#FFFFFF" : "#1A1A1A"
|
||||
selectionColor: {
|
||||
if(FluTheme.isDark){
|
||||
return FluTheme.primaryColor.lighter
|
||||
}else{
|
||||
return FluTheme.primaryColor.dark
|
||||
}
|
||||
}
|
||||
rightPadding: 30
|
||||
selectByMouse: true
|
||||
|
||||
background: FluTextBoxBackground{
|
||||
inputItem: input
|
||||
|
||||
FluIconButton{
|
||||
icon:FluentIcons.FA_close
|
||||
iconSize: 14
|
||||
width: 20
|
||||
height: 20
|
||||
opacity: 0.5
|
||||
visible: input.text !== ""
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
right: parent.right
|
||||
rightMargin: 5
|
||||
}
|
||||
onClicked:{
|
||||
input.text = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
searchData()
|
||||
}
|
||||
|
||||
Popup{
|
||||
id:input_popup
|
||||
visible: input.focus
|
||||
y:input.height
|
||||
onClosed: {
|
||||
input.focus = false
|
||||
}
|
||||
background: Rectangle{
|
||||
width: input.width
|
||||
radius: 4
|
||||
FluShadow{
|
||||
radius: 4
|
||||
}
|
||||
color: FluTheme.isDark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(243/255,241/255,240/255,1)
|
||||
height: 38*Math.min(Math.max(list_view.count,1),8)
|
||||
ListView{
|
||||
id:list_view
|
||||
signal closePopup
|
||||
anchors.fill: parent
|
||||
boundsBehavior: ListView.StopAtBounds
|
||||
clip: true
|
||||
header: Item{
|
||||
width: input.width
|
||||
height: visible ? 38 : 0
|
||||
visible: list_view.count === 0
|
||||
FluText{
|
||||
text:"没有找到结果"
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
leftMargin: 15
|
||||
}
|
||||
}
|
||||
}
|
||||
ScrollBar.vertical: ScrollBar { }
|
||||
delegate: Item{
|
||||
height: 38
|
||||
width: input.width
|
||||
Rectangle{
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: 2
|
||||
anchors.bottomMargin: 2
|
||||
anchors.leftMargin: 5
|
||||
anchors.rightMargin: 5
|
||||
color: {
|
||||
if(item_mouse.containsMouse){
|
||||
return FluTheme.isDark ? Qt.rgba(63/255,60/255,61/255,1) : Qt.rgba(234/255,234/255,234/255,1)
|
||||
}
|
||||
return FluTheme.isDark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(243/255,241/255,240/255,1)
|
||||
}
|
||||
radius: 3
|
||||
MouseArea{
|
||||
id:item_mouse
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onClicked: {
|
||||
input_popup.close()
|
||||
input.text = modelData
|
||||
}
|
||||
}
|
||||
FluText{
|
||||
text:modelData
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
leftMargin: 10
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onTextChanged: {
|
||||
searchData()
|
||||
}
|
||||
|
||||
function searchData(){
|
||||
var result = []
|
||||
values.map(function(item){
|
||||
if(item.indexOf(input.text)!==-1){
|
||||
result.push(item)
|
||||
}
|
||||
})
|
||||
list_view.model = result
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -7,8 +7,8 @@ Rectangle {
|
||||
property string text: "Standard Button"
|
||||
property int startPadding : 15
|
||||
property int endPadding : 15
|
||||
property int topPadding: 8
|
||||
property int bottomPadding: 8
|
||||
property int topPadding: 5
|
||||
property int bottomPadding: 5
|
||||
property bool disabled: false
|
||||
property color primaryColor : "#0064B0"
|
||||
signal clicked
|
||||
@ -62,9 +62,8 @@ Rectangle {
|
||||
id:button_mouse
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
enabled: !disabled
|
||||
onClicked: {
|
||||
if(disabled)
|
||||
return
|
||||
button.clicked()
|
||||
}
|
||||
}
|
||||
|
@ -9,9 +9,26 @@ Item {
|
||||
property string text: "Check Box"
|
||||
property var checkClicked
|
||||
property bool hovered: mouse_area.containsMouse
|
||||
|
||||
property bool disabled: false
|
||||
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
|
||||
property color borderNormalColor: FluTheme.isDark ? Qt.rgba(160/255,160/255,160/255,1) : Qt.rgba(136/255,136/255,136/255,1)
|
||||
property color borderCheckedColor: FluTheme.isDark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
|
||||
property color borderHoverColor: FluTheme.isDark ? Qt.rgba(167/255,167/255,167/255,1) : Qt.rgba(135/255,135/255,135/255,1)
|
||||
property color borderDisableColor: FluTheme.isDark ? Qt.rgba(82/255,82/255,82/255,1) : Qt.rgba(199/255,199/255,199/255,1)
|
||||
|
||||
property color normalColor: FluTheme.isDark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(247/255,247/255,247/255,1)
|
||||
property color checkedColor: FluTheme.isDark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
|
||||
property color hoverColor: FluTheme.isDark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(244/255,244/255,244/255,1)
|
||||
property color checkedHoverColor: FluTheme.isDark ? Qt.darker(checkedColor,1.1) : Qt.lighter(checkedColor,1.1)
|
||||
|
||||
property color checkedDisableColor: FluTheme.isDark ? Qt.rgba(82/255,82/255,82/255,1) : Qt.rgba(199/255,199/255,199/255,1)
|
||||
|
||||
property color disableColor: FluTheme.isDark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(253/255,253/255,253/255,1)
|
||||
|
||||
RowLayout{
|
||||
spacing: 4
|
||||
Rectangle{
|
||||
@ -19,46 +36,32 @@ Item {
|
||||
height: 22
|
||||
radius: 4
|
||||
border.color: {
|
||||
if(FluTheme.isDark){
|
||||
if(checked){
|
||||
return FluTheme.primaryColor.lighter
|
||||
}
|
||||
return Qt.rgba(160/255,160/255,160/255,1)
|
||||
}else{
|
||||
if(checked){
|
||||
if(mouse_area.containsMouse){
|
||||
return Qt.rgba(25/255,117/255,187/255,1)
|
||||
}
|
||||
return FluTheme.primaryColor.dark
|
||||
}
|
||||
return Qt.rgba(136/255,136/255,136/255,1)
|
||||
if(disabled){
|
||||
return borderDisableColor
|
||||
}
|
||||
if(checked){
|
||||
return borderCheckedColor
|
||||
}
|
||||
if(hovered){
|
||||
return borderHoverColor
|
||||
}
|
||||
return borderNormalColor
|
||||
}
|
||||
border.width: 1
|
||||
color: {
|
||||
if(FluTheme.isDark){
|
||||
if(checked){
|
||||
if(mouse_area.containsMouse){
|
||||
return Qt.rgba(74/255,149/255,207/255,1)
|
||||
}
|
||||
return FluTheme.primaryColor.lighter
|
||||
if(checked){
|
||||
if(disabled){
|
||||
return checkedDisableColor
|
||||
}
|
||||
if(mouse_area.containsMouse){
|
||||
return Qt.rgba(62/255,62/255,62/255,1)
|
||||
if(hovered){
|
||||
return checkedHoverColor
|
||||
}
|
||||
return Qt.rgba(45/255,45/255,45/255,1)
|
||||
}else{
|
||||
if(checked){
|
||||
if(mouse_area.containsMouse){
|
||||
return Qt.rgba(25/255,117/255,187/255,1)
|
||||
}
|
||||
return FluTheme.primaryColor.dark
|
||||
}
|
||||
if(mouse_area.containsMouse){
|
||||
return Qt.rgba(244/255,244/255,244/255,1)
|
||||
}
|
||||
return Qt.rgba(247/255,247/255,247/255,1)
|
||||
return checkedColor
|
||||
}
|
||||
if(hovered){
|
||||
return hoverColor
|
||||
}
|
||||
return normalColor
|
||||
}
|
||||
|
||||
FluIcon {
|
||||
@ -79,6 +82,7 @@ Item {
|
||||
id:mouse_area
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
enabled: !disabled
|
||||
onClicked: {
|
||||
if(checkClicked){
|
||||
checkClicked()
|
||||
|
@ -23,10 +23,12 @@ Popup {
|
||||
anchors.centerIn: Overlay.overlay
|
||||
closePolicy: Popup.CloseOnEscape
|
||||
background: Rectangle {
|
||||
id:layout_content
|
||||
implicitWidth:minWidth
|
||||
implicitHeight: text_title.height + text_message.height + layout_actions.height
|
||||
color:FluTheme.isDark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(249/255,249/255,249/255,1)
|
||||
radius:5
|
||||
|
||||
FluShadow{
|
||||
radius: 5
|
||||
}
|
||||
|
@ -8,8 +8,8 @@ Rectangle {
|
||||
property string text: "Filled Button"
|
||||
property int startPadding : 15
|
||||
property int endPadding : 15
|
||||
property int topPadding: 8
|
||||
property int bottomPadding: 8
|
||||
property int topPadding: 5
|
||||
property int bottomPadding: 5
|
||||
property bool disabled: false
|
||||
|
||||
signal clicked
|
||||
|
@ -11,6 +11,7 @@ Popup {
|
||||
implicitHeight: container.height
|
||||
color:FluTheme.isDark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(237/255,237/255,237/255,1)
|
||||
radius: 5
|
||||
|
||||
FluShadow{
|
||||
radius: 5
|
||||
}
|
||||
|
@ -4,8 +4,8 @@ import QtQuick.Controls 2.12
|
||||
FluRectangle {
|
||||
id: control
|
||||
|
||||
width: 180
|
||||
height: 6
|
||||
width: 150
|
||||
height: 5
|
||||
radius: [3,3,3,3]
|
||||
clip: true
|
||||
color: FluTheme.isDark ? Qt.rgba(41/255,41/255,41/255,1) : Qt.rgba(214/255,214/255,214/255,1)
|
||||
|
@ -4,13 +4,13 @@ import QtQuick.Controls 2.12
|
||||
Rectangle {
|
||||
id: control
|
||||
|
||||
width: 60
|
||||
height: 60
|
||||
radius: 30
|
||||
width: 44
|
||||
height: 44
|
||||
radius: 22
|
||||
border.width: linWidth
|
||||
color: "#00000000"
|
||||
border.color: FluTheme.isDark ? Qt.rgba(41/255,41/255,41/255,1) : Qt.rgba(214/255,214/255,214/255,1)
|
||||
property real linWidth : 6
|
||||
property real linWidth : 5
|
||||
property real progress: 0.25
|
||||
property bool indeterminate: true
|
||||
readonly property real radius2 : radius - linWidth/2
|
||||
|
@ -6,23 +6,40 @@ Item{
|
||||
|
||||
id:root
|
||||
|
||||
property int lineWidth: 6
|
||||
property int dotSize: 30
|
||||
property int lineWidth: 5
|
||||
property int dotSize: 26
|
||||
property int value: 50
|
||||
|
||||
enum Orientation {
|
||||
Horizontal,
|
||||
Vertical
|
||||
}
|
||||
|
||||
height: control.height
|
||||
width: control.width
|
||||
|
||||
property int orientation: FluSlider.Horizontal
|
||||
|
||||
property bool isHorizontal: orientation === FluSlider.Horizontal
|
||||
|
||||
Component.onCompleted: {
|
||||
dot.x =value/100*control.width - dotSize/2
|
||||
root.value = Qt.binding(function(){
|
||||
return (dot.x+15)/control.width*100
|
||||
})
|
||||
if(isHorizontal){
|
||||
dot.x =value/100*control.width - dotSize/2
|
||||
root.value = Qt.binding(function(){
|
||||
return (dot.x+dotSize/2)/control.width*100
|
||||
})
|
||||
}else{
|
||||
dot.y =value/100*control.height - dotSize/2
|
||||
root.value = Qt.binding(function(){
|
||||
return (dot.y+dotSize/2)/control.height*100
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
FluRectangle {
|
||||
|
||||
id: control
|
||||
|
||||
width: 300
|
||||
height: root.lineWidth
|
||||
width: isHorizontal ? 200 : root.lineWidth
|
||||
height: isHorizontal ? root.lineWidth : 200
|
||||
radius: [3,3,3,3]
|
||||
clip: true
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@ -30,8 +47,8 @@ Item{
|
||||
Rectangle{
|
||||
id:rect
|
||||
radius: 3
|
||||
width: control.width*(value/100)
|
||||
height: control.height
|
||||
width: isHorizontal ? control.width*(value/100) : control.width
|
||||
height: isHorizontal ? control.height : control.height*(value/100)
|
||||
color:FluTheme.isDark ? FluTheme.primaryColor.lighter :FluTheme.primaryColor.dark
|
||||
}
|
||||
}
|
||||
@ -40,11 +57,12 @@ Item{
|
||||
id:dot
|
||||
width: dotSize
|
||||
height: dotSize
|
||||
FluShadow{
|
||||
radius: 15
|
||||
}
|
||||
radius: 15
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
FluShadow{
|
||||
radius: dotSize/2
|
||||
}
|
||||
radius: dotSize/2
|
||||
anchors.verticalCenter: isHorizontal ? parent.verticalCenter : undefined
|
||||
anchors.horizontalCenter: isHorizontal ? undefined :parent.horizontalCenter
|
||||
color:FluTheme.isDark ? Qt.rgba(69/255,69/255,69/255,1) :Qt.rgba(1,1,1,1)
|
||||
Rectangle{
|
||||
width: dotSize/2
|
||||
@ -65,9 +83,11 @@ Item{
|
||||
hoverEnabled: true
|
||||
drag {
|
||||
target: dot
|
||||
axis: Drag.XAxis
|
||||
minimumX: -dotSize/2
|
||||
maximumX: control.width - dotSize/2
|
||||
axis: isHorizontal ? Drag.XAxis : Drag.YAxis
|
||||
minimumX: isHorizontal ? -dotSize/2 : 0
|
||||
maximumX: isHorizontal ? (control.width - dotSize/2) : 0
|
||||
minimumY: isHorizontal ? 0 : -dotSize/2
|
||||
maximumY: isHorizontal ? 0 : (control.height - dotSize/2)
|
||||
}
|
||||
onPressed: {
|
||||
tool_tip.visible = true
|
||||
|
@ -22,6 +22,9 @@ Item {
|
||||
property int maximumHeight
|
||||
|
||||
property int borderless:{
|
||||
if(!FluTheme.isFrameless){
|
||||
return 0
|
||||
}
|
||||
if(window === null)
|
||||
return 4
|
||||
if(Window.window.visibility === Window.Maximized){
|
||||
@ -29,6 +32,7 @@ Item {
|
||||
}
|
||||
return 4
|
||||
}
|
||||
|
||||
default property alias content: container.data
|
||||
|
||||
FluWindowResize{
|
||||
@ -46,7 +50,7 @@ Item {
|
||||
color: {
|
||||
if(window === null)
|
||||
return borerlessColor
|
||||
return window.active ? borerlessColor : Qt.lighter(borerlessColor,1.1)
|
||||
return window.active ? borerlessColor : Qt.lighter(borerlessColor,1.1)
|
||||
}
|
||||
border.width: 1
|
||||
anchors.fill: parent
|
||||
|
0
src/macos_install.sh
Normal file → Executable file
0
src/macos_install.sh
Normal file → Executable file
@ -35,5 +35,6 @@
|
||||
<file>controls/FluContentDialog.qml</file>
|
||||
<file>controls/FluTreeView.qml</file>
|
||||
<file>controls/FluExpander.qml</file>
|
||||
<file>controls/FluAutoSuggestBox.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
Reference in New Issue
Block a user