Compare commits

..

8 Commits

Author SHA1 Message Date
朱子楚\zhuzi
0b1755e9eb update 2024-05-01 01:11:25 +08:00
朱子楚\zhuzi
e471d5a230 update 2024-04-30 19:38:05 +08:00
朱子楚\zhuzi
f922978338 update 2024-04-30 19:27:57 +08:00
朱子楚\zhuzi
91bda2a22c update 2024-04-30 13:07:46 +08:00
朱子楚\zhuzi
6638fe2e06 update 2024-04-30 13:06:27 +08:00
朱子楚\zhuzi
bf001d99d2 update 2024-04-30 12:59:09 +08:00
朱子楚\zhuzi
30531079b5 update 2024-04-29 10:12:34 +08:00
朱子楚\zhuzi
a746bc2684 update 2024-04-28 21:05:43 +08:00
15 changed files with 602 additions and 275 deletions

View File

@ -1292,6 +1292,7 @@ My only desire is to be permitted to drive out the traitors and restore the Han.
<message> <message>
<location filename="qml/page/T_GroupBox.qml" line="24"/> <location filename="qml/page/T_GroupBox.qml" line="24"/>
<source>RadioButton Group</source> <source>RadioButton Group</source>
<oldsource>RadioButton Group111111111111111111111111</oldsource>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
@ -1331,12 +1332,7 @@ My only desire is to be permitted to drive out the traitors and restore the Han.
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_Icons.qml" line="20"/> <location filename="qml/page/T_Icons.qml" line="51"/>
<source>Search</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Icons.qml" line="60"/>
<source>You Copied </source> <source>You Copied </source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -1968,7 +1964,7 @@ Some contents...</source>
</message> </message>
<message> <message>
<location filename="qml/page/T_TableView.qml" line="177"/> <location filename="qml/page/T_TableView.qml" line="177"/>
<location filename="qml/page/T_TableView.qml" line="510"/> <location filename="qml/page/T_TableView.qml" line="509"/>
<source>Name</source> <source>Name</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -1988,67 +1984,67 @@ Some contents...</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_TableView.qml" line="359"/> <location filename="qml/page/T_TableView.qml" line="365"/>
<source>Age</source> <source>Age</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_TableView.qml" line="434"/> <location filename="qml/page/T_TableView.qml" line="440"/>
<source>Clear All</source> <source>Clear All</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_TableView.qml" line="441"/> <location filename="qml/page/T_TableView.qml" line="447"/>
<source>Delete Selection</source> <source>Delete Selection</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_TableView.qml" line="464"/> <location filename="qml/page/T_TableView.qml" line="470"/>
<source>Add a row of Data</source> <source>Add a row of Data</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_TableView.qml" line="470"/> <location filename="qml/page/T_TableView.qml" line="476"/>
<source>Insert a Row</source> <source>Insert a Row</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_TableView.qml" line="477"/> <location filename="qml/page/T_TableView.qml" line="483"/>
<source>Focus not acquired: Please click any item in the form as the target for insertion!</source> <source>Focus not acquired: Please click any item in the form as the target for insertion!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_TableView.qml" line="505"/> <location filename="qml/page/T_TableView.qml" line="514"/>
<source>Avatar</source> <source>Avatar</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_TableView.qml" line="523"/> <location filename="qml/page/T_TableView.qml" line="528"/>
<source>Address</source> <source>Address</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_TableView.qml" line="531"/> <location filename="qml/page/T_TableView.qml" line="536"/>
<source>Nickname</source> <source>Nickname</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_TableView.qml" line="538"/> <location filename="qml/page/T_TableView.qml" line="543"/>
<source>Long String</source> <source>Long String</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_TableView.qml" line="546"/> <location filename="qml/page/T_TableView.qml" line="551"/>
<source>Options</source> <source>Options</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_TableView.qml" line="565"/> <location filename="qml/page/T_TableView.qml" line="569"/>
<source>&lt;Previous</source> <source>&lt;Previous</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_TableView.qml" line="566"/> <location filename="qml/page/T_TableView.qml" line="570"/>
<source>Next&gt;</source> <source>Next&gt;</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -2203,12 +2199,12 @@ Some contents...</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_Timeline.qml" line="115"/> <location filename="qml/page/T_Timeline.qml" line="114"/>
<source>Append</source> <source>Append</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_Timeline.qml" line="121"/> <location filename="qml/page/T_Timeline.qml" line="120"/>
<source>clear</source> <source>clear</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>

View File

@ -1378,6 +1378,7 @@ My only desire is to be permitted to drive out the traitors and restore the Han.
<message> <message>
<location filename="qml/page/T_GroupBox.qml" line="24"/> <location filename="qml/page/T_GroupBox.qml" line="24"/>
<source>RadioButton Group</source> <source>RadioButton Group</source>
<oldsource>RadioButton Group111111111111111111111111</oldsource>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
@ -1417,12 +1418,11 @@ My only desire is to be permitted to drive out the traitors and restore the Han.
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_Icons.qml" line="20"/>
<source>Search</source> <source>Search</source>
<translation type="unfinished"></translation> <translation type="obsolete"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_Icons.qml" line="60"/> <location filename="qml/page/T_Icons.qml" line="51"/>
<source>You Copied </source> <source>You Copied </source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -2110,7 +2110,7 @@ Some contents...</source>
</message> </message>
<message> <message>
<location filename="qml/page/T_TableView.qml" line="177"/> <location filename="qml/page/T_TableView.qml" line="177"/>
<location filename="qml/page/T_TableView.qml" line="510"/> <location filename="qml/page/T_TableView.qml" line="509"/>
<source>Name</source> <source>Name</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -2130,67 +2130,67 @@ Some contents...</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_TableView.qml" line="359"/> <location filename="qml/page/T_TableView.qml" line="365"/>
<source>Age</source> <source>Age</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_TableView.qml" line="434"/> <location filename="qml/page/T_TableView.qml" line="440"/>
<source>Clear All</source> <source>Clear All</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_TableView.qml" line="470"/> <location filename="qml/page/T_TableView.qml" line="476"/>
<source>Insert a Row</source> <source>Insert a Row</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_TableView.qml" line="477"/> <location filename="qml/page/T_TableView.qml" line="483"/>
<source>Focus not acquired: Please click any item in the form as the target for insertion!</source> <source>Focus not acquired: Please click any item in the form as the target for insertion!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_TableView.qml" line="505"/> <location filename="qml/page/T_TableView.qml" line="514"/>
<source>Avatar</source> <source>Avatar</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_TableView.qml" line="523"/> <location filename="qml/page/T_TableView.qml" line="528"/>
<source>Address</source> <source>Address</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_TableView.qml" line="531"/> <location filename="qml/page/T_TableView.qml" line="536"/>
<source>Nickname</source> <source>Nickname</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_TableView.qml" line="538"/> <location filename="qml/page/T_TableView.qml" line="543"/>
<source>Long String</source> <source>Long String</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_TableView.qml" line="546"/> <location filename="qml/page/T_TableView.qml" line="551"/>
<source>Options</source> <source>Options</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_TableView.qml" line="565"/> <location filename="qml/page/T_TableView.qml" line="569"/>
<source>&lt;Previous</source> <source>&lt;Previous</source>
<translation type="unfinished">&lt;</translation> <translation type="unfinished">&lt;</translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_TableView.qml" line="566"/> <location filename="qml/page/T_TableView.qml" line="570"/>
<source>Next&gt;</source> <source>Next&gt;</source>
<translation type="unfinished">&gt;</translation> <translation type="unfinished">&gt;</translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_TableView.qml" line="441"/> <location filename="qml/page/T_TableView.qml" line="447"/>
<source>Delete Selection</source> <source>Delete Selection</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_TableView.qml" line="464"/> <location filename="qml/page/T_TableView.qml" line="470"/>
<source>Add a row of Data</source> <source>Add a row of Data</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -2345,12 +2345,12 @@ Some contents...</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_Timeline.qml" line="115"/> <location filename="qml/page/T_Timeline.qml" line="114"/>
<source>Append</source> <source>Append</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_Timeline.qml" line="121"/> <location filename="qml/page/T_Timeline.qml" line="120"/>
<source>clear</source> <source>clear</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>

View File

@ -14,17 +14,8 @@ FluContentPage {
anchors{ anchors{
top: parent.top top: parent.top
} }
} onTextChanged: {
grid_view.model = FluApp.iconData(text_box.text)
FluFilledButton{
text: qsTr("Search")
anchors{
left: text_box.right
verticalCenter: text_box.verticalCenter
leftMargin: 14
}
onClicked: {
grid_view.model = FluApp.iconDatas(text_box.text)
} }
} }
GridView{ GridView{
@ -33,7 +24,7 @@ FluContentPage {
cellHeight: 110 cellHeight: 110
clip: true clip: true
boundsBehavior: GridView.StopAtBounds boundsBehavior: GridView.StopAtBounds
model: FluApp.iconDatas() model: FluApp.iconData()
ScrollBar.vertical: FluScrollBar {} ScrollBar.vertical: FluScrollBar {}
anchors{ anchors{
topMargin: 10 topMargin: 10

View File

@ -244,7 +244,9 @@ FluContentPage{
clickListener: function(){ clickListener: function(){
root.selectedAll = !root.selectedAll root.selectedAll = !root.selectedAll
var checked = root.selectedAll var checked = root.selectedAll
model.display = table_view.customItem(com_column_checbox,{"checked":checked}) var columnModel = model.display
columnModel.title = table_view.customItem(com_column_checbox,{"checked":checked})
model.display = columnModel
for(var i =0;i< table_view.rows ;i++){ for(var i =0;i< table_view.rows ;i++){
var rowData = table_view.getRow(i) var rowData = table_view.getRow(i)
rowData.checkbox = table_view.customItem(com_checbox,{"checked":checked}) rowData.checkbox = table_view.customItem(com_checbox,{"checked":checked})
@ -271,7 +273,8 @@ FluContentPage{
} }
Component.onCompleted: { Component.onCompleted: {
currentIndex=["100","300","500","1000"].findIndex((element) => element === display) currentIndex=["100","300","500","1000"].findIndex((element) => element === display)
selectAll() textBox.forceActiveFocus()
textBox.selectAll()
} }
onCommit: { onCommit: {
editTextChaged(editText) editTextChaged(editText)
@ -293,6 +296,7 @@ FluContentPage{
}); });
items = result items = result
textbox.text= String(display) textbox.text= String(display)
forceActiveFocus()
selectAll() selectAll()
} }
onCommit: { onCommit: {
@ -345,7 +349,9 @@ FluContentPage{
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
custom_update_dialog.showDialog(options.title,function(text){ custom_update_dialog.showDialog(options.title,function(text){
itemModel.display = table_view.customItem(com_column_update_title,{"title":text}) var columnModel = model.display
columnModel.title = table_view.customItem(com_column_update_title,{"title":text})
model.display = columnModel
}) })
} }
} }
@ -497,20 +503,19 @@ FluContentPage{
{ {
title: table_view.customItem(com_column_checbox,{checked:true}), title: table_view.customItem(com_column_checbox,{checked:true}),
dataIndex: 'checkbox', dataIndex: 'checkbox',
width:100, frozen: true
minimumWidth:100,
maximumWidth:100
},
{
title: table_view.customItem(com_column_update_title,{title:qsTr("Avatar")}),
dataIndex: 'avatar',
width:100
}, },
{ {
title: table_view.customItem(com_column_filter_name,{title:qsTr("Name")}), title: table_view.customItem(com_column_filter_name,{title:qsTr("Name")}),
dataIndex: 'name', dataIndex: 'name',
readOnly:true readOnly:true
}, },
{
title: table_view.customItem(com_column_update_title,{title:qsTr("Avatar")}),
dataIndex: 'avatar',
width:100,
frozen:true
},
{ {
title: table_view.customItem(com_column_sort_age,{sort:0}), title: table_view.customItem(com_column_sort_age,{sort:0}),
dataIndex: 'age', dataIndex: 'age',
@ -546,8 +551,7 @@ FluContentPage{
title: qsTr("Options"), title: qsTr("Options"),
dataIndex: 'action', dataIndex: 'action',
width:160, width:160,
minimumWidth:160, frozen:true
maximumWidth:160
} }
] ]
} }

View File

@ -44,7 +44,6 @@ FluScrollablePage{
wrapMode: Text.WrapAnywhere wrapMode: Text.WrapAnywhere
horizontalAlignment: isRight ? Qt.AlignRight : Qt.AlignLeft horizontalAlignment: isRight ? Qt.AlignRight : Qt.AlignLeft
text: modelData.text text: modelData.text
font.bold: true
linkColor: FluTheme.dark ? FluColors.Teal.lighter : FluColors.Teal.dark linkColor: FluTheme.dark ? FluColors.Teal.lighter : FluColors.Teal.dark
onLinkActivated: onLinkActivated:
(link)=> { (link)=> {

View File

@ -15,7 +15,7 @@ FluWindow {
title: "FluentUI" title: "FluentUI"
width: 1000 width: 1000
height: 680 height: 680
minimumWidth: 680 minimumWidth: 800
minimumHeight: 200 minimumHeight: 200
launchMode: FluWindowType.SingleTask launchMode: FluWindowType.SingleTask
fitsAppBarWindows: true fitsAppBarWindows: true

View File

@ -7,6 +7,7 @@
#include "FluTools.h" #include "FluTools.h"
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#pragma comment (lib, "user32.lib") #pragma comment (lib, "user32.lib")
#pragma comment (lib, "dwmapi.lib") #pragma comment (lib, "dwmapi.lib")
@ -14,7 +15,6 @@
#include <windowsx.h> #include <windowsx.h>
#include <dwmapi.h> #include <dwmapi.h>
static inline QByteArray qtNativeEventType() { static inline QByteArray qtNativeEventType() {
static const auto result = "windows_generic_MSG"; static const auto result = "windows_generic_MSG";
return result; return result;
@ -48,7 +48,6 @@ static inline void setShadow(HWND hwnd) {
} }
} }
#endif #endif
bool containsCursorToItem(QQuickItem *item) { bool containsCursorToItem(QQuickItem *item) {
@ -87,7 +86,7 @@ void FluFrameless::componentComplete() {
int w = window()->width(); int w = window()->width();
int h = window()->height(); int h = window()->height();
_current = window()->winId(); _current = window()->winId();
window()->setFlags((window()->flags()) | Qt::CustomizeWindowHint | Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint); window()->setFlags((window()->flags()) | Qt::CustomizeWindowHint | Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint | Qt::FramelessWindowHint);
if (!_fixSize) { if (!_fixSize) {
window()->setFlag(Qt::WindowMaximizeButtonHint); window()->setFlag(Qt::WindowMaximizeButtonHint);
} }
@ -106,14 +105,14 @@ void FluFrameless::componentComplete() {
HWND hwnd = reinterpret_cast<HWND>(window()->winId()); HWND hwnd = reinterpret_cast<HWND>(window()->winId());
DWORD style = ::GetWindowLongPtr(hwnd, GWL_STYLE); DWORD style = ::GetWindowLongPtr(hwnd, GWL_STYLE);
if (_fixSize) { if (_fixSize) {
::SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_CAPTION); ::SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_THICKFRAME | WS_CAPTION);
for (int i = 0; i <= QGuiApplication::screens().count() - 1; ++i) { for (int i = 0; i <= QGuiApplication::screens().count() - 1; ++i) {
connect(QGuiApplication::screens().at(i), &QScreen::logicalDotsPerInchChanged, this, [=] { connect(QGuiApplication::screens().at(i), &QScreen::logicalDotsPerInchChanged, this, [=] {
SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_FRAMECHANGED); SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_FRAMECHANGED);
}); });
} }
} else { } else {
::SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_MAXIMIZEBOX | WS_CAPTION); ::SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_MAXIMIZEBOX | WS_THICKFRAME | WS_CAPTION);
} }
SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
connect(window(), &QQuickWindow::screenChanged, this, [hwnd] { connect(window(), &QQuickWindow::screenChanged, this, [hwnd] {
@ -153,6 +152,7 @@ void FluFrameless::componentComplete() {
const auto uMsg = msg->message; const auto uMsg = msg->message;
const auto wParam = msg->wParam; const auto wParam = msg->wParam;
const auto lParam = msg->lParam; const auto lParam = msg->lParam;
static int offsetXY;
if (uMsg == WM_WINDOWPOSCHANGING) { if (uMsg == WM_WINDOWPOSCHANGING) {
auto *wp = reinterpret_cast<WINDOWPOS *>(lParam); auto *wp = reinterpret_cast<WINDOWPOS *>(lParam);
if (wp != nullptr && (wp->flags & SWP_NOSIZE) == 0) { if (wp != nullptr && (wp->flags & SWP_NOSIZE) == 0) {
@ -162,8 +162,8 @@ void FluFrameless::componentComplete() {
} }
return false; return false;
} else if (uMsg == WM_NCCALCSIZE) { } else if (uMsg == WM_NCCALCSIZE) {
const auto clientRect = ((wParam == FALSE) ? reinterpret_cast<LPRECT>(lParam) : &(reinterpret_cast<LPNCCALCSIZE_PARAMS>(lParam))->rgrc[0]);
bool isMaximum = ::IsZoomed(hwnd); bool isMaximum = ::IsZoomed(hwnd);
const auto clientRect = ((wParam == FALSE) ? reinterpret_cast<LPRECT>(lParam) : &(reinterpret_cast<LPNCCALCSIZE_PARAMS>(lParam))->rgrc[0]);
const LONG originalTop = clientRect->top; const LONG originalTop = clientRect->top;
const LONG originalLeft = clientRect->left; const LONG originalLeft = clientRect->left;
const LONG originalBottom = clientRect->bottom; const LONG originalBottom = clientRect->bottom;
@ -173,13 +173,22 @@ void FluFrameless::componentComplete() {
*result = static_cast<QT_NATIVE_EVENT_RESULT_TYPE>(hitTestResult); *result = static_cast<QT_NATIVE_EVENT_RESULT_TYPE>(hitTestResult);
return true; return true;
} }
if (clientRect->left - originalLeft != 0) {
offsetXY = clientRect->left - originalLeft;
}
if (!isMaximum) { if (!isMaximum) {
clientRect->top = originalTop; clientRect->top = originalTop;
clientRect->bottom = originalBottom; clientRect->bottom = originalBottom;
clientRect->left = originalLeft; clientRect->left = originalLeft;
clientRect->right = originalRight; clientRect->right = originalRight;
} else { } else {
clientRect->top = 0; clientRect->top = originalTop + offsetXY;
clientRect->bottom = originalBottom - offsetXY;
clientRect->left = originalLeft + offsetXY;
clientRect->right = originalRight - offsetXY;
#if (QT_VERSION == QT_VERSION_CHECK(6, 5, 3) || QT_VERSION == QT_VERSION_CHECK(6, 6, 0))
qWarning("This issue is Qt's own bug, which currently only exists in 6.5.3 and 6.6.0, and has been fixed in later versions");
#endif
} }
_setMaximizeHovered(false); _setMaximizeHovered(false);
*result = WVR_REDRAW; *result = WVR_REDRAW;

View File

@ -11,6 +11,7 @@ T.ComboBox {
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)
property color hoverColor: FluTheme.dark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(251/255,251/255,251/255,1) property color hoverColor: FluTheme.dark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(251/255,251/255,251/255,1)
property color disableColor: FluTheme.dark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(252/255,252/255,252/255,1) property color disableColor: FluTheme.dark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(252/255,252/255,252/255,1)
property alias textBox: text_field
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding) implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
@ -39,6 +40,7 @@ T.ComboBox {
opacity: enabled ? 1 : 0.3 opacity: enabled ? 1 : 0.3
} }
contentItem: T.TextField { contentItem: T.TextField {
id: text_field
property bool disabled: !control.editable property bool disabled: !control.editable
leftPadding: !control.mirrored ? 10 : control.editable && activeFocus ? 3 : 1 leftPadding: !control.mirrored ? 10 : control.editable && activeFocus ? 3 : 1
rightPadding: control.mirrored ? 10 : control.editable && activeFocus ? 3 : 1 rightPadding: control.mirrored ? 10 : control.editable && activeFocus ? 3 : 1

View File

@ -171,7 +171,7 @@ T.ScrollBar {
,Transition { ,Transition {
to: "show" to: "show"
SequentialAnimation { SequentialAnimation {
PauseAnimation { duration: 450 } PauseAnimation { duration: 150 }
NumberAnimation { NumberAnimation {
target: rect_bar target: rect_bar
properties: vertical ? "width" : "height" properties: vertical ? "width" : "height"

View File

@ -30,12 +30,19 @@ Rectangle {
if(columnSource.length!==0){ if(columnSource.length!==0){
var columns= [] var columns= []
var headerRow = {} var headerRow = {}
columnSource.forEach(function(item){ var offsetX = 0
for(var i=0;i<=columnSource.length-1;i++){
var item = columnSource[i]
if(!item.width){
item.width = d.defaultItemWidth
}
item.x = offsetX
offsetX = offsetX + item.width
var column = Qt.createQmlObject('import Qt.labs.qmlmodels 1.0;TableModelColumn{}',sourceModel); var column = Qt.createQmlObject('import Qt.labs.qmlmodels 1.0;TableModelColumn{}',sourceModel);
column.display = item.dataIndex column.display = item.dataIndex
columns.push(column) columns.push(column)
headerRow[item.dataIndex] = item.title headerRow[item.dataIndex] = item
}) }
header_column_model.columns = columns header_column_model.columns = columns
header_column_model.rows = [headerRow] header_column_model.rows = [headerRow]
} }
@ -48,6 +55,7 @@ Rectangle {
property int defaultItemHeight: 42 property int defaultItemHeight: 42
property var editDelegate property var editDelegate
property var editPosition property var editPosition
signal tableItemLayout(int column)
function getEditDelegate(column){ function getEditDelegate(column){
var obj =control.columnSource[column].editDelegate var obj =control.columnSource[column].editDelegate
if(obj){ if(obj){
@ -64,15 +72,15 @@ Rectangle {
sourceModel.rows = dataSource sourceModel.rows = dataSource
} }
TableModel{ TableModel{
id:header_column_model id: header_column_model
TableModelColumn { display : "title"} TableModelColumn { display : "title"}
} }
TableModel{ TableModel{
id:header_row_model id: header_row_model
TableModelColumn { display: "rowIndex" } TableModelColumn { display: "rowIndex" }
} }
FluTableSortProxyModel{ FluTableSortProxyModel{
id:table_sort_model id: table_sort_model
model: control.sourceModel model: control.sourceModel
} }
Component{ Component{
@ -189,7 +197,20 @@ Rectangle {
id:com_table_delegate id:com_table_delegate
MouseArea{ MouseArea{
id:item_table_mouse id:item_table_mouse
implicitWidth: TableView.view.width
property var _model: model property var _model: model
property bool isMainTable: TableView.view == table_view
property var currentTableView: TableView.view
visible: {
if(isMainTable && columnModel.frozen){
return false
}
if(!isMainTable){
if(currentTableView.dataIndex !== columnModel.dataIndex)
return false
}
return true
}
property bool isRowSelected: { property bool isRowSelected: {
if(rowModel === null) if(rowModel === null)
return false return false
@ -198,17 +219,17 @@ Rectangle {
} }
return false return false
} }
TableView.onPooled: {
if(d.editPosition && d.editPosition.row === row && d.editPosition.column === column){
control.closeEditor()
}
}
property bool editVisible: { property bool editVisible: {
if(d.editPosition && d.editPosition._key === rowModel._key && d.editPosition.column === column){ if(d.editPosition && d.editPosition._key === rowModel._key && d.editPosition.column === column){
return true return true
} }
return false return false
} }
TableView.onPooled: {
if(d.editPosition && d.editPosition.row === row && d.editPosition.column === column){
control.closeEditor()
}
}
hoverEnabled: true hoverEnabled: true
onEntered: { onEntered: {
d.rowHoverIndex = row d.rowHoverIndex = row
@ -217,21 +238,33 @@ Rectangle {
if(editVisible){ if(editVisible){
updateEditPosition() updateEditPosition()
} }
if(isMainTable){
updateTableItem()
}
} }
onHeightChanged: { onHeightChanged: {
if(editVisible){ if(editVisible){
updateEditPosition() updateEditPosition()
} }
if(isMainTable){
updateTableItem()
}
} }
onXChanged: { onXChanged: {
if(editVisible){ if(editVisible){
updateEditPosition() updateEditPosition()
} }
if(isMainTable){
updateTableItem()
}
} }
onYChanged: { onYChanged: {
if(editVisible){ if(editVisible){
updateEditPosition() updateEditPosition()
} }
if(isMainTable){
updateTableItem()
}
} }
function updateEditPosition(){ function updateEditPosition(){
var obj = {} var obj = {}
@ -244,6 +277,12 @@ Rectangle {
obj.height = item_table_mouse.height - 2 obj.height = item_table_mouse.height - 2
d.editPosition = obj d.editPosition = obj
} }
function updateTableItem(){
var columnModel = control.columnSource[column]
columnModel.x = item_table_mouse.x
columnModel.y = item_table_mouse.y
d.tableItemLayout(column)
}
Rectangle{ Rectangle{
anchors.fill: parent anchors.fill: parent
color:{ color:{
@ -253,7 +292,7 @@ Rectangle {
if(d.rowHoverIndex === row || item_table_mouse.isRowSelected){ if(d.rowHoverIndex === row || item_table_mouse.isRowSelected){
return FluTheme.dark ? Qt.rgba(1,1,1,0.06) : Qt.rgba(0,0,0,0.06) return FluTheme.dark ? Qt.rgba(1,1,1,0.06) : Qt.rgba(0,0,0,0.06)
} }
return (row%2!==0) ? control.color : (FluTheme.dark ? Qt.rgba(1,1,1,0.015) : Qt.rgba(0,0,0,0.015)) return (row%2!==0) ? control.color : (FluTheme.dark ? Qt.rgba(1,1,1,0.03) : Qt.rgba(0,0,0,0.03))
} }
MouseArea{ MouseArea{
anchors.fill: parent anchors.fill: parent
@ -271,7 +310,7 @@ Rectangle {
} }
loader_edit.display = item_table_loader.display loader_edit.display = item_table_loader.display
d.editDelegate = d.getEditDelegate(column) d.editDelegate = d.getEditDelegate(column)
updateEditPosition() item_table_mouse.updateEditPosition()
} }
onClicked: onClicked:
(event)=>{ (event)=>{
@ -297,12 +336,50 @@ Rectangle {
} }
anchors.fill: parent anchors.fill: parent
sourceComponent: { sourceComponent: {
if(isObject){ if(item_table_mouse.visible){
return display.comId if(isObject){
return display.comId
}
return com_text
} }
return com_text return undefined
} }
} }
FluLoader{
id: loader_edit
property var tableView: control
property var display
property int column: {
if(d.editPosition){
return d.editPosition.column
}
return 0
}
property int row: {
if(d.editPosition){
return d.editPosition.row
}
return 0
}
anchors{
fill: parent
margins: 1
}
signal editTextChaged(string text)
sourceComponent: {
if(item_table_mouse.visible && d.editPosition && d.editPosition.column === model.column && d.editPosition.row === model.row){
return d.editDelegate
}
return undefined
}
onEditTextChaged:
(text)=>{
var obj = control.getRow(row)
obj[control.columnSource[column].dataIndex] = text
control.setRow(row,obj)
}
z:999
}
Item{ Item{
anchors.fill: parent anchors.fill: parent
visible: item_table_mouse.isRowSelected visible: item_table_mouse.isRowSelected
@ -358,24 +435,24 @@ Rectangle {
ScrollBar.horizontal:scroll_bar_h ScrollBar.horizontal:scroll_bar_h
ScrollBar.vertical:scroll_bar_v ScrollBar.vertical:scroll_bar_v
columnWidthProvider: function(column) { columnWidthProvider: function(column) {
var columnObject = control.columnSource[column] var columnModel = control.columnSource[column]
var width = columnObject.width var width = columnModel.width
if(width){ if(width){
return width return width
} }
var minimumWidth = columnObject.minimumWidth var minimumWidth = columnModel.minimumWidth
if(minimumWidth){ if(minimumWidth){
return minimumWidth return minimumWidth
} }
return d.defaultItemWidth return d.defaultItemWidth
} }
rowHeightProvider: function(row) { rowHeightProvider: function(row) {
var rowObject = control.getRow(row) var rowModel = control.getRow(row)
var height = rowObject.height var height = rowModel.height
if(height){ if(height){
return height return height
} }
var minimumHeight = rowObject._minimumHeight var minimumHeight = rowModel._minimumHeight
if(minimumHeight){ if(minimumHeight){
return minimumHeight return minimumHeight
} }
@ -388,70 +465,37 @@ Rectangle {
table_view.flick(0,1) table_view.flick(0,1)
} }
delegate: com_table_delegate delegate: com_table_delegate
FluLoader{
id:loader_edit
property var tableView: control
property var display
property int column: {
if(d.editPosition){
return d.editPosition.column
}
return 0
}
property int row: {
if(d.editPosition){
return d.editPosition.row
}
return 0
}
signal editTextChaged(string text)
sourceComponent: d.editPosition ? d.editDelegate : undefined
onEditTextChaged:
(text)=>{
var obj = control.getRow(row)
obj[control.columnSource[column].dataIndex] = text
control.setRow(row,obj)
}
width: {
if(d.editPosition){
return d.editPosition.width
}
return 0
}
height: {
if(d.editPosition){
return d.editPosition.height
}
return 0
}
x:{
if(d.editPosition){
return d.editPosition.x
}
return 0
}
y:{
if(d.editPosition){
return d.editPosition.y
}
return 0
}
z:999
}
} }
} }
Component{ Component{
id:com_column_header_delegate id:com_column_header_delegate
Rectangle{ Rectangle{
id:column_item_control id: column_item_control
property var currentTableView : TableView.view
readonly property real cellPadding: 8 readonly property real cellPadding: 8
property bool canceled: false property bool canceled: false
property var _model: model property var _model: model
readonly property var columnObject : control.columnSource[column] readonly property var columnModel : control.columnSource[_index]
implicitWidth: { readonly property int _index : {
return (item_column_loader.item && item_column_loader.item.implicitWidth) + (cellPadding * 2) const isDataIndex = (element) => {
return element.dataIndex === display.dataIndex
}
return control.columnSource.findIndex(isDataIndex)
}
readonly property bool isHeaderHorizontal: TableView.view == header_horizontal
implicitWidth: {
if(column_item_control.isHeaderHorizontal){
return (item_column_loader.item && item_column_loader.item.implicitWidth) + (cellPadding * 2)
}
return TableView.view.width
}
implicitHeight: {
if(column_item_control.isHeaderHorizontal){
return Math.max(36, (item_column_loader.item&&item_column_loader.item.implicitHeight) + (cellPadding * 2))
}
return TableView.view.height
} }
implicitHeight: Math.max(36, (item_column_loader.item&&item_column_loader.item.implicitHeight) + (cellPadding * 2))
color: FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1) color: FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1)
Rectangle{ Rectangle{
border.color: control.borderColor border.color: control.borderColor
@ -472,7 +516,7 @@ Rectangle {
width: 1 width: 1
height: parent.height height: parent.height
anchors.left: parent.left anchors.left: parent.left
visible: column !== 0 visible: column_item_control._index !== 0
color:"#00000000" color:"#00000000"
} }
Rectangle{ Rectangle{
@ -481,7 +525,7 @@ Rectangle {
height: parent.height height: parent.height
anchors.right: parent.right anchors.right: parent.right
color:"#00000000" color:"#00000000"
visible: column === table_view.columns - 1 visible: column_item_control._index === table_view.columns - 1
} }
MouseArea{ MouseArea{
id:column_item_control_mouse id:column_item_control_mouse
@ -504,17 +548,17 @@ Rectangle {
FluLoader{ FluLoader{
id:item_column_loader id:item_column_loader
property var model: column_item_control._model property var model: column_item_control._model
property var display: model.display property var display: model.display.title
property var tableView: table_view property var tableView: table_view
property var sourceModel: control.sourceModel property var sourceModel: control.sourceModel
property bool isObject: typeof(display) == "object" property bool isObject: typeof(display) == "object"
property var options:{ property var options:{
if(isObject){ if(isObject){
return display.options return display.options
} }
return {} return {}
} }
property int column: model.column property int column: column_item_control._index
width: parent.width width: parent.width
height: parent.height height: parent.height
sourceComponent: { sourceComponent: {
@ -531,7 +575,7 @@ Rectangle {
anchors.right: parent.right anchors.right: parent.right
acceptedButtons: Qt.LeftButton acceptedButtons: Qt.LeftButton
hoverEnabled: true hoverEnabled: true
visible: !(columnObject.width === columnObject.minimumWidth && columnObject.width === columnObject.maximumWidth && columnObject.width) visible: !columnModel.frozen && !(columnModel.width === columnModel.minimumWidth && columnModel.width === columnModel.maximumWidth && columnModel.width)
cursorShape: Qt.SplitHCursor cursorShape: Qt.SplitHCursor
preventStealing: true preventStealing: true
onPressed : onPressed :
@ -551,9 +595,9 @@ Rectangle {
return return
} }
var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y) var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y)
var minimumWidth = columnObject.minimumWidth var minimumWidth = columnModel.minimumWidth
var maximumWidth = columnObject.maximumWidth var maximumWidth = columnModel.maximumWidth
var w = columnObject.width var w = columnModel.width
if(!w){ if(!w){
w = d.defaultItemWidth w = d.defaultItemWidth
} }
@ -563,9 +607,10 @@ Rectangle {
if(!maximumWidth){ if(!maximumWidth){
maximumWidth = 65535 maximumWidth = 65535
} }
columnObject.width = Math.min(Math.max(minimumWidth, w + delta.x),maximumWidth) columnModel.width = Math.min(Math.max(minimumWidth, w + delta.x),maximumWidth)
table_view.forceLayout() table_view.forceLayout()
header_horizontal.forceLayout() header_horizontal.forceLayout()
// column_item_control.currentTableView.forceLayout()
} }
} }
} }
@ -576,7 +621,7 @@ Rectangle {
id:item_control id:item_control
readonly property real cellPadding: 8 readonly property real cellPadding: 8
property bool canceled: false property bool canceled: false
property var rowObject: control.getRow(row) property var rowModel: control.getRow(row)
implicitWidth: Math.max(30, row_text.implicitWidth + (cellPadding * 2)) implicitWidth: Math.max(30, row_text.implicitWidth + (cellPadding * 2))
implicitHeight: row_text.implicitHeight + (cellPadding * 2) implicitHeight: row_text.implicitHeight + (cellPadding * 2)
color: FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1) color: FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1)
@ -642,9 +687,9 @@ Rectangle {
cursorShape: Qt.SplitVCursor cursorShape: Qt.SplitVCursor
preventStealing: true preventStealing: true
visible: { visible: {
if(rowObject === null) if(rowModel === null)
return false return false
return !(rowObject.height === rowObject._minimumHeight && rowObject.height === rowObject._maximumHeight && rowObject.height) return !(rowModel.height === rowModel._minimumHeight && rowModel.height === rowModel._maximumHeight && rowModel.height)
} }
onPressed : onPressed :
(mouse)=>{ (mouse)=>{
@ -662,11 +707,11 @@ Rectangle {
if(!pressed){ if(!pressed){
return return
} }
var rowObject = control.getRow(row) var rowModel = control.getRow(row)
var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y) var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y)
var minimumHeight = rowObject._minimumHeight var minimumHeight = rowModel._minimumHeight
var maximumHeight = rowObject._maximumHeight var maximumHeight = rowModel._maximumHeight
var h = rowObject.height var h = rowModel.height
if(!h){ if(!h){
h = d.defaultItemHeight h = d.defaultItemHeight
} }
@ -676,8 +721,8 @@ Rectangle {
if(!maximumHeight){ if(!maximumHeight){
maximumHeight = 65535 maximumHeight = 65535
} }
rowObject.height = Math.min(Math.max(minimumHeight, h + delta.y),maximumHeight) rowModel.height = Math.min(Math.max(minimumHeight, h + delta.y),maximumHeight)
control.setRow(row,rowObject) control.setRow(row,rowModel)
table_view.forceLayout() table_view.forceLayout()
} }
} }
@ -790,6 +835,124 @@ Rectangle {
} }
} }
} }
Item{
anchors{
left: header_vertical.right
top: parent.top
bottom: parent.bottom
right: parent.right
}
Component{
id: com_table_frozen
Rectangle{
id: item_layout_frozen
anchors.fill: parent
color: {
if(Window.active){
return FluTheme.dark ? Qt.rgba(48/255,48/255,48/255,1) :Qt.rgba(1,1,1,1)
}
return FluTheme.dark ? Qt.rgba(56/255,56/255,56/255,1) :Qt.rgba(243/255,243/255,243/255,1)
}
visible: table_view.rows !== 0
Rectangle{
z:99
anchors.fill: parent
border.color: FluTheme.dark ? Qt.rgba(26/255,26/255,26/255,0.6) : Qt.rgba(191/255,191/255,191/255,0.3)
FluShadow{
radius: 0
anchors.fill: parent
}
color: "#00000000"
}
TableView {
id:item_table_frozen_header
model: header_column_model
boundsBehavior: Flickable.StopAtBounds
clip: true
interactive: false
anchors{
left: parent.left
right: parent.right
top: parent.top
bottom: item_table_frozen.top
}
delegate: com_column_header_delegate
}
TableView{
property string dataIndex: columnModel.dataIndex
id: item_table_frozen
clip: true
interactive: false
anchors{
fill: parent
topMargin: header_horizontal.height
}
boundsBehavior: TableView.StopAtBounds
model: table_sort_model
delegate: com_table_delegate
syncDirection: Qt.Vertical
syncView: table_view
Component.onCompleted: {
item_table_frozen_header.contentX = columnModel.width * _index
item_table_frozen.contentX = columnModel.width * _index
}
}
}
}
Repeater{
model: control.columnSource
delegate: FluLoader{
id: item_layout_frozen
readonly property int _index : model.index
readonly property var columnModel : control.columnSource[_index]
Connections{
target: d
function onTableItemLayout(column){
if(item_layout_frozen._index === column){
updateLayout()
}
}
}
Connections{
target: table_view
function onContentXChanged(){
updateLayout()
}
}
function updateLayout(){
width = table_view.columnWidthProvider(_index)
x = Qt.binding(function(){
var minX = 0
var maxX = table_view.width-item_layout_frozen.width
for(var i=0;i<_index;i++){
var item = control.columnSource[i]
if(item.frozen){
minX = minX + item.width
}
}
for(i=_index+1;i<control.columnSource.length;i++){
item = control.columnSource[i]
if(item.frozen){
maxX = maxX- item.width
}
}
return Math.min(Math.max(columnModel.x - table_view.contentX,minX),maxX)}
)
}
Component.onCompleted: {
updateLayout()
}
height: control.height
visible: {
if(modelData.frozen){
return true
}
return false
}
sourceComponent: visible ? com_table_frozen : undefined
}
}
}
FluScrollBar { FluScrollBar {
id: scroll_bar_h id: scroll_bar_h
anchors{ anchors{

View File

@ -61,8 +61,8 @@ Window {
property var _windowRegister property var _windowRegister
property string _route property string _route
property bool _hideShadow: false property bool _hideShadow: false
id:window id: window
color:"transparent" color: FluTools.isSoftware() ? window.backgroundColor : "transparent"
Component.onCompleted: { Component.onCompleted: {
FluRouter.addWindow(window) FluRouter.addWindow(window)
useSystemAppBar = FluApp.useSystemAppBar useSystemAppBar = FluApp.useSystemAppBar
@ -302,7 +302,6 @@ Window {
info_bar.showError(text,duration,moremsg) info_bar.showError(text,duration,moremsg)
} }
function moveWindowToDesktopCenter(){ function moveWindowToDesktopCenter(){
screen = Qt.application.screens[FluTools.cursorScreenIndex()]
var availableGeometry = FluTools.desktopAvailableGeometry(window) var availableGeometry = FluTools.desktopAvailableGeometry(window)
window.setGeometry((availableGeometry.width-window.width)/2+Screen.virtualX,(availableGeometry.height-window.height)/2+Screen.virtualY,window.width,window.height) window.setGeometry((availableGeometry.width-window.width)/2+Screen.virtualX,(availableGeometry.height-window.height)/2+Screen.virtualY,window.width,window.height)
} }

View File

@ -11,6 +11,7 @@ T.ComboBox {
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)
property color hoverColor: FluTheme.dark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(251/255,251/255,251/255,1) property color hoverColor: FluTheme.dark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(251/255,251/255,251/255,1)
property color disableColor: FluTheme.dark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(252/255,252/255,252/255,1) property color disableColor: FluTheme.dark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(252/255,252/255,252/255,1)
property alias textBox: text_field
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding) implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
@ -39,6 +40,7 @@ T.ComboBox {
opacity: enabled ? 1 : 0.3 opacity: enabled ? 1 : 0.3
} }
contentItem: T.TextField { contentItem: T.TextField {
id: text_field
property bool disabled: !control.editable property bool disabled: !control.editable
leftPadding: !control.mirrored ? 10 : control.editable && activeFocus ? 3 : 1 leftPadding: !control.mirrored ? 10 : control.editable && activeFocus ? 3 : 1
rightPadding: control.mirrored ? 10 : control.editable && activeFocus ? 3 : 1 rightPadding: control.mirrored ? 10 : control.editable && activeFocus ? 3 : 1

View File

@ -173,7 +173,7 @@ T.ScrollBar {
,Transition { ,Transition {
to: "show" to: "show"
SequentialAnimation { SequentialAnimation {
PauseAnimation { duration: 450 } PauseAnimation { duration: 150 }
NumberAnimation { NumberAnimation {
target: rect_bar target: rect_bar
properties: vertical ? "width" : "height" properties: vertical ? "width" : "height"

View File

@ -30,12 +30,19 @@ Rectangle {
if(columnSource.length!==0){ if(columnSource.length!==0){
var columns= [] var columns= []
var headerRow = {} var headerRow = {}
columnSource.forEach(function(item){ var offsetX = 0
for(var i=0;i<=columnSource.length-1;i++){
var item = columnSource[i]
if(!item.width){
item.width = d.defaultItemWidth
}
item.x = offsetX
offsetX = offsetX + item.width
var column = Qt.createQmlObject('import Qt.labs.qmlmodels 1.0;TableModelColumn{}',sourceModel); var column = Qt.createQmlObject('import Qt.labs.qmlmodels 1.0;TableModelColumn{}',sourceModel);
column.display = item.dataIndex column.display = item.dataIndex
columns.push(column) columns.push(column)
headerRow[item.dataIndex] = item.title headerRow[item.dataIndex] = item
}) }
header_column_model.columns = columns header_column_model.columns = columns
header_column_model.rows = [headerRow] header_column_model.rows = [headerRow]
} }
@ -48,6 +55,7 @@ Rectangle {
property int defaultItemHeight: 42 property int defaultItemHeight: 42
property var editDelegate property var editDelegate
property var editPosition property var editPosition
signal tableItemLayout(int column)
function getEditDelegate(column){ function getEditDelegate(column){
var obj =control.columnSource[column].editDelegate var obj =control.columnSource[column].editDelegate
if(obj){ if(obj){
@ -64,15 +72,15 @@ Rectangle {
sourceModel.rows = dataSource sourceModel.rows = dataSource
} }
TableModel{ TableModel{
id:header_column_model id: header_column_model
TableModelColumn { display : "title"} TableModelColumn { display : "title"}
} }
TableModel{ TableModel{
id:header_row_model id: header_row_model
TableModelColumn { display: "rowIndex" } TableModelColumn { display: "rowIndex" }
} }
FluTableSortProxyModel{ FluTableSortProxyModel{
id:table_sort_model id: table_sort_model
model: control.sourceModel model: control.sourceModel
} }
Component{ Component{
@ -189,7 +197,20 @@ Rectangle {
id:com_table_delegate id:com_table_delegate
MouseArea{ MouseArea{
id:item_table_mouse id:item_table_mouse
implicitWidth: TableView.view.width
property var _model: model property var _model: model
property bool isMainTable: TableView.view == table_view
property var currentTableView: TableView.view
visible: {
if(isMainTable && columnModel.frozen){
return false
}
if(!isMainTable){
if(currentTableView.dataIndex !== columnModel.dataIndex)
return false
}
return true
}
property bool isRowSelected: { property bool isRowSelected: {
if(rowModel === null) if(rowModel === null)
return false return false
@ -198,17 +219,17 @@ Rectangle {
} }
return false return false
} }
TableView.onPooled: {
if(d.editPosition && d.editPosition.row === row && d.editPosition.column === column){
control.closeEditor()
}
}
property bool editVisible: { property bool editVisible: {
if(d.editPosition && d.editPosition._key === rowModel._key && d.editPosition.column === column){ if(d.editPosition && d.editPosition._key === rowModel._key && d.editPosition.column === column){
return true return true
} }
return false return false
} }
TableView.onPooled: {
if(d.editPosition && d.editPosition.row === row && d.editPosition.column === column){
control.closeEditor()
}
}
hoverEnabled: true hoverEnabled: true
onEntered: { onEntered: {
d.rowHoverIndex = row d.rowHoverIndex = row
@ -217,21 +238,33 @@ Rectangle {
if(editVisible){ if(editVisible){
updateEditPosition() updateEditPosition()
} }
if(isMainTable){
updateTableItem()
}
} }
onHeightChanged: { onHeightChanged: {
if(editVisible){ if(editVisible){
updateEditPosition() updateEditPosition()
} }
if(isMainTable){
updateTableItem()
}
} }
onXChanged: { onXChanged: {
if(editVisible){ if(editVisible){
updateEditPosition() updateEditPosition()
} }
if(isMainTable){
updateTableItem()
}
} }
onYChanged: { onYChanged: {
if(editVisible){ if(editVisible){
updateEditPosition() updateEditPosition()
} }
if(isMainTable){
updateTableItem()
}
} }
function updateEditPosition(){ function updateEditPosition(){
var obj = {} var obj = {}
@ -244,6 +277,12 @@ Rectangle {
obj.height = item_table_mouse.height - 2 obj.height = item_table_mouse.height - 2
d.editPosition = obj d.editPosition = obj
} }
function updateTableItem(){
var columnModel = control.columnSource[column]
columnModel.x = item_table_mouse.x
columnModel.y = item_table_mouse.y
d.tableItemLayout(column)
}
Rectangle{ Rectangle{
anchors.fill: parent anchors.fill: parent
color:{ color:{
@ -253,7 +292,7 @@ Rectangle {
if(d.rowHoverIndex === row || item_table_mouse.isRowSelected){ if(d.rowHoverIndex === row || item_table_mouse.isRowSelected){
return FluTheme.dark ? Qt.rgba(1,1,1,0.06) : Qt.rgba(0,0,0,0.06) return FluTheme.dark ? Qt.rgba(1,1,1,0.06) : Qt.rgba(0,0,0,0.06)
} }
return (row%2!==0) ? control.color : (FluTheme.dark ? Qt.rgba(1,1,1,0.015) : Qt.rgba(0,0,0,0.015)) return (row%2!==0) ? control.color : (FluTheme.dark ? Qt.rgba(1,1,1,0.03) : Qt.rgba(0,0,0,0.03))
} }
MouseArea{ MouseArea{
anchors.fill: parent anchors.fill: parent
@ -271,7 +310,7 @@ Rectangle {
} }
loader_edit.display = item_table_loader.display loader_edit.display = item_table_loader.display
d.editDelegate = d.getEditDelegate(column) d.editDelegate = d.getEditDelegate(column)
updateEditPosition() item_table_mouse.updateEditPosition()
} }
onClicked: onClicked:
(event)=>{ (event)=>{
@ -297,12 +336,50 @@ Rectangle {
} }
anchors.fill: parent anchors.fill: parent
sourceComponent: { sourceComponent: {
if(isObject){ if(item_table_mouse.visible){
return display.comId if(isObject){
return display.comId
}
return com_text
} }
return com_text return undefined
} }
} }
FluLoader{
id: loader_edit
property var tableView: control
property var display
property int column: {
if(d.editPosition){
return d.editPosition.column
}
return 0
}
property int row: {
if(d.editPosition){
return d.editPosition.row
}
return 0
}
anchors{
fill: parent
margins: 1
}
signal editTextChaged(string text)
sourceComponent: {
if(item_table_mouse.visible && d.editPosition && d.editPosition.column === model.column && d.editPosition.row === model.row){
return d.editDelegate
}
return undefined
}
onEditTextChaged:
(text)=>{
var obj = control.getRow(row)
obj[control.columnSource[column].dataIndex] = text
control.setRow(row,obj)
}
z:999
}
Item{ Item{
anchors.fill: parent anchors.fill: parent
visible: item_table_mouse.isRowSelected visible: item_table_mouse.isRowSelected
@ -358,24 +435,24 @@ Rectangle {
ScrollBar.horizontal:scroll_bar_h ScrollBar.horizontal:scroll_bar_h
ScrollBar.vertical:scroll_bar_v ScrollBar.vertical:scroll_bar_v
columnWidthProvider: function(column) { columnWidthProvider: function(column) {
var columnObject = control.columnSource[column] var columnModel = control.columnSource[column]
var width = columnObject.width var width = columnModel.width
if(width){ if(width){
return width return width
} }
var minimumWidth = columnObject.minimumWidth var minimumWidth = columnModel.minimumWidth
if(minimumWidth){ if(minimumWidth){
return minimumWidth return minimumWidth
} }
return d.defaultItemWidth return d.defaultItemWidth
} }
rowHeightProvider: function(row) { rowHeightProvider: function(row) {
var rowObject = control.getRow(row) var rowModel = control.getRow(row)
var height = rowObject.height var height = rowModel.height
if(height){ if(height){
return height return height
} }
var minimumHeight = rowObject._minimumHeight var minimumHeight = rowModel._minimumHeight
if(minimumHeight){ if(minimumHeight){
return minimumHeight return minimumHeight
} }
@ -388,70 +465,37 @@ Rectangle {
table_view.flick(0,1) table_view.flick(0,1)
} }
delegate: com_table_delegate delegate: com_table_delegate
FluLoader{
id:loader_edit
property var tableView: control
property var display
property int column: {
if(d.editPosition){
return d.editPosition.column
}
return 0
}
property int row: {
if(d.editPosition){
return d.editPosition.row
}
return 0
}
signal editTextChaged(string text)
sourceComponent: d.editPosition ? d.editDelegate : undefined
onEditTextChaged:
(text)=>{
var obj = control.getRow(row)
obj[control.columnSource[column].dataIndex] = text
control.setRow(row,obj)
}
width: {
if(d.editPosition){
return d.editPosition.width
}
return 0
}
height: {
if(d.editPosition){
return d.editPosition.height
}
return 0
}
x:{
if(d.editPosition){
return d.editPosition.x
}
return 0
}
y:{
if(d.editPosition){
return d.editPosition.y
}
return 0
}
z:999
}
} }
} }
Component{ Component{
id:com_column_header_delegate id:com_column_header_delegate
Rectangle{ Rectangle{
id:column_item_control id: column_item_control
property var currentTableView : TableView.view
readonly property real cellPadding: 8 readonly property real cellPadding: 8
property bool canceled: false property bool canceled: false
property var _model: model property var _model: model
readonly property var columnObject : control.columnSource[column] readonly property var columnModel : control.columnSource[_index]
implicitWidth: { readonly property int _index : {
return (item_column_loader.item && item_column_loader.item.implicitWidth) + (cellPadding * 2) const isDataIndex = (element) => {
return element.dataIndex === display.dataIndex
}
return control.columnSource.findIndex(isDataIndex)
}
readonly property bool isHeaderHorizontal: TableView.view == header_horizontal
implicitWidth: {
if(column_item_control.isHeaderHorizontal){
return (item_column_loader.item && item_column_loader.item.implicitWidth) + (cellPadding * 2)
}
return TableView.view.width
}
implicitHeight: {
if(column_item_control.isHeaderHorizontal){
return Math.max(36, (item_column_loader.item&&item_column_loader.item.implicitHeight) + (cellPadding * 2))
}
return TableView.view.height
} }
implicitHeight: Math.max(36, (item_column_loader.item&&item_column_loader.item.implicitHeight) + (cellPadding * 2))
color: FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1) color: FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1)
Rectangle{ Rectangle{
border.color: control.borderColor border.color: control.borderColor
@ -472,7 +516,7 @@ Rectangle {
width: 1 width: 1
height: parent.height height: parent.height
anchors.left: parent.left anchors.left: parent.left
visible: column !== 0 visible: column_item_control._index !== 0
color:"#00000000" color:"#00000000"
} }
Rectangle{ Rectangle{
@ -481,7 +525,7 @@ Rectangle {
height: parent.height height: parent.height
anchors.right: parent.right anchors.right: parent.right
color:"#00000000" color:"#00000000"
visible: column === table_view.columns - 1 visible: column_item_control._index === table_view.columns - 1
} }
MouseArea{ MouseArea{
id:column_item_control_mouse id:column_item_control_mouse
@ -504,17 +548,17 @@ Rectangle {
FluLoader{ FluLoader{
id:item_column_loader id:item_column_loader
property var model: column_item_control._model property var model: column_item_control._model
property var display: model.display property var display: model.display.title
property var tableView: table_view property var tableView: table_view
property var sourceModel: control.sourceModel property var sourceModel: control.sourceModel
property bool isObject: typeof(display) == "object" property bool isObject: typeof(display) == "object"
property var options:{ property var options:{
if(isObject){ if(isObject){
return display.options return display.options
} }
return {} return {}
} }
property int column: model.column property int column: column_item_control._index
width: parent.width width: parent.width
height: parent.height height: parent.height
sourceComponent: { sourceComponent: {
@ -531,7 +575,7 @@ Rectangle {
anchors.right: parent.right anchors.right: parent.right
acceptedButtons: Qt.LeftButton acceptedButtons: Qt.LeftButton
hoverEnabled: true hoverEnabled: true
visible: !(columnObject.width === columnObject.minimumWidth && columnObject.width === columnObject.maximumWidth && columnObject.width) visible: !columnModel.frozen && !(columnModel.width === columnModel.minimumWidth && columnModel.width === columnModel.maximumWidth && columnModel.width)
cursorShape: Qt.SplitHCursor cursorShape: Qt.SplitHCursor
preventStealing: true preventStealing: true
onPressed : onPressed :
@ -551,9 +595,9 @@ Rectangle {
return return
} }
var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y) var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y)
var minimumWidth = columnObject.minimumWidth var minimumWidth = columnModel.minimumWidth
var maximumWidth = columnObject.maximumWidth var maximumWidth = columnModel.maximumWidth
var w = columnObject.width var w = columnModel.width
if(!w){ if(!w){
w = d.defaultItemWidth w = d.defaultItemWidth
} }
@ -563,9 +607,10 @@ Rectangle {
if(!maximumWidth){ if(!maximumWidth){
maximumWidth = 65535 maximumWidth = 65535
} }
columnObject.width = Math.min(Math.max(minimumWidth, w + delta.x),maximumWidth) columnModel.width = Math.min(Math.max(minimumWidth, w + delta.x),maximumWidth)
table_view.forceLayout() table_view.forceLayout()
header_horizontal.forceLayout() header_horizontal.forceLayout()
// column_item_control.currentTableView.forceLayout()
} }
} }
} }
@ -576,7 +621,7 @@ Rectangle {
id:item_control id:item_control
readonly property real cellPadding: 8 readonly property real cellPadding: 8
property bool canceled: false property bool canceled: false
property var rowObject: control.getRow(row) property var rowModel: control.getRow(row)
implicitWidth: Math.max(30, row_text.implicitWidth + (cellPadding * 2)) implicitWidth: Math.max(30, row_text.implicitWidth + (cellPadding * 2))
implicitHeight: row_text.implicitHeight + (cellPadding * 2) implicitHeight: row_text.implicitHeight + (cellPadding * 2)
color: FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1) color: FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1)
@ -642,9 +687,9 @@ Rectangle {
cursorShape: Qt.SplitVCursor cursorShape: Qt.SplitVCursor
preventStealing: true preventStealing: true
visible: { visible: {
if(rowObject === null) if(rowModel === null)
return false return false
return !(rowObject.height === rowObject._minimumHeight && rowObject.height === rowObject._maximumHeight && rowObject.height) return !(rowModel.height === rowModel._minimumHeight && rowModel.height === rowModel._maximumHeight && rowModel.height)
} }
onPressed : onPressed :
(mouse)=>{ (mouse)=>{
@ -662,11 +707,11 @@ Rectangle {
if(!pressed){ if(!pressed){
return return
} }
var rowObject = control.getRow(row) var rowModel = control.getRow(row)
var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y) var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y)
var minimumHeight = rowObject._minimumHeight var minimumHeight = rowModel._minimumHeight
var maximumHeight = rowObject._maximumHeight var maximumHeight = rowModel._maximumHeight
var h = rowObject.height var h = rowModel.height
if(!h){ if(!h){
h = d.defaultItemHeight h = d.defaultItemHeight
} }
@ -676,8 +721,8 @@ Rectangle {
if(!maximumHeight){ if(!maximumHeight){
maximumHeight = 65535 maximumHeight = 65535
} }
rowObject.height = Math.min(Math.max(minimumHeight, h + delta.y),maximumHeight) rowModel.height = Math.min(Math.max(minimumHeight, h + delta.y),maximumHeight)
control.setRow(row,rowObject) control.setRow(row,rowModel)
table_view.forceLayout() table_view.forceLayout()
} }
} }
@ -790,6 +835,124 @@ Rectangle {
} }
} }
} }
Item{
anchors{
left: header_vertical.right
top: parent.top
bottom: parent.bottom
right: parent.right
}
Component{
id: com_table_frozen
Rectangle{
id: item_layout_frozen
anchors.fill: parent
color: {
if(Window.active){
return FluTheme.dark ? Qt.rgba(48/255,48/255,48/255,1) :Qt.rgba(1,1,1,1)
}
return FluTheme.dark ? Qt.rgba(56/255,56/255,56/255,1) :Qt.rgba(243/255,243/255,243/255,1)
}
visible: table_view.rows !== 0
Rectangle{
z:99
anchors.fill: parent
border.color: FluTheme.dark ? Qt.rgba(26/255,26/255,26/255,0.6) : Qt.rgba(191/255,191/255,191/255,0.3)
FluShadow{
radius: 0
anchors.fill: parent
}
color: "#00000000"
}
TableView {
id:item_table_frozen_header
model: header_column_model
boundsBehavior: Flickable.StopAtBounds
clip: true
interactive: false
anchors{
left: parent.left
right: parent.right
top: parent.top
bottom: item_table_frozen.top
}
delegate: com_column_header_delegate
}
TableView{
property string dataIndex: columnModel.dataIndex
id: item_table_frozen
clip: true
interactive: false
anchors{
fill: parent
topMargin: header_horizontal.height
}
boundsBehavior: TableView.StopAtBounds
model: table_sort_model
delegate: com_table_delegate
syncDirection: Qt.Vertical
syncView: table_view
Component.onCompleted: {
item_table_frozen_header.contentX = columnModel.width * _index
item_table_frozen.contentX = columnModel.width * _index
}
}
}
}
Repeater{
model: control.columnSource
delegate: FluLoader{
id: item_layout_frozen
readonly property int _index : model.index
readonly property var columnModel : control.columnSource[_index]
Connections{
target: d
function onTableItemLayout(column){
if(item_layout_frozen._index === column){
updateLayout()
}
}
}
Connections{
target: table_view
function onContentXChanged(){
updateLayout()
}
}
function updateLayout(){
width = table_view.columnWidthProvider(_index)
x = Qt.binding(function(){
var minX = 0
var maxX = table_view.width-item_layout_frozen.width
for(var i=0;i<_index;i++){
var item = control.columnSource[i]
if(item.frozen){
minX = minX + item.width
}
}
for(i=_index+1;i<control.columnSource.length;i++){
item = control.columnSource[i]
if(item.frozen){
maxX = maxX- item.width
}
}
return Math.min(Math.max(columnModel.x - table_view.contentX,minX),maxX)}
)
}
Component.onCompleted: {
updateLayout()
}
height: control.height
visible: {
if(modelData.frozen){
return true
}
return false
}
sourceComponent: visible ? com_table_frozen : undefined
}
}
}
FluScrollBar { FluScrollBar {
id: scroll_bar_h id: scroll_bar_h
anchors{ anchors{

View File

@ -60,8 +60,8 @@ Window {
property var _windowRegister property var _windowRegister
property string _route property string _route
property bool _hideShadow: false property bool _hideShadow: false
id:window id: window
color:"transparent" color: FluTools.isSoftware() ? window.backgroundColor : "transparent"
Component.onCompleted: { Component.onCompleted: {
FluRouter.addWindow(window) FluRouter.addWindow(window)
useSystemAppBar = FluApp.useSystemAppBar useSystemAppBar = FluApp.useSystemAppBar
@ -301,7 +301,6 @@ Window {
info_bar.showError(text,duration,moremsg) info_bar.showError(text,duration,moremsg)
} }
function moveWindowToDesktopCenter(){ function moveWindowToDesktopCenter(){
screen = Qt.application.screens[FluTools.cursorScreenIndex()]
var availableGeometry = FluTools.desktopAvailableGeometry(window) var availableGeometry = FluTools.desktopAvailableGeometry(window)
window.setGeometry((availableGeometry.width-window.width)/2+Screen.virtualX,(availableGeometry.height-window.height)/2+Screen.virtualY,window.width,window.height) window.setGeometry((availableGeometry.width-window.width)/2+Screen.virtualX,(availableGeometry.height-window.height)/2+Screen.virtualY,window.width,window.height)
} }