mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-10-30 15:57:37 +08:00
update
This commit is contained in:
parent
5f6745b630
commit
d93aac3518
@ -1998,7 +1998,17 @@ Some contents...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_TableView.qml" line="470"/>
|
||||
<location filename="qml/page/T_TableView.qml" line="440"/>
|
||||
<source>Delete Selection</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_TableView.qml" line="463"/>
|
||||
<source>Add a row of Data</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_TableView.qml" line="469"/>
|
||||
<source>Insert a Row</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@ -2042,16 +2052,6 @@ Some contents...</source>
|
||||
<source>Next></source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_TableView.qml" line="440"/>
|
||||
<source>Delete Selection</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_TableView.qml" line="464"/>
|
||||
<source>Add a row of Data</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>T_Text</name>
|
||||
|
@ -2140,7 +2140,7 @@ Some contents...</source>
|
||||
<translation type="unfinished">清除所有</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_TableView.qml" line="470"/>
|
||||
<location filename="qml/page/T_TableView.qml" line="469"/>
|
||||
<source>Insert a Row</source>
|
||||
<translation type="unfinished">插入一行</translation>
|
||||
</message>
|
||||
@ -2190,7 +2190,7 @@ Some contents...</source>
|
||||
<translation type="unfinished">删除选中</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_TableView.qml" line="464"/>
|
||||
<location filename="qml/page/T_TableView.qml" line="463"/>
|
||||
<source>Add a row of Data</source>
|
||||
<translation type="unfinished">添加一行数据</translation>
|
||||
</message>
|
||||
|
@ -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!"))
|
||||
}
|
||||
|
@ -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<DwmExtendFrameIntoClientAreaPtr>(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<LPRECT>(lParam) : &(reinterpret_cast<LPNCCALCSIZE_PARAMS>(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<QT_NATIVE_EVENT_RESULT_TYPE>(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<QT_NATIVE_EVENT_RESULT_TYPE>(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());
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -873,6 +873,25 @@ Rectangle {
|
||||
table_view.model.removeRow(rowIndex,rows)
|
||||
}
|
||||
}
|
||||
function insertRow(rowIndex,obj){
|
||||
if(rowIndex>=0 && rowIndex<table_view.rows){
|
||||
table_view.model.insertRow(rowIndex,obj)
|
||||
}
|
||||
}
|
||||
function currentIndex(){
|
||||
var index = -1
|
||||
if(!d.current){
|
||||
return index
|
||||
}
|
||||
for (var i = 0; i <= table_model.rowCount-1; i++) {
|
||||
var sourceItem = table_model.getRow(i);
|
||||
if(sourceItem._key === d.current._key){
|
||||
index = i
|
||||
break
|
||||
}
|
||||
}
|
||||
return index
|
||||
}
|
||||
function appendRow(obj){
|
||||
table_model.appendRow(obj)
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ Window {
|
||||
}
|
||||
Timer{
|
||||
id:timer_update_image
|
||||
interval: 500
|
||||
interval: 150
|
||||
onTriggered: {
|
||||
img_back.source = ""
|
||||
img_back.source = FluTools.getUrlByFilePath(FluTheme.desktopImagePath)
|
||||
|
@ -873,6 +873,25 @@ Rectangle {
|
||||
table_view.model.removeRow(rowIndex,rows)
|
||||
}
|
||||
}
|
||||
function insertRow(rowIndex,obj){
|
||||
if(rowIndex>=0 && rowIndex<table_view.rows){
|
||||
table_view.model.insertRow(rowIndex,obj)
|
||||
}
|
||||
}
|
||||
function currentIndex(){
|
||||
var index = -1
|
||||
if(!d.current){
|
||||
return index
|
||||
}
|
||||
for (var i = 0; i <= table_model.rowCount-1; i++) {
|
||||
var sourceItem = table_model.getRow(i);
|
||||
if(sourceItem._key === d.current._key){
|
||||
index = i
|
||||
break
|
||||
}
|
||||
}
|
||||
return index
|
||||
}
|
||||
function appendRow(obj){
|
||||
table_model.appendRow(obj)
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ Window {
|
||||
}
|
||||
Timer{
|
||||
id:timer_update_image
|
||||
interval: 500
|
||||
interval: 150
|
||||
onTriggered: {
|
||||
img_back.source = ""
|
||||
img_back.source = FluTools.getUrlByFilePath(FluTheme.desktopImagePath)
|
||||
|
Loading…
Reference in New Issue
Block a user