diff --git a/example/example_en_US.ts b/example/example_en_US.ts
index ceabe270..e88eb62c 100644
--- a/example/example_en_US.ts
+++ b/example/example_en_US.ts
@@ -1998,7 +1998,17 @@ Some contents...
-
+
+ Delete Selection
+
+
+
+
+ Add a row of Data
+
+
+
+
Insert a Row
@@ -2042,16 +2052,6 @@ Some contents...
Next>
-
-
- Delete Selection
-
-
-
-
- Add a row of Data
-
-
T_Text
diff --git a/example/example_zh_CN.ts b/example/example_zh_CN.ts
index c86300be..f6d98a5e 100644
--- a/example/example_zh_CN.ts
+++ b/example/example_zh_CN.ts
@@ -2140,7 +2140,7 @@ Some contents...
清除所有
-
+
Insert a Row
插入一行
@@ -2190,7 +2190,7 @@ Some contents...
删除选中
-
+
Add a row of Data
添加一行数据
diff --git a/example/qml/page/T_TableView.qml b/example/qml/page/T_TableView.qml
index b309c369..8dee3a97 100644
--- a/example/qml/page/T_TableView.qml
+++ b/example/qml/page/T_TableView.qml
@@ -442,15 +442,15 @@ FluContentPage{
var data = []
var rows = []
for (var i = 0; i < table_view.rows; i++) {
- var item = table_view.getRow(i);
+ var item = table_view.getRow(i)
rows.push(item)
if (!item.checkbox.options.checked) {
data.push(item);
}
}
- var sourceModel = table_view.sourceModel;
+ var sourceModel = table_view.sourceModel
for (i = 0; i < sourceModel.rowCount; i++) {
- var sourceItem = sourceModel.getRow(i);
+ var sourceItem = sourceModel.getRow(i)
const foundItem = rows.find(item=> item._key === sourceItem._key)
if (!foundItem) {
data.push(sourceItem);
@@ -459,7 +459,6 @@ FluContentPage{
table_view.dataSource = data
}
}
-
FluButton{
text: qsTr("Add a row of Data")
onClicked: {
@@ -470,10 +469,11 @@ FluContentPage{
text: qsTr("Insert a Row")
onClicked: {
if(typeof table_view.current !== 'undefined'){
- var newLine = genTestObject()
- var currentLine = dataSource.findIndex(obj => obj._key === table_view.current._key)
- root.dataSource.splice(currentLine, 0, newLine);
- table_view.dataSource = root.dataSource
+ var index = table_view.currentIndex()
+ if(index !== -1){
+ var testObj = genTestObject()
+ table_view.insertRow(index,testObj)
+ }
}else{
showWarning(qsTr("Focus not acquired: Please click any item in the form as the target for insertion!"))
}
diff --git a/src/FluFrameless.cpp b/src/FluFrameless.cpp
index 6f92e2c7..0c2a2337 100644
--- a/src/FluFrameless.cpp
+++ b/src/FluFrameless.cpp
@@ -35,6 +35,22 @@ static inline bool isCompositionEnabled() {
return false;
}
+static inline void setShadow(HWND hwnd){
+ const MARGINS shadow = { 1, 1, 1, 1 };
+ typedef HRESULT (WINAPI* DwmExtendFrameIntoClientAreaPtr)(HWND hWnd, const MARGINS *pMarInset);
+ HMODULE module = LoadLibraryW(L"dwmapi.dll");
+ if (module)
+ {
+ DwmExtendFrameIntoClientAreaPtr dwm_extendframe_into_client_area_;
+ dwm_extendframe_into_client_area_= reinterpret_cast(GetProcAddress(module, "DwmExtendFrameIntoClientArea"));
+ if (dwm_extendframe_into_client_area_)
+ {
+ dwm_extendframe_into_client_area_(hwnd, &shadow);
+ }
+ }
+}
+
+
#endif
bool containsCursorToItem(QQuickItem *item) {
@@ -106,6 +122,7 @@ void FluFrameless::componentComplete() {
::SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED | SWP_NOOWNERZORDER);
::RedrawWindow(hwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW);
});
+ setShadow(hwnd);
#endif
h = qRound(h + _appbar->height());
if (_fixSize) {
@@ -147,20 +164,22 @@ void FluFrameless::componentComplete() {
} else if (uMsg == WM_NCCALCSIZE) {
const auto clientRect = ((wParam == FALSE) ? reinterpret_cast(lParam) : &(reinterpret_cast(lParam))->rgrc[0]);
bool isMaximum = ::IsZoomed(hwnd);
+ const LONG originalTop = clientRect->top;
+ const LONG originalLeft = clientRect->left;
+ const LONG originalBottom = clientRect->bottom;
+ const LONG originalRight = clientRect->right;
+ const LRESULT hitTestResult = ::DefWindowProcW(hwnd, WM_NCCALCSIZE, wParam, lParam);
+ if ((hitTestResult != HTERROR) && (hitTestResult != HTNOWHERE)) {
+ *result = static_cast(hitTestResult);
+ return true;
+ }
if (!isMaximum){
- if (clientRect->top != 0)
- {
- clientRect->top -= 1;
- clientRect->bottom -= 1;
- }
+ clientRect->top = originalTop;
+ clientRect->bottom = originalBottom;
+ clientRect->left = originalLeft;
+ clientRect->right = originalRight;
} else{
- const LONG originalTop = clientRect->top;
- const LRESULT hitTestResult = ::DefWindowProcW(hwnd, WM_NCCALCSIZE, wParam, lParam);
- if ((hitTestResult != HTERROR) && (hitTestResult != HTNOWHERE)) {
- *result = static_cast(hitTestResult);
- return true;
- }
- clientRect->top = originalTop-originalTop;
+ clientRect->top = 0;
}
_setMaximizeHovered(false);
*result = WVR_REDRAW;
@@ -244,8 +263,6 @@ void FluFrameless::componentComplete() {
_setMaximizePressed(false);
return true;
}
- } else if (uMsg == WM_ERASEBKGND) {
- return true;
} else if (uMsg == WM_NCRBUTTONDOWN) {
if (wParam == HTCAPTION) {
_showSystemMenu(QCursor::pos());
diff --git a/src/FluTableSortProxyModel.cpp b/src/FluTableSortProxyModel.cpp
index 644f652a..1723a678 100644
--- a/src/FluTableSortProxyModel.cpp
+++ b/src/FluTableSortProxyModel.cpp
@@ -67,6 +67,10 @@ bool FluTableSortProxyModel::lessThan(const QModelIndex &source_left, const QMod
QMetaObject::invokeMethod(_model, "setRow", Q_ARG(int, mapToSource(index(rowIndex, 0)).row()), Q_ARG(QVariant, val));
}
+[[maybe_unused]] void FluTableSortProxyModel::insertRow(int rowIndex, const QVariant &val) {
+ QMetaObject::invokeMethod(_model, "insertRow", Q_ARG(int, mapToSource(index(rowIndex, 0)).row()), Q_ARG(QVariant, val));
+}
+
[[maybe_unused]] void FluTableSortProxyModel::removeRow(int rowIndex, int rows) {
QMetaObject::invokeMethod(_model, "removeRow", Q_ARG(int, mapToSource(index(rowIndex, 0)).row()), Q_ARG(int, rows));
}
diff --git a/src/FluTableSortProxyModel.h b/src/FluTableSortProxyModel.h
index 7a959f41..05fb1d9e 100644
--- a/src/FluTableSortProxyModel.h
+++ b/src/FluTableSortProxyModel.h
@@ -23,6 +23,8 @@ public:
[[maybe_unused]] Q_INVOKABLE void setRow(int rowIndex, const QVariant &val);
+ [[maybe_unused]] Q_INVOKABLE void insertRow(int rowIndex, const QVariant &val);
+
[[maybe_unused]] Q_INVOKABLE void removeRow(int rowIndex, int rows);
[[maybe_unused]] Q_INVOKABLE void setComparator(const QJSValue &comparator);
diff --git a/src/Qt5/imports/FluentUI/Controls/FluTableView.qml b/src/Qt5/imports/FluentUI/Controls/FluTableView.qml
index b09cab1b..31f81191 100644
--- a/src/Qt5/imports/FluentUI/Controls/FluTableView.qml
+++ b/src/Qt5/imports/FluentUI/Controls/FluTableView.qml
@@ -873,6 +873,25 @@ Rectangle {
table_view.model.removeRow(rowIndex,rows)
}
}
+ function insertRow(rowIndex,obj){
+ if(rowIndex>=0 && rowIndex=0 && rowIndex