Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
朱子楚\zhuzi committed Apr 24, 2024
1 parent 5fd7c7d commit 1f5d6ce
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 74 deletions.
24 changes: 12 additions & 12 deletions example/example_en_US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1968,7 +1968,7 @@ Some contents...</source>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="177"/>
<location filename="qml/page/T_TableView.qml" line="478"/>
<location filename="qml/page/T_TableView.qml" line="498"/>
<source>Name</source>
<translation type="unfinished"></translation>
</message>
Expand All @@ -1988,57 +1988,57 @@ Some contents...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="337"/>
<location filename="qml/page/T_TableView.qml" line="357"/>
<source>Age</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="412"/>
<location filename="qml/page/T_TableView.qml" line="432"/>
<source>Clear All</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="473"/>
<location filename="qml/page/T_TableView.qml" line="493"/>
<source>Avatar</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="491"/>
<location filename="qml/page/T_TableView.qml" line="511"/>
<source>Address</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="498"/>
<location filename="qml/page/T_TableView.qml" line="519"/>
<source>Nickname</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="505"/>
<location filename="qml/page/T_TableView.qml" line="526"/>
<source>Long String</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="513"/>
<location filename="qml/page/T_TableView.qml" line="534"/>
<source>Options</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="532"/>
<location filename="qml/page/T_TableView.qml" line="553"/>
<source>&lt;Previous</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="533"/>
<location filename="qml/page/T_TableView.qml" line="554"/>
<source>Next&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="419"/>
<location filename="qml/page/T_TableView.qml" line="439"/>
<source>Delete Selection</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="443"/>
<location filename="qml/page/T_TableView.qml" line="463"/>
<source>Add a row of Data</source>
<translation type="unfinished"></translation>
</message>
Expand Down
24 changes: 12 additions & 12 deletions example/example_zh_CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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="478"/>
<location filename="qml/page/T_TableView.qml" line="498"/>
<source>Name</source>
<translation type="unfinished">名称</translation>
</message>
Expand All @@ -2130,57 +2130,57 @@ Some contents...</source>
<translation type="unfinished">全选</translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="337"/>
<location filename="qml/page/T_TableView.qml" line="357"/>
<source>Age</source>
<translation type="unfinished">年龄</translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="412"/>
<location filename="qml/page/T_TableView.qml" line="432"/>
<source>Clear All</source>
<translation type="unfinished">清除所有</translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="473"/>
<location filename="qml/page/T_TableView.qml" line="493"/>
<source>Avatar</source>
<translation type="unfinished">头像</translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="491"/>
<location filename="qml/page/T_TableView.qml" line="511"/>
<source>Address</source>
<translation type="unfinished">地址</translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="498"/>
<location filename="qml/page/T_TableView.qml" line="519"/>
<source>Nickname</source>
<translation type="unfinished">昵称</translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="505"/>
<location filename="qml/page/T_TableView.qml" line="526"/>
<source>Long String</source>
<translation type="unfinished">长字符串</translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="513"/>
<location filename="qml/page/T_TableView.qml" line="534"/>
<source>Options</source>
<translation type="unfinished">操作</translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="532"/>
<location filename="qml/page/T_TableView.qml" line="553"/>
<source>&lt;Previous</source>
<translation type="unfinished">&lt;上一页</translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="533"/>
<location filename="qml/page/T_TableView.qml" line="554"/>
<source>Next&gt;</source>
<translation type="unfinished">下一页&gt;</translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="419"/>
<location filename="qml/page/T_TableView.qml" line="439"/>
<source>Delete Selection</source>
<translation type="unfinished">删除选中</translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="443"/>
<location filename="qml/page/T_TableView.qml" line="463"/>
<source>Add a row of Data</source>
<translation type="unfinished">添加一行数据</translation>
</message>
Expand Down
21 changes: 21 additions & 0 deletions example/qml/page/T_TableView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,26 @@ FluContentPage{
}
}

Component{
id:com_auto_suggestbox
FluAutoSuggestBox {
anchors.fill: parent
focus: true
Component.onCompleted: {
var data = ["傲来国界花果山水帘洞","傲来国界坎源山脏水洞","大唐国界黑风山黑风洞","大唐国界黄风岭黄风洞","大唐国界骷髅山白骨洞","宝象国界碗子山波月洞","宝象国界平顶山莲花洞","宝象国界压龙山压龙洞","乌鸡国界号山枯松涧火云洞","乌鸡国界衡阳峪黑水河河神府"]
var result = data.map(function(item) {
return {title: item};
});
items = result
text= String(display)
}
onCommit: {
editTextChaged(text)
tableView.closeEditor()
}
}
}

Component{
id:com_avatar
Item{
Expand Down Expand Up @@ -490,6 +510,7 @@ FluContentPage{
{
title: qsTr("Address"),
dataIndex: 'address',
editDelegate: com_auto_suggestbox,
width:200,
minimumWidth:100,
maximumWidth:250
Expand Down
2 changes: 1 addition & 1 deletion example/qml/window/MainWindow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ FluWindow {
title: "FluentUI"
width: 1000
height: 680
minimumWidth: 1000
minimumWidth: 680
minimumHeight: 200
launchMode: FluWindowType.SingleTask
fitsAppBarWindows: true
Expand Down
36 changes: 5 additions & 31 deletions src/FluFrameless.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ void FluFrameless::componentComplete() {
const auto uMsg = msg->message;
const auto wParam = msg->wParam;
const auto lParam = msg->lParam;
static QPoint offsetXY;
if (uMsg == WM_WINDOWPOSCHANGING) {
auto *wp = reinterpret_cast<WINDOWPOS *>(lParam);
if (wp != nullptr && (wp->flags & SWP_NOSIZE) == 0) {
Expand All @@ -163,10 +162,6 @@ void FluFrameless::componentComplete() {
}
int offsetSize;
bool isMaximum = ::IsZoomed(hwnd);
auto _offsetXY = QPoint(abs(clientRect->left - originalLeft), abs(clientRect->top - originalTop));
if (_offsetXY.x() != 0) {
offsetXY = _offsetXY;
}
if (isMaximum || _isFullScreen()) {
offsetSize = 0;
} else {
Expand All @@ -175,19 +170,10 @@ void FluFrameless::componentComplete() {
if (!isCompositionEnabled()) {
offsetSize = 0;
}
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
clientRect->top = originalTop + offsetSize;
clientRect->bottom = originalBottom - offsetSize;
clientRect->left = originalLeft + offsetSize;
clientRect->right = originalRight - offsetSize;
#else
if (!isMaximum) {
clientRect->top = originalTop + offsetSize;
clientRect->bottom = originalBottom - offsetSize;
clientRect->left = originalLeft + offsetSize;
clientRect->right = originalRight - offsetSize;
}
#endif
_setMaximizeHovered(false);
*result = WVR_REDRAW;
return true;
Expand Down Expand Up @@ -266,27 +252,15 @@ void FluFrameless::componentComplete() {
return true;
} else if (uMsg == WM_GETMINMAXINFO) {
auto *minmaxInfo = reinterpret_cast<MINMAXINFO *>(lParam);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
minmaxInfo->ptMaxPosition.x = 0;
minmaxInfo->ptMaxPosition.y = 0;
minmaxInfo->ptMaxSize.x = 0;
minmaxInfo->ptMaxSize.y = 0;
return false;
#else
auto pixelRatio = window()->devicePixelRatio();
auto geometry = window()->screen()->availableGeometry();
RECT rect;
SystemParametersInfo(SPI_GETWORKAREA, 0, &rect, 0);
if (!_fixSize) {
minmaxInfo->ptMinTrackSize.x = qRound(window()->minimumWidth() * pixelRatio + offsetXY.x());
minmaxInfo->ptMinTrackSize.y = qRound(window()->minimumHeight() * pixelRatio + offsetXY.y() + _appbar->height() * pixelRatio);
}
minmaxInfo->ptMaxPosition.x = rect.left - offsetXY.x();
minmaxInfo->ptMaxPosition.y = rect.top - offsetXY.x();
minmaxInfo->ptMaxSize.x = qRound(geometry.width() * pixelRatio) + offsetXY.x() * 2;
minmaxInfo->ptMaxSize.y = qRound(geometry.height() * pixelRatio) + offsetXY.y() * 2;
return true;
#endif
minmaxInfo->ptMaxPosition.x = rect.left;
minmaxInfo->ptMaxPosition.y = rect.top;
minmaxInfo->ptMaxSize.x = qRound(geometry.width() * pixelRatio);
minmaxInfo->ptMaxSize.y = qRound(geometry.height() * pixelRatio);
return false;
} else if (uMsg == WM_NCRBUTTONDOWN) {
if (wParam == HTCAPTION) {
_showSystemMenu(QCursor::pos());
Expand Down
16 changes: 8 additions & 8 deletions src/Qt5/imports/FluentUI/Controls/FluAutoSuggestBox.qml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ FluTextBox{
property var items:[]
property string emptyText: qsTr("No results found")
property int autoSuggestBoxReplacement: FluentIcons.Search
property string textRole: "title"
property var filter: function(item){
if(item.title.indexOf(control.text)!==-1){
return true
Expand All @@ -25,7 +26,7 @@ FluTextBox{
function handleClick(modelData){
control_popup.visible = false
control.itemClicked(modelData)
control.updateText(modelData.title)
control.updateText(modelData[textRole])
}
function loadData(){
var result = []
Expand All @@ -48,7 +49,6 @@ FluTextBox{
}
Popup{
id:control_popup
y:control.height
focus: false
padding: 0
enter: Transition {
Expand All @@ -62,7 +62,7 @@ FluTextBox{
contentItem: FluClip{
radius: [5,5,5,5]
ListView{
id:list_view
id: list_view
anchors.fill: parent
clip: true
boundsBehavior: ListView.StopAtBounds
Expand All @@ -72,7 +72,7 @@ FluTextBox{
height: visible ? 38 : 0
visible: list_view.count === 0
FluText{
text:emptyText
text: emptyText
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
Expand All @@ -81,10 +81,10 @@ FluTextBox{
}
}
delegate:FluControl{
id:item_control
id: item_control
height: 38
width: control.width
onClicked:{
onClicked: {
d.handleClick(modelData)
}
background: Rectangle{
Expand All @@ -103,7 +103,7 @@ FluTextBox{
}
}
contentItem: FluText{
text:modelData.title
text: modelData[textRole]
leftPadding: 10
rightPadding: 10
verticalAlignment : Qt.AlignVCenter
Expand All @@ -128,7 +128,7 @@ FluTextBox{
if(d.flagVisible){
var pos = control.mapToItem(null, 0, 0)
if(d.window.height>pos.y+control.height+rect_background.implicitHeight){
control_popup.y = control.height
control_popup.y = Qt.binding(function(){return control.height})
} else if(pos.y>rect_background.implicitHeight){
control_popup.y = -rect_background.implicitHeight
} else {
Expand Down
7 changes: 6 additions & 1 deletion src/Qt5/imports/FluentUI/Controls/FluTableView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,11 @@ Rectangle {
id:com_table_delegate
MouseArea{
id:item_table_mouse
TableView.onPooled: {
if(d.editPosition && d.editPosition.row === row && d.editPosition.column === column){
control.closeEditor()
}
}
property var rowObject : control.getRow(row)
property var itemModel: model
property bool editVisible: {
Expand Down Expand Up @@ -274,9 +279,9 @@ Rectangle {
if(typeof(display) == "object"){
return
}
loader_edit.display = display
d.editDelegate = d.getEditDelegate(column)
updateEditPosition()
loader_edit.display = display
}
onClicked:
(event)=>{
Expand Down
Loading

0 comments on commit 1f5d6ce

Please sign in to comment.