This commit is contained in:
zhuzichu 2023-04-19 23:04:56 +08:00
parent 7489a4bcbe
commit c19f5d4c48
24 changed files with 37 additions and 124 deletions

View File

@ -2,6 +2,7 @@
import QtQuick.Layouts import QtQuick.Layouts
import QtQuick.Window import QtQuick.Window
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Controls.Basic
import FluentUI import FluentUI
import "./component" import "./component"

View File

@ -68,7 +68,6 @@ FluExpander{
"FluComboBox", "FluComboBox",
"FluContentDialog", "FluContentDialog",
"FluContentPage", "FluContentPage",
"FluControl",
"FluDatePicker", "FluDatePicker",
"FluDivider", "FluDivider",
"FluDropDownButton", "FluDropDownButton",

View File

@ -1,4 +1,4 @@
QT += quick quickcontrols2 concurrent network multimedia QT += quick concurrent network multimedia
CONFIG += c++17 CONFIG += c++17
DEFINES += QT_DEPRECATED_WARNINGS QT_NO_WARNING_OUTPUT DEFINES += QT_DEPRECATED_WARNINGS QT_NO_WARNING_OUTPUT

View File

@ -3,7 +3,6 @@
#include <QQmlContext> #include <QQmlContext>
#include <QDir> #include <QDir>
#include <QQuickWindow> #include <QQuickWindow>
#include <QQuickStyle>
#include <QProcess> #include <QProcess>
#include "lang/Lang.h" #include "lang/Lang.h"
#include "AppInfo.h" #include "AppInfo.h"
@ -11,10 +10,12 @@
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
//将样式设置为Basic不然会导致组件显示异常
qputenv("QT_QUICK_CONTROLS_STYLE","Basic");
QCoreApplication::setOrganizationName("ZhuZiChu"); QCoreApplication::setOrganizationName("ZhuZiChu");
QCoreApplication::setOrganizationDomain("https://zhuzichu520.github.io"); QCoreApplication::setOrganizationDomain("https://zhuzichu520.github.io");
QCoreApplication::setApplicationName("FluentUI"); QCoreApplication::setApplicationName("FluentUI");
QQuickStyle::setStyle("Basic"); // QQuickWindow::setGraphicsApi(QSGRendererInterface::Software);
QGuiApplication app(argc, argv); QGuiApplication app(argc, argv);
app.setQuitOnLastWindowClosed(false); app.setQuitOnLastWindowClosed(false);
QQmlApplicationEngine engine; QQmlApplicationEngine engine;

View File

@ -1,4 +1,5 @@
import QtQuick import QtQuick
import QtQuick.Controls
import FluentUI import FluentUI
Rectangle { Rectangle {

View File

@ -1,8 +1,9 @@
import QtQuick import QtQuick
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Controls.Basic
import FluentUI import FluentUI
FluControl { Button {
property bool disabled: false property bool disabled: false
property color normalColor: FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(254/255,254/255,254/255,1) property color normalColor: FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(254/255,254/255,254/255,1)

View File

@ -1,9 +1,10 @@
import QtQuick import QtQuick
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Controls.Basic
import QtQuick.Layouts import QtQuick.Layouts
import FluentUI import FluentUI
FluControl { Button {
property bool selected: false property bool selected: false
property var clickFunc property var clickFunc

View File

@ -1,10 +1,11 @@
import QtQuick import QtQuick
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Controls.Basic
import QtQuick.Layouts import QtQuick.Layouts
import QtQuick.Window import QtQuick.Window
import FluentUI import FluentUI
FluControl{ Button{
id:control id:control
width: 36 width: 36
height: 36 height: 36

View File

@ -1,13 +0,0 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Controls.impl
import QtQuick.Templates as T
import FluentUI
T.Button {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding)
}

View File

@ -1,9 +1,10 @@
import QtQuick import QtQuick
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Controls.Basic
import QtQuick.Window import QtQuick.Window
import FluentUI import FluentUI
FluControl { Button {
property bool disabled: false property bool disabled: false
property color normalColor: FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(254/255,254/255,254/255,1) property color normalColor: FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(254/255,254/255,254/255,1)

View File

@ -1,8 +1,9 @@
import QtQuick import QtQuick
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Controls.Basic
import FluentUI import FluentUI
FluControl { Button {
property bool disabled: false property bool disabled: false
property color normalColor: FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark property color normalColor: FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark

View File

@ -1,5 +1,6 @@
import QtQuick import QtQuick
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Controls.Basic
import FluentUI import FluentUI
Item{ Item{
@ -52,7 +53,7 @@ Item{
anchors.fill: parent anchors.fill: parent
} }
FluControl{ Button{
id:btn_start id:btn_start
height: vertical ? 20 : 40 height: vertical ? 20 : 40
width: vertical ? 40 : 20 width: vertical ? 40 : 20
@ -82,7 +83,7 @@ Item{
} }
} }
FluControl{ Button{
id:btn_end id:btn_end
height: vertical ? 20 : 40 height: vertical ? 20 : 40
width: vertical ? 40 : 20 width: vertical ? 40 : 20

View File

@ -1,8 +1,9 @@
import QtQuick import QtQuick
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Controls.Basic
import FluentUI import FluentUI
FluControl { Button {
property int iconSize: 20 property int iconSize: 20
property int iconSource property int iconSource

View File

@ -1,8 +1,9 @@
import QtQuick import QtQuick
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Controls.Basic
import FluentUI import FluentUI
FluTextArea{ TextArea{
property int fontStyle: FluText.Body property int fontStyle: FluText.Body
property int pixelSize : FluTheme.textSize property int pixelSize : FluTheme.textSize

View File

@ -1,6 +1,7 @@
import QtQuick import QtQuick
import QtQuick.Window import QtQuick.Window
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Controls.Basic
import QtQuick.Layouts import QtQuick.Layouts
import FluentUI import FluentUI
@ -818,7 +819,7 @@ Item {
currentIndex: -1 currentIndex: -1
model: control_popup.childModel model: control_popup.childModel
ScrollBar.vertical: FluScrollBar {} ScrollBar.vertical: FluScrollBar {}
delegate:FluControl{ delegate:Button{
width: 160 width: 160
padding:10 padding:10
background: Rectangle{ background: Rectangle{

View File

@ -1,12 +1,10 @@
import QtQuick import QtQuick
import QtQuick.Controls import QtQuick.Controls
import FluentUI
import QtQuick.Layouts import QtQuick.Layouts
import FluentUI
Item { Item {
id: control id: control
signal requestPage(int page,int count) signal requestPage(int page,int count)
property string previousText: "<上一页" property string previousText: "<上一页"
property string nextText: "下一页>" property string nextText: "下一页>"

View File

@ -1,9 +1,10 @@
import QtQuick import QtQuick
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Controls.Basic
import QtQuick.Layouts import QtQuick.Layouts
import FluentUI import FluentUI
FluControl { Button {
property bool selected: false property bool selected: false
property bool disabled: false property bool disabled: false

View File

@ -1,39 +0,0 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Controls.impl
import QtQuick.Templates as T
T.TextArea {
id: control
implicitWidth: Math.max(contentWidth + leftPadding + rightPadding,
implicitBackgroundWidth + leftInset + rightInset,
placeholder.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(contentHeight + topPadding + bottomPadding,
implicitBackgroundHeight + topInset + bottomInset,
placeholder.implicitHeight + topPadding + bottomPadding)
padding: 6
leftPadding: padding + 4
color: control.palette.text
placeholderTextColor: control.palette.placeholderText
selectionColor: control.palette.highlight
selectedTextColor: control.palette.highlightedText
PlaceholderText {
id: placeholder
x: control.leftPadding
y: control.topPadding
width: control.width - (control.leftPadding + control.rightPadding)
height: control.height - (control.topPadding + control.bottomPadding)
text: control.placeholderText
font: control.font
color: control.placeholderTextColor
verticalAlignment: control.verticalAlignment
visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter)
elide: Text.ElideRight
renderType: control.renderType
}
}

View File

@ -1,8 +1,9 @@
import QtQuick import QtQuick
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Controls.Basic
import FluentUI import FluentUI
FluTextFiled{ TextField{
property int fontStyle: FluText.Body property int fontStyle: FluText.Body
property int pixelSize : FluTheme.textSize property int pixelSize : FluTheme.textSize

View File

@ -1,8 +1,9 @@
import QtQuick import QtQuick
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Controls.Basic
import FluentUI import FluentUI
FluControl { Button {
property bool disabled: false property bool disabled: false
property color normalColor: FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark property color normalColor: FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark

View File

@ -1,46 +0,0 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Controls.impl
import QtQuick.Templates as T
T.TextField {
id: control
implicitWidth: implicitBackgroundWidth + leftInset + rightInset
|| Math.max(contentWidth, placeholder.implicitWidth) + leftPadding + rightPadding
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
contentHeight + topPadding + bottomPadding,
placeholder.implicitHeight + topPadding + bottomPadding)
padding: 6
leftPadding: padding + 4
color: control.palette.text
selectionColor: control.palette.highlight
selectedTextColor: control.palette.highlightedText
placeholderTextColor: control.palette.placeholderText
verticalAlignment: TextInput.AlignVCenter
PlaceholderText {
id: placeholder
x: control.leftPadding
y: control.topPadding
width: control.width - (control.leftPadding + control.rightPadding)
height: control.height - (control.topPadding + control.bottomPadding)
text: control.placeholderText
font: control.font
color: control.placeholderTextColor
verticalAlignment: control.verticalAlignment
visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter)
elide: Text.ElideRight
renderType: control.renderType
}
background: Rectangle {
implicitWidth: 200
implicitHeight: 40
border.width: control.activeFocus ? 2 : 1
color: control.palette.base
border.color: control.activeFocus ? control.palette.highlight : control.palette.mid
}
}

View File

@ -1,8 +1,9 @@
import QtQuick import QtQuick
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Controls.Basic
import FluentUI import FluentUI
FluControl { Button {
property bool disabled: false property bool disabled: false
property bool selected: false property bool selected: false

View File

@ -1,9 +1,10 @@
import QtQuick import QtQuick
import QtQuick.Controls import QtQuick.Controls
import FluentUI import QtQuick.Controls.Basic
import QtQuick.Layouts import QtQuick.Layouts
import FluentUI
FluControl { Button {
property bool selected: false property bool selected: false
property var clickFunc property var clickFunc

View File

@ -64,9 +64,6 @@
<file>controls/FluFlipView.qml</file> <file>controls/FluFlipView.qml</file>
<file>controls/FluPivot.qml</file> <file>controls/FluPivot.qml</file>
<file>controls/FluPivotItem.qml</file> <file>controls/FluPivotItem.qml</file>
<file>controls/FluControl.qml</file>
<file>controls/FluTextFiled.qml</file>
<file>controls/FluTextArea.qml</file>
<file>controls/FluTableView.qml</file> <file>controls/FluTableView.qml</file>
<file>controls/FluPagination.qml</file> <file>controls/FluPagination.qml</file>
<file>controls/FluToggleButton.qml</file> <file>controls/FluToggleButton.qml</file>