mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-22 10:40:10 +08:00
Compare commits
8 Commits
96a6d0e7fa
...
0b1755e9eb
Author | SHA1 | Date | |
---|---|---|---|
|
0b1755e9eb | ||
|
e471d5a230 | ||
|
f922978338 | ||
|
91bda2a22c | ||
|
6638fe2e06 | ||
|
bf001d99d2 | ||
|
30531079b5 | ||
|
a746bc2684 |
@ -1292,6 +1292,7 @@ My only desire is to be permitted to drive out the traitors and restore the Han.
|
||||
<message>
|
||||
<location filename="qml/page/T_GroupBox.qml" line="24"/>
|
||||
<source>RadioButton Group</source>
|
||||
<oldsource>RadioButton Group111111111111111111111111</oldsource>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</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>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_Icons.qml" line="20"/>
|
||||
<source>Search</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_Icons.qml" line="60"/>
|
||||
<location filename="qml/page/T_Icons.qml" line="51"/>
|
||||
<source>You Copied </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@ -1968,7 +1964,7 @@ Some contents...</source>
|
||||
</message>
|
||||
<message>
|
||||
<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>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@ -1988,67 +1984,67 @@ Some contents...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_TableView.qml" line="359"/>
|
||||
<location filename="qml/page/T_TableView.qml" line="365"/>
|
||||
<source>Age</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_TableView.qml" line="434"/>
|
||||
<location filename="qml/page/T_TableView.qml" line="440"/>
|
||||
<source>Clear All</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_TableView.qml" line="441"/>
|
||||
<location filename="qml/page/T_TableView.qml" line="447"/>
|
||||
<source>Delete Selection</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</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>
|
||||
<translation type="unfinished"></translation>
|
||||
</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>
|
||||
<translation type="unfinished"></translation>
|
||||
</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>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_TableView.qml" line="505"/>
|
||||
<location filename="qml/page/T_TableView.qml" line="514"/>
|
||||
<source>Avatar</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_TableView.qml" line="523"/>
|
||||
<location filename="qml/page/T_TableView.qml" line="528"/>
|
||||
<source>Address</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_TableView.qml" line="531"/>
|
||||
<location filename="qml/page/T_TableView.qml" line="536"/>
|
||||
<source>Nickname</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_TableView.qml" line="538"/>
|
||||
<location filename="qml/page/T_TableView.qml" line="543"/>
|
||||
<source>Long String</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_TableView.qml" line="546"/>
|
||||
<location filename="qml/page/T_TableView.qml" line="551"/>
|
||||
<source>Options</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_TableView.qml" line="565"/>
|
||||
<location filename="qml/page/T_TableView.qml" line="569"/>
|
||||
<source><Previous</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_TableView.qml" line="566"/>
|
||||
<location filename="qml/page/T_TableView.qml" line="570"/>
|
||||
<source>Next></source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@ -2203,12 +2199,12 @@ Some contents...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_Timeline.qml" line="115"/>
|
||||
<location filename="qml/page/T_Timeline.qml" line="114"/>
|
||||
<source>Append</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_Timeline.qml" line="121"/>
|
||||
<location filename="qml/page/T_Timeline.qml" line="120"/>
|
||||
<source>clear</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -1378,6 +1378,7 @@ My only desire is to be permitted to drive out the traitors and restore the Han.
|
||||
<message>
|
||||
<location filename="qml/page/T_GroupBox.qml" line="24"/>
|
||||
<source>RadioButton Group</source>
|
||||
<oldsource>RadioButton Group111111111111111111111111</oldsource>
|
||||
<translation type="unfinished">单选框分组</translation>
|
||||
</message>
|
||||
</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>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_Icons.qml" line="20"/>
|
||||
<source>Search</source>
|
||||
<translation type="unfinished">搜索</translation>
|
||||
<translation type="obsolete">搜索</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_Icons.qml" line="60"/>
|
||||
<location filename="qml/page/T_Icons.qml" line="51"/>
|
||||
<source>You Copied </source>
|
||||
<translation type="unfinished">您复制</translation>
|
||||
</message>
|
||||
@ -2110,7 +2110,7 @@ Some contents...</source>
|
||||
</message>
|
||||
<message>
|
||||
<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>
|
||||
<translation type="unfinished">名称</translation>
|
||||
</message>
|
||||
@ -2130,67 +2130,67 @@ Some contents...</source>
|
||||
<translation type="unfinished">全选</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_TableView.qml" line="359"/>
|
||||
<location filename="qml/page/T_TableView.qml" line="365"/>
|
||||
<source>Age</source>
|
||||
<translation type="unfinished">年龄</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_TableView.qml" line="434"/>
|
||||
<location filename="qml/page/T_TableView.qml" line="440"/>
|
||||
<source>Clear All</source>
|
||||
<translation type="unfinished">清除所有</translation>
|
||||
</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>
|
||||
<translation type="unfinished">插入一行</translation>
|
||||
</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>
|
||||
<translation type="unfinished">焦点未获取:请点击表格中的任意一项,作为插入的靶点!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_TableView.qml" line="505"/>
|
||||
<location filename="qml/page/T_TableView.qml" line="514"/>
|
||||
<source>Avatar</source>
|
||||
<translation type="unfinished">头像</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_TableView.qml" line="523"/>
|
||||
<location filename="qml/page/T_TableView.qml" line="528"/>
|
||||
<source>Address</source>
|
||||
<translation type="unfinished">地址</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_TableView.qml" line="531"/>
|
||||
<location filename="qml/page/T_TableView.qml" line="536"/>
|
||||
<source>Nickname</source>
|
||||
<translation type="unfinished">昵称</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_TableView.qml" line="538"/>
|
||||
<location filename="qml/page/T_TableView.qml" line="543"/>
|
||||
<source>Long String</source>
|
||||
<translation type="unfinished">长字符串</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_TableView.qml" line="546"/>
|
||||
<location filename="qml/page/T_TableView.qml" line="551"/>
|
||||
<source>Options</source>
|
||||
<translation type="unfinished">操作</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_TableView.qml" line="565"/>
|
||||
<location filename="qml/page/T_TableView.qml" line="569"/>
|
||||
<source><Previous</source>
|
||||
<translation type="unfinished"><上一页</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_TableView.qml" line="566"/>
|
||||
<location filename="qml/page/T_TableView.qml" line="570"/>
|
||||
<source>Next></source>
|
||||
<translation type="unfinished">下一页></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_TableView.qml" line="441"/>
|
||||
<location filename="qml/page/T_TableView.qml" line="447"/>
|
||||
<source>Delete Selection</source>
|
||||
<translation type="unfinished">删除选中</translation>
|
||||
</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>
|
||||
<translation type="unfinished">添加一行数据</translation>
|
||||
</message>
|
||||
@ -2345,12 +2345,12 @@ Some contents...</source>
|
||||
<translation type="unfinished">时间轴</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_Timeline.qml" line="115"/>
|
||||
<location filename="qml/page/T_Timeline.qml" line="114"/>
|
||||
<source>Append</source>
|
||||
<translation type="unfinished">追加</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_Timeline.qml" line="121"/>
|
||||
<location filename="qml/page/T_Timeline.qml" line="120"/>
|
||||
<source>clear</source>
|
||||
<translation type="unfinished">清空</translation>
|
||||
</message>
|
||||
|
@ -14,17 +14,8 @@ FluContentPage {
|
||||
anchors{
|
||||
top: parent.top
|
||||
}
|
||||
}
|
||||
|
||||
FluFilledButton{
|
||||
text: qsTr("Search")
|
||||
anchors{
|
||||
left: text_box.right
|
||||
verticalCenter: text_box.verticalCenter
|
||||
leftMargin: 14
|
||||
}
|
||||
onClicked: {
|
||||
grid_view.model = FluApp.iconDatas(text_box.text)
|
||||
onTextChanged: {
|
||||
grid_view.model = FluApp.iconData(text_box.text)
|
||||
}
|
||||
}
|
||||
GridView{
|
||||
@ -33,7 +24,7 @@ FluContentPage {
|
||||
cellHeight: 110
|
||||
clip: true
|
||||
boundsBehavior: GridView.StopAtBounds
|
||||
model: FluApp.iconDatas()
|
||||
model: FluApp.iconData()
|
||||
ScrollBar.vertical: FluScrollBar {}
|
||||
anchors{
|
||||
topMargin: 10
|
||||
|
@ -244,7 +244,9 @@ FluContentPage{
|
||||
clickListener: function(){
|
||||
root.selectedAll = !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++){
|
||||
var rowData = table_view.getRow(i)
|
||||
rowData.checkbox = table_view.customItem(com_checbox,{"checked":checked})
|
||||
@ -271,7 +273,8 @@ FluContentPage{
|
||||
}
|
||||
Component.onCompleted: {
|
||||
currentIndex=["100","300","500","1000"].findIndex((element) => element === display)
|
||||
selectAll()
|
||||
textBox.forceActiveFocus()
|
||||
textBox.selectAll()
|
||||
}
|
||||
onCommit: {
|
||||
editTextChaged(editText)
|
||||
@ -293,6 +296,7 @@ FluContentPage{
|
||||
});
|
||||
items = result
|
||||
textbox.text= String(display)
|
||||
forceActiveFocus()
|
||||
selectAll()
|
||||
}
|
||||
onCommit: {
|
||||
@ -345,7 +349,9 @@ FluContentPage{
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
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}),
|
||||
dataIndex: 'checkbox',
|
||||
width:100,
|
||||
minimumWidth:100,
|
||||
maximumWidth:100
|
||||
},
|
||||
{
|
||||
title: table_view.customItem(com_column_update_title,{title:qsTr("Avatar")}),
|
||||
dataIndex: 'avatar',
|
||||
width:100
|
||||
frozen: true
|
||||
},
|
||||
{
|
||||
title: table_view.customItem(com_column_filter_name,{title:qsTr("Name")}),
|
||||
dataIndex: 'name',
|
||||
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}),
|
||||
dataIndex: 'age',
|
||||
@ -546,8 +551,7 @@ FluContentPage{
|
||||
title: qsTr("Options"),
|
||||
dataIndex: 'action',
|
||||
width:160,
|
||||
minimumWidth:160,
|
||||
maximumWidth:160
|
||||
frozen:true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -44,7 +44,6 @@ FluScrollablePage{
|
||||
wrapMode: Text.WrapAnywhere
|
||||
horizontalAlignment: isRight ? Qt.AlignRight : Qt.AlignLeft
|
||||
text: modelData.text
|
||||
font.bold: true
|
||||
linkColor: FluTheme.dark ? FluColors.Teal.lighter : FluColors.Teal.dark
|
||||
onLinkActivated:
|
||||
(link)=> {
|
||||
|
@ -15,7 +15,7 @@ FluWindow {
|
||||
title: "FluentUI"
|
||||
width: 1000
|
||||
height: 680
|
||||
minimumWidth: 680
|
||||
minimumWidth: 800
|
||||
minimumHeight: 200
|
||||
launchMode: FluWindowType.SingleTask
|
||||
fitsAppBarWindows: true
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "FluTools.h"
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
|
||||
#pragma comment (lib, "user32.lib")
|
||||
#pragma comment (lib, "dwmapi.lib")
|
||||
|
||||
@ -14,7 +15,6 @@
|
||||
#include <windowsx.h>
|
||||
#include <dwmapi.h>
|
||||
|
||||
|
||||
static inline QByteArray qtNativeEventType() {
|
||||
static const auto result = "windows_generic_MSG";
|
||||
return result;
|
||||
@ -48,7 +48,6 @@ static inline void setShadow(HWND hwnd) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
bool containsCursorToItem(QQuickItem *item) {
|
||||
@ -87,7 +86,7 @@ void FluFrameless::componentComplete() {
|
||||
int w = window()->width();
|
||||
int h = window()->height();
|
||||
_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) {
|
||||
window()->setFlag(Qt::WindowMaximizeButtonHint);
|
||||
}
|
||||
@ -106,14 +105,14 @@ void FluFrameless::componentComplete() {
|
||||
HWND hwnd = reinterpret_cast<HWND>(window()->winId());
|
||||
DWORD style = ::GetWindowLongPtr(hwnd, GWL_STYLE);
|
||||
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) {
|
||||
connect(QGuiApplication::screens().at(i), &QScreen::logicalDotsPerInchChanged, this, [=] {
|
||||
SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_FRAMECHANGED);
|
||||
});
|
||||
}
|
||||
} 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);
|
||||
connect(window(), &QQuickWindow::screenChanged, this, [hwnd] {
|
||||
@ -153,6 +152,7 @@ void FluFrameless::componentComplete() {
|
||||
const auto uMsg = msg->message;
|
||||
const auto wParam = msg->wParam;
|
||||
const auto lParam = msg->lParam;
|
||||
static int offsetXY;
|
||||
if (uMsg == WM_WINDOWPOSCHANGING) {
|
||||
auto *wp = reinterpret_cast<WINDOWPOS *>(lParam);
|
||||
if (wp != nullptr && (wp->flags & SWP_NOSIZE) == 0) {
|
||||
@ -162,8 +162,8 @@ void FluFrameless::componentComplete() {
|
||||
}
|
||||
return false;
|
||||
} 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);
|
||||
const auto clientRect = ((wParam == FALSE) ? reinterpret_cast<LPRECT>(lParam) : &(reinterpret_cast<LPNCCALCSIZE_PARAMS>(lParam))->rgrc[0]);
|
||||
const LONG originalTop = clientRect->top;
|
||||
const LONG originalLeft = clientRect->left;
|
||||
const LONG originalBottom = clientRect->bottom;
|
||||
@ -173,13 +173,22 @@ void FluFrameless::componentComplete() {
|
||||
*result = static_cast<QT_NATIVE_EVENT_RESULT_TYPE>(hitTestResult);
|
||||
return true;
|
||||
}
|
||||
if (clientRect->left - originalLeft != 0) {
|
||||
offsetXY = clientRect->left - originalLeft;
|
||||
}
|
||||
if (!isMaximum) {
|
||||
clientRect->top = originalTop;
|
||||
clientRect->bottom = originalBottom;
|
||||
clientRect->left = originalLeft;
|
||||
clientRect->right = originalRight;
|
||||
} 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);
|
||||
*result = WVR_REDRAW;
|
||||
|
@ -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 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 alias textBox: text_field
|
||||
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
||||
implicitContentWidth + leftPadding + rightPadding)
|
||||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||
@ -39,6 +40,7 @@ T.ComboBox {
|
||||
opacity: enabled ? 1 : 0.3
|
||||
}
|
||||
contentItem: T.TextField {
|
||||
id: text_field
|
||||
property bool disabled: !control.editable
|
||||
leftPadding: !control.mirrored ? 10 : control.editable && activeFocus ? 3 : 1
|
||||
rightPadding: control.mirrored ? 10 : control.editable && activeFocus ? 3 : 1
|
||||
|
@ -171,7 +171,7 @@ T.ScrollBar {
|
||||
,Transition {
|
||||
to: "show"
|
||||
SequentialAnimation {
|
||||
PauseAnimation { duration: 450 }
|
||||
PauseAnimation { duration: 150 }
|
||||
NumberAnimation {
|
||||
target: rect_bar
|
||||
properties: vertical ? "width" : "height"
|
||||
|
@ -30,12 +30,19 @@ Rectangle {
|
||||
if(columnSource.length!==0){
|
||||
var columns= []
|
||||
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);
|
||||
column.display = item.dataIndex
|
||||
columns.push(column)
|
||||
headerRow[item.dataIndex] = item.title
|
||||
})
|
||||
headerRow[item.dataIndex] = item
|
||||
}
|
||||
header_column_model.columns = columns
|
||||
header_column_model.rows = [headerRow]
|
||||
}
|
||||
@ -48,6 +55,7 @@ Rectangle {
|
||||
property int defaultItemHeight: 42
|
||||
property var editDelegate
|
||||
property var editPosition
|
||||
signal tableItemLayout(int column)
|
||||
function getEditDelegate(column){
|
||||
var obj =control.columnSource[column].editDelegate
|
||||
if(obj){
|
||||
@ -64,15 +72,15 @@ Rectangle {
|
||||
sourceModel.rows = dataSource
|
||||
}
|
||||
TableModel{
|
||||
id:header_column_model
|
||||
id: header_column_model
|
||||
TableModelColumn { display : "title"}
|
||||
}
|
||||
TableModel{
|
||||
id:header_row_model
|
||||
id: header_row_model
|
||||
TableModelColumn { display: "rowIndex" }
|
||||
}
|
||||
FluTableSortProxyModel{
|
||||
id:table_sort_model
|
||||
id: table_sort_model
|
||||
model: control.sourceModel
|
||||
}
|
||||
Component{
|
||||
@ -189,7 +197,20 @@ Rectangle {
|
||||
id:com_table_delegate
|
||||
MouseArea{
|
||||
id:item_table_mouse
|
||||
implicitWidth: TableView.view.width
|
||||
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: {
|
||||
if(rowModel === null)
|
||||
return false
|
||||
@ -198,17 +219,17 @@ Rectangle {
|
||||
}
|
||||
return false
|
||||
}
|
||||
TableView.onPooled: {
|
||||
if(d.editPosition && d.editPosition.row === row && d.editPosition.column === column){
|
||||
control.closeEditor()
|
||||
}
|
||||
}
|
||||
property bool editVisible: {
|
||||
if(d.editPosition && d.editPosition._key === rowModel._key && d.editPosition.column === column){
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
TableView.onPooled: {
|
||||
if(d.editPosition && d.editPosition.row === row && d.editPosition.column === column){
|
||||
control.closeEditor()
|
||||
}
|
||||
}
|
||||
hoverEnabled: true
|
||||
onEntered: {
|
||||
d.rowHoverIndex = row
|
||||
@ -217,21 +238,33 @@ Rectangle {
|
||||
if(editVisible){
|
||||
updateEditPosition()
|
||||
}
|
||||
if(isMainTable){
|
||||
updateTableItem()
|
||||
}
|
||||
}
|
||||
onHeightChanged: {
|
||||
if(editVisible){
|
||||
updateEditPosition()
|
||||
}
|
||||
if(isMainTable){
|
||||
updateTableItem()
|
||||
}
|
||||
}
|
||||
onXChanged: {
|
||||
if(editVisible){
|
||||
updateEditPosition()
|
||||
}
|
||||
if(isMainTable){
|
||||
updateTableItem()
|
||||
}
|
||||
}
|
||||
onYChanged: {
|
||||
if(editVisible){
|
||||
updateEditPosition()
|
||||
}
|
||||
if(isMainTable){
|
||||
updateTableItem()
|
||||
}
|
||||
}
|
||||
function updateEditPosition(){
|
||||
var obj = {}
|
||||
@ -244,6 +277,12 @@ Rectangle {
|
||||
obj.height = item_table_mouse.height - 2
|
||||
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{
|
||||
anchors.fill: parent
|
||||
color:{
|
||||
@ -253,7 +292,7 @@ Rectangle {
|
||||
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 (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{
|
||||
anchors.fill: parent
|
||||
@ -271,7 +310,7 @@ Rectangle {
|
||||
}
|
||||
loader_edit.display = item_table_loader.display
|
||||
d.editDelegate = d.getEditDelegate(column)
|
||||
updateEditPosition()
|
||||
item_table_mouse.updateEditPosition()
|
||||
}
|
||||
onClicked:
|
||||
(event)=>{
|
||||
@ -297,11 +336,49 @@ Rectangle {
|
||||
}
|
||||
anchors.fill: parent
|
||||
sourceComponent: {
|
||||
if(item_table_mouse.visible){
|
||||
if(isObject){
|
||||
return display.comId
|
||||
}
|
||||
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{
|
||||
anchors.fill: parent
|
||||
@ -358,24 +435,24 @@ Rectangle {
|
||||
ScrollBar.horizontal:scroll_bar_h
|
||||
ScrollBar.vertical:scroll_bar_v
|
||||
columnWidthProvider: function(column) {
|
||||
var columnObject = control.columnSource[column]
|
||||
var width = columnObject.width
|
||||
var columnModel = control.columnSource[column]
|
||||
var width = columnModel.width
|
||||
if(width){
|
||||
return width
|
||||
}
|
||||
var minimumWidth = columnObject.minimumWidth
|
||||
var minimumWidth = columnModel.minimumWidth
|
||||
if(minimumWidth){
|
||||
return minimumWidth
|
||||
}
|
||||
return d.defaultItemWidth
|
||||
}
|
||||
rowHeightProvider: function(row) {
|
||||
var rowObject = control.getRow(row)
|
||||
var height = rowObject.height
|
||||
var rowModel = control.getRow(row)
|
||||
var height = rowModel.height
|
||||
if(height){
|
||||
return height
|
||||
}
|
||||
var minimumHeight = rowObject._minimumHeight
|
||||
var minimumHeight = rowModel._minimumHeight
|
||||
if(minimumHeight){
|
||||
return minimumHeight
|
||||
}
|
||||
@ -388,70 +465,37 @@ Rectangle {
|
||||
table_view.flick(0,1)
|
||||
}
|
||||
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{
|
||||
id:com_column_header_delegate
|
||||
Rectangle{
|
||||
id:column_item_control
|
||||
id: column_item_control
|
||||
property var currentTableView : TableView.view
|
||||
readonly property real cellPadding: 8
|
||||
property bool canceled: false
|
||||
property var _model: model
|
||||
readonly property var columnObject : control.columnSource[column]
|
||||
readonly property var columnModel : control.columnSource[_index]
|
||||
readonly property int _index : {
|
||||
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)
|
||||
}
|
||||
implicitHeight: Math.max(36, (item_column_loader.item&&item_column_loader.item.implicitHeight) + (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
|
||||
}
|
||||
color: FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1)
|
||||
Rectangle{
|
||||
border.color: control.borderColor
|
||||
@ -472,7 +516,7 @@ Rectangle {
|
||||
width: 1
|
||||
height: parent.height
|
||||
anchors.left: parent.left
|
||||
visible: column !== 0
|
||||
visible: column_item_control._index !== 0
|
||||
color:"#00000000"
|
||||
}
|
||||
Rectangle{
|
||||
@ -481,7 +525,7 @@ Rectangle {
|
||||
height: parent.height
|
||||
anchors.right: parent.right
|
||||
color:"#00000000"
|
||||
visible: column === table_view.columns - 1
|
||||
visible: column_item_control._index === table_view.columns - 1
|
||||
}
|
||||
MouseArea{
|
||||
id:column_item_control_mouse
|
||||
@ -504,7 +548,7 @@ Rectangle {
|
||||
FluLoader{
|
||||
id:item_column_loader
|
||||
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 sourceModel: control.sourceModel
|
||||
property bool isObject: typeof(display) == "object"
|
||||
@ -514,7 +558,7 @@ Rectangle {
|
||||
}
|
||||
return {}
|
||||
}
|
||||
property int column: model.column
|
||||
property int column: column_item_control._index
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
sourceComponent: {
|
||||
@ -531,7 +575,7 @@ Rectangle {
|
||||
anchors.right: parent.right
|
||||
acceptedButtons: Qt.LeftButton
|
||||
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
|
||||
preventStealing: true
|
||||
onPressed :
|
||||
@ -551,9 +595,9 @@ Rectangle {
|
||||
return
|
||||
}
|
||||
var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y)
|
||||
var minimumWidth = columnObject.minimumWidth
|
||||
var maximumWidth = columnObject.maximumWidth
|
||||
var w = columnObject.width
|
||||
var minimumWidth = columnModel.minimumWidth
|
||||
var maximumWidth = columnModel.maximumWidth
|
||||
var w = columnModel.width
|
||||
if(!w){
|
||||
w = d.defaultItemWidth
|
||||
}
|
||||
@ -563,9 +607,10 @@ Rectangle {
|
||||
if(!maximumWidth){
|
||||
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()
|
||||
header_horizontal.forceLayout()
|
||||
// column_item_control.currentTableView.forceLayout()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -576,7 +621,7 @@ Rectangle {
|
||||
id:item_control
|
||||
readonly property real cellPadding: 8
|
||||
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))
|
||||
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)
|
||||
@ -642,9 +687,9 @@ Rectangle {
|
||||
cursorShape: Qt.SplitVCursor
|
||||
preventStealing: true
|
||||
visible: {
|
||||
if(rowObject === null)
|
||||
if(rowModel === null)
|
||||
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 :
|
||||
(mouse)=>{
|
||||
@ -662,11 +707,11 @@ Rectangle {
|
||||
if(!pressed){
|
||||
return
|
||||
}
|
||||
var rowObject = control.getRow(row)
|
||||
var rowModel = control.getRow(row)
|
||||
var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y)
|
||||
var minimumHeight = rowObject._minimumHeight
|
||||
var maximumHeight = rowObject._maximumHeight
|
||||
var h = rowObject.height
|
||||
var minimumHeight = rowModel._minimumHeight
|
||||
var maximumHeight = rowModel._maximumHeight
|
||||
var h = rowModel.height
|
||||
if(!h){
|
||||
h = d.defaultItemHeight
|
||||
}
|
||||
@ -676,8 +721,8 @@ Rectangle {
|
||||
if(!maximumHeight){
|
||||
maximumHeight = 65535
|
||||
}
|
||||
rowObject.height = Math.min(Math.max(minimumHeight, h + delta.y),maximumHeight)
|
||||
control.setRow(row,rowObject)
|
||||
rowModel.height = Math.min(Math.max(minimumHeight, h + delta.y),maximumHeight)
|
||||
control.setRow(row,rowModel)
|
||||
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 {
|
||||
id: scroll_bar_h
|
||||
anchors{
|
||||
|
@ -61,8 +61,8 @@ Window {
|
||||
property var _windowRegister
|
||||
property string _route
|
||||
property bool _hideShadow: false
|
||||
id:window
|
||||
color:"transparent"
|
||||
id: window
|
||||
color: FluTools.isSoftware() ? window.backgroundColor : "transparent"
|
||||
Component.onCompleted: {
|
||||
FluRouter.addWindow(window)
|
||||
useSystemAppBar = FluApp.useSystemAppBar
|
||||
@ -302,7 +302,6 @@ Window {
|
||||
info_bar.showError(text,duration,moremsg)
|
||||
}
|
||||
function moveWindowToDesktopCenter(){
|
||||
screen = Qt.application.screens[FluTools.cursorScreenIndex()]
|
||||
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)
|
||||
}
|
||||
|
@ -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 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 alias textBox: text_field
|
||||
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
||||
implicitContentWidth + leftPadding + rightPadding)
|
||||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||
@ -39,6 +40,7 @@ T.ComboBox {
|
||||
opacity: enabled ? 1 : 0.3
|
||||
}
|
||||
contentItem: T.TextField {
|
||||
id: text_field
|
||||
property bool disabled: !control.editable
|
||||
leftPadding: !control.mirrored ? 10 : control.editable && activeFocus ? 3 : 1
|
||||
rightPadding: control.mirrored ? 10 : control.editable && activeFocus ? 3 : 1
|
||||
|
@ -173,7 +173,7 @@ T.ScrollBar {
|
||||
,Transition {
|
||||
to: "show"
|
||||
SequentialAnimation {
|
||||
PauseAnimation { duration: 450 }
|
||||
PauseAnimation { duration: 150 }
|
||||
NumberAnimation {
|
||||
target: rect_bar
|
||||
properties: vertical ? "width" : "height"
|
||||
|
@ -30,12 +30,19 @@ Rectangle {
|
||||
if(columnSource.length!==0){
|
||||
var columns= []
|
||||
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);
|
||||
column.display = item.dataIndex
|
||||
columns.push(column)
|
||||
headerRow[item.dataIndex] = item.title
|
||||
})
|
||||
headerRow[item.dataIndex] = item
|
||||
}
|
||||
header_column_model.columns = columns
|
||||
header_column_model.rows = [headerRow]
|
||||
}
|
||||
@ -48,6 +55,7 @@ Rectangle {
|
||||
property int defaultItemHeight: 42
|
||||
property var editDelegate
|
||||
property var editPosition
|
||||
signal tableItemLayout(int column)
|
||||
function getEditDelegate(column){
|
||||
var obj =control.columnSource[column].editDelegate
|
||||
if(obj){
|
||||
@ -64,15 +72,15 @@ Rectangle {
|
||||
sourceModel.rows = dataSource
|
||||
}
|
||||
TableModel{
|
||||
id:header_column_model
|
||||
id: header_column_model
|
||||
TableModelColumn { display : "title"}
|
||||
}
|
||||
TableModel{
|
||||
id:header_row_model
|
||||
id: header_row_model
|
||||
TableModelColumn { display: "rowIndex" }
|
||||
}
|
||||
FluTableSortProxyModel{
|
||||
id:table_sort_model
|
||||
id: table_sort_model
|
||||
model: control.sourceModel
|
||||
}
|
||||
Component{
|
||||
@ -189,7 +197,20 @@ Rectangle {
|
||||
id:com_table_delegate
|
||||
MouseArea{
|
||||
id:item_table_mouse
|
||||
implicitWidth: TableView.view.width
|
||||
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: {
|
||||
if(rowModel === null)
|
||||
return false
|
||||
@ -198,17 +219,17 @@ Rectangle {
|
||||
}
|
||||
return false
|
||||
}
|
||||
TableView.onPooled: {
|
||||
if(d.editPosition && d.editPosition.row === row && d.editPosition.column === column){
|
||||
control.closeEditor()
|
||||
}
|
||||
}
|
||||
property bool editVisible: {
|
||||
if(d.editPosition && d.editPosition._key === rowModel._key && d.editPosition.column === column){
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
TableView.onPooled: {
|
||||
if(d.editPosition && d.editPosition.row === row && d.editPosition.column === column){
|
||||
control.closeEditor()
|
||||
}
|
||||
}
|
||||
hoverEnabled: true
|
||||
onEntered: {
|
||||
d.rowHoverIndex = row
|
||||
@ -217,21 +238,33 @@ Rectangle {
|
||||
if(editVisible){
|
||||
updateEditPosition()
|
||||
}
|
||||
if(isMainTable){
|
||||
updateTableItem()
|
||||
}
|
||||
}
|
||||
onHeightChanged: {
|
||||
if(editVisible){
|
||||
updateEditPosition()
|
||||
}
|
||||
if(isMainTable){
|
||||
updateTableItem()
|
||||
}
|
||||
}
|
||||
onXChanged: {
|
||||
if(editVisible){
|
||||
updateEditPosition()
|
||||
}
|
||||
if(isMainTable){
|
||||
updateTableItem()
|
||||
}
|
||||
}
|
||||
onYChanged: {
|
||||
if(editVisible){
|
||||
updateEditPosition()
|
||||
}
|
||||
if(isMainTable){
|
||||
updateTableItem()
|
||||
}
|
||||
}
|
||||
function updateEditPosition(){
|
||||
var obj = {}
|
||||
@ -244,6 +277,12 @@ Rectangle {
|
||||
obj.height = item_table_mouse.height - 2
|
||||
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{
|
||||
anchors.fill: parent
|
||||
color:{
|
||||
@ -253,7 +292,7 @@ Rectangle {
|
||||
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 (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{
|
||||
anchors.fill: parent
|
||||
@ -271,7 +310,7 @@ Rectangle {
|
||||
}
|
||||
loader_edit.display = item_table_loader.display
|
||||
d.editDelegate = d.getEditDelegate(column)
|
||||
updateEditPosition()
|
||||
item_table_mouse.updateEditPosition()
|
||||
}
|
||||
onClicked:
|
||||
(event)=>{
|
||||
@ -297,11 +336,49 @@ Rectangle {
|
||||
}
|
||||
anchors.fill: parent
|
||||
sourceComponent: {
|
||||
if(item_table_mouse.visible){
|
||||
if(isObject){
|
||||
return display.comId
|
||||
}
|
||||
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{
|
||||
anchors.fill: parent
|
||||
@ -358,24 +435,24 @@ Rectangle {
|
||||
ScrollBar.horizontal:scroll_bar_h
|
||||
ScrollBar.vertical:scroll_bar_v
|
||||
columnWidthProvider: function(column) {
|
||||
var columnObject = control.columnSource[column]
|
||||
var width = columnObject.width
|
||||
var columnModel = control.columnSource[column]
|
||||
var width = columnModel.width
|
||||
if(width){
|
||||
return width
|
||||
}
|
||||
var minimumWidth = columnObject.minimumWidth
|
||||
var minimumWidth = columnModel.minimumWidth
|
||||
if(minimumWidth){
|
||||
return minimumWidth
|
||||
}
|
||||
return d.defaultItemWidth
|
||||
}
|
||||
rowHeightProvider: function(row) {
|
||||
var rowObject = control.getRow(row)
|
||||
var height = rowObject.height
|
||||
var rowModel = control.getRow(row)
|
||||
var height = rowModel.height
|
||||
if(height){
|
||||
return height
|
||||
}
|
||||
var minimumHeight = rowObject._minimumHeight
|
||||
var minimumHeight = rowModel._minimumHeight
|
||||
if(minimumHeight){
|
||||
return minimumHeight
|
||||
}
|
||||
@ -388,70 +465,37 @@ Rectangle {
|
||||
table_view.flick(0,1)
|
||||
}
|
||||
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{
|
||||
id:com_column_header_delegate
|
||||
Rectangle{
|
||||
id:column_item_control
|
||||
id: column_item_control
|
||||
property var currentTableView : TableView.view
|
||||
readonly property real cellPadding: 8
|
||||
property bool canceled: false
|
||||
property var _model: model
|
||||
readonly property var columnObject : control.columnSource[column]
|
||||
readonly property var columnModel : control.columnSource[_index]
|
||||
readonly property int _index : {
|
||||
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)
|
||||
}
|
||||
implicitHeight: Math.max(36, (item_column_loader.item&&item_column_loader.item.implicitHeight) + (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
|
||||
}
|
||||
color: FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1)
|
||||
Rectangle{
|
||||
border.color: control.borderColor
|
||||
@ -472,7 +516,7 @@ Rectangle {
|
||||
width: 1
|
||||
height: parent.height
|
||||
anchors.left: parent.left
|
||||
visible: column !== 0
|
||||
visible: column_item_control._index !== 0
|
||||
color:"#00000000"
|
||||
}
|
||||
Rectangle{
|
||||
@ -481,7 +525,7 @@ Rectangle {
|
||||
height: parent.height
|
||||
anchors.right: parent.right
|
||||
color:"#00000000"
|
||||
visible: column === table_view.columns - 1
|
||||
visible: column_item_control._index === table_view.columns - 1
|
||||
}
|
||||
MouseArea{
|
||||
id:column_item_control_mouse
|
||||
@ -504,7 +548,7 @@ Rectangle {
|
||||
FluLoader{
|
||||
id:item_column_loader
|
||||
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 sourceModel: control.sourceModel
|
||||
property bool isObject: typeof(display) == "object"
|
||||
@ -514,7 +558,7 @@ Rectangle {
|
||||
}
|
||||
return {}
|
||||
}
|
||||
property int column: model.column
|
||||
property int column: column_item_control._index
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
sourceComponent: {
|
||||
@ -531,7 +575,7 @@ Rectangle {
|
||||
anchors.right: parent.right
|
||||
acceptedButtons: Qt.LeftButton
|
||||
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
|
||||
preventStealing: true
|
||||
onPressed :
|
||||
@ -551,9 +595,9 @@ Rectangle {
|
||||
return
|
||||
}
|
||||
var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y)
|
||||
var minimumWidth = columnObject.minimumWidth
|
||||
var maximumWidth = columnObject.maximumWidth
|
||||
var w = columnObject.width
|
||||
var minimumWidth = columnModel.minimumWidth
|
||||
var maximumWidth = columnModel.maximumWidth
|
||||
var w = columnModel.width
|
||||
if(!w){
|
||||
w = d.defaultItemWidth
|
||||
}
|
||||
@ -563,9 +607,10 @@ Rectangle {
|
||||
if(!maximumWidth){
|
||||
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()
|
||||
header_horizontal.forceLayout()
|
||||
// column_item_control.currentTableView.forceLayout()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -576,7 +621,7 @@ Rectangle {
|
||||
id:item_control
|
||||
readonly property real cellPadding: 8
|
||||
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))
|
||||
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)
|
||||
@ -642,9 +687,9 @@ Rectangle {
|
||||
cursorShape: Qt.SplitVCursor
|
||||
preventStealing: true
|
||||
visible: {
|
||||
if(rowObject === null)
|
||||
if(rowModel === null)
|
||||
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 :
|
||||
(mouse)=>{
|
||||
@ -662,11 +707,11 @@ Rectangle {
|
||||
if(!pressed){
|
||||
return
|
||||
}
|
||||
var rowObject = control.getRow(row)
|
||||
var rowModel = control.getRow(row)
|
||||
var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y)
|
||||
var minimumHeight = rowObject._minimumHeight
|
||||
var maximumHeight = rowObject._maximumHeight
|
||||
var h = rowObject.height
|
||||
var minimumHeight = rowModel._minimumHeight
|
||||
var maximumHeight = rowModel._maximumHeight
|
||||
var h = rowModel.height
|
||||
if(!h){
|
||||
h = d.defaultItemHeight
|
||||
}
|
||||
@ -676,8 +721,8 @@ Rectangle {
|
||||
if(!maximumHeight){
|
||||
maximumHeight = 65535
|
||||
}
|
||||
rowObject.height = Math.min(Math.max(minimumHeight, h + delta.y),maximumHeight)
|
||||
control.setRow(row,rowObject)
|
||||
rowModel.height = Math.min(Math.max(minimumHeight, h + delta.y),maximumHeight)
|
||||
control.setRow(row,rowModel)
|
||||
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 {
|
||||
id: scroll_bar_h
|
||||
anchors{
|
||||
|
@ -60,8 +60,8 @@ Window {
|
||||
property var _windowRegister
|
||||
property string _route
|
||||
property bool _hideShadow: false
|
||||
id:window
|
||||
color:"transparent"
|
||||
id: window
|
||||
color: FluTools.isSoftware() ? window.backgroundColor : "transparent"
|
||||
Component.onCompleted: {
|
||||
FluRouter.addWindow(window)
|
||||
useSystemAppBar = FluApp.useSystemAppBar
|
||||
@ -301,7 +301,6 @@ Window {
|
||||
info_bar.showError(text,duration,moremsg)
|
||||
}
|
||||
function moveWindowToDesktopCenter(){
|
||||
screen = Qt.application.screens[FluTools.cursorScreenIndex()]
|
||||
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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user