Compare commits

..

No commits in common. "d2fdd086043222e7ee2871be94fd317f101baf10" and "5fd7c7d10ed60349b126393c1e5aef8efbf4325e" have entirely different histories.

9 changed files with 74 additions and 80 deletions

View File

@ -1968,7 +1968,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="499"/> <location filename="qml/page/T_TableView.qml" line="478"/>
<source>Name</source> <source>Name</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -1988,57 +1988,57 @@ Some contents...</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_TableView.qml" line="358"/> <location filename="qml/page/T_TableView.qml" line="337"/>
<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="433"/> <location filename="qml/page/T_TableView.qml" line="412"/>
<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="494"/> <location filename="qml/page/T_TableView.qml" line="473"/>
<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="512"/> <location filename="qml/page/T_TableView.qml" line="491"/>
<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="520"/> <location filename="qml/page/T_TableView.qml" line="498"/>
<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="527"/> <location filename="qml/page/T_TableView.qml" line="505"/>
<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="535"/> <location filename="qml/page/T_TableView.qml" line="513"/>
<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="554"/> <location filename="qml/page/T_TableView.qml" line="532"/>
<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="555"/> <location filename="qml/page/T_TableView.qml" line="533"/>
<source>Next&gt;</source> <source>Next&gt;</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_TableView.qml" line="440"/> <location filename="qml/page/T_TableView.qml" line="419"/>
<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="443"/>
<source>Add a row of Data</source> <source>Add a row of Data</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>

View File

@ -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="499"/> <location filename="qml/page/T_TableView.qml" line="478"/>
<source>Name</source> <source>Name</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -2130,57 +2130,57 @@ Some contents...</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_TableView.qml" line="358"/> <location filename="qml/page/T_TableView.qml" line="337"/>
<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="433"/> <location filename="qml/page/T_TableView.qml" line="412"/>
<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="494"/> <location filename="qml/page/T_TableView.qml" line="473"/>
<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="512"/> <location filename="qml/page/T_TableView.qml" line="491"/>
<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="520"/> <location filename="qml/page/T_TableView.qml" line="498"/>
<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="527"/> <location filename="qml/page/T_TableView.qml" line="505"/>
<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="535"/> <location filename="qml/page/T_TableView.qml" line="513"/>
<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="554"/> <location filename="qml/page/T_TableView.qml" line="532"/>
<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="555"/> <location filename="qml/page/T_TableView.qml" line="533"/>
<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="440"/> <location filename="qml/page/T_TableView.qml" line="419"/>
<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="443"/>
<source>Add a row of Data</source> <source>Add a row of Data</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>

View File

@ -280,27 +280,6 @@ FluContentPage{
} }
} }
Component{
id:com_auto_suggestbox
FluAutoSuggestBox {
id: textbox
anchors.fill: parent
focus: true
Component.onCompleted: {
var data = ["傲来国界花果山水帘洞","傲来国界坎源山脏水洞","大唐国界黑风山黑风洞","大唐国界黄风岭黄风洞","大唐国界骷髅山白骨洞","宝象国界碗子山波月洞","宝象国界平顶山莲花洞","宝象国界压龙山压龙洞","乌鸡国界号山枯松涧火云洞","乌鸡国界衡阳峪黑水河河神府"]
var result = data.map(function(item) {
return {title: item};
});
items = result
textbox.text= String(display)
}
onCommit: {
editTextChaged(textbox.text)
tableView.closeEditor()
}
}
}
Component{ Component{
id:com_avatar id:com_avatar
Item{ Item{
@ -511,7 +490,6 @@ FluContentPage{
{ {
title: qsTr("Address"), title: qsTr("Address"),
dataIndex: 'address', dataIndex: 'address',
editDelegate: com_auto_suggestbox,
width:200, width:200,
minimumWidth:100, minimumWidth:100,
maximumWidth:250 maximumWidth:250

View File

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

View File

@ -141,6 +141,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 QPoint 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,6 +163,10 @@ void FluFrameless::componentComplete() {
} }
int offsetSize; int offsetSize;
bool isMaximum = ::IsZoomed(hwnd); bool isMaximum = ::IsZoomed(hwnd);
auto _offsetXY = QPoint(abs(clientRect->left - originalLeft), abs(clientRect->top - originalTop));
if (_offsetXY.x() != 0) {
offsetXY = _offsetXY;
}
if (isMaximum || _isFullScreen()) { if (isMaximum || _isFullScreen()) {
offsetSize = 0; offsetSize = 0;
} else { } else {
@ -170,10 +175,19 @@ void FluFrameless::componentComplete() {
if (!isCompositionEnabled()) { if (!isCompositionEnabled()) {
offsetSize = 0; offsetSize = 0;
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
clientRect->top = originalTop + offsetSize; clientRect->top = originalTop + offsetSize;
clientRect->bottom = originalBottom - offsetSize; clientRect->bottom = originalBottom - offsetSize;
clientRect->left = originalLeft + offsetSize; clientRect->left = originalLeft + offsetSize;
clientRect->right = originalRight - 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); _setMaximizeHovered(false);
*result = WVR_REDRAW; *result = WVR_REDRAW;
return true; return true;
@ -252,15 +266,27 @@ void FluFrameless::componentComplete() {
return true; return true;
} else if (uMsg == WM_GETMINMAXINFO) { } else if (uMsg == WM_GETMINMAXINFO) {
auto *minmaxInfo = reinterpret_cast<MINMAXINFO *>(lParam); 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 pixelRatio = window()->devicePixelRatio();
auto geometry = window()->screen()->availableGeometry(); auto geometry = window()->screen()->availableGeometry();
RECT rect; RECT rect;
SystemParametersInfo(SPI_GETWORKAREA, 0, &rect, 0); SystemParametersInfo(SPI_GETWORKAREA, 0, &rect, 0);
minmaxInfo->ptMaxPosition.x = rect.left; if (!_fixSize) {
minmaxInfo->ptMaxPosition.y = rect.top; minmaxInfo->ptMinTrackSize.x = qRound(window()->minimumWidth() * pixelRatio + offsetXY.x());
minmaxInfo->ptMaxSize.x = qRound(geometry.width() * pixelRatio); minmaxInfo->ptMinTrackSize.y = qRound(window()->minimumHeight() * pixelRatio + offsetXY.y() + _appbar->height() * pixelRatio);
minmaxInfo->ptMaxSize.y = qRound(geometry.height() * pixelRatio); }
return false; 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
} else if (uMsg == WM_NCRBUTTONDOWN) { } else if (uMsg == WM_NCRBUTTONDOWN) {
if (wParam == HTCAPTION) { if (wParam == HTCAPTION) {
_showSystemMenu(QCursor::pos()); _showSystemMenu(QCursor::pos());

View File

@ -7,7 +7,6 @@ FluTextBox{
property var items:[] property var items:[]
property string emptyText: qsTr("No results found") property string emptyText: qsTr("No results found")
property int autoSuggestBoxReplacement: FluentIcons.Search property int autoSuggestBoxReplacement: FluentIcons.Search
property string textRole: "title"
property var filter: function(item){ property var filter: function(item){
if(item.title.indexOf(control.text)!==-1){ if(item.title.indexOf(control.text)!==-1){
return true return true
@ -26,7 +25,7 @@ FluTextBox{
function handleClick(modelData){ function handleClick(modelData){
control_popup.visible = false control_popup.visible = false
control.itemClicked(modelData) control.itemClicked(modelData)
control.updateText(modelData[textRole]) control.updateText(modelData.title)
} }
function loadData(){ function loadData(){
var result = [] var result = []
@ -49,6 +48,7 @@ FluTextBox{
} }
Popup{ Popup{
id:control_popup id:control_popup
y:control.height
focus: false focus: false
padding: 0 padding: 0
enter: Transition { enter: Transition {
@ -62,7 +62,7 @@ FluTextBox{
contentItem: FluClip{ contentItem: FluClip{
radius: [5,5,5,5] radius: [5,5,5,5]
ListView{ ListView{
id: list_view id:list_view
anchors.fill: parent anchors.fill: parent
clip: true clip: true
boundsBehavior: ListView.StopAtBounds boundsBehavior: ListView.StopAtBounds
@ -72,7 +72,7 @@ FluTextBox{
height: visible ? 38 : 0 height: visible ? 38 : 0
visible: list_view.count === 0 visible: list_view.count === 0
FluText{ FluText{
text: emptyText text:emptyText
anchors{ anchors{
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
left: parent.left left: parent.left
@ -81,10 +81,10 @@ FluTextBox{
} }
} }
delegate:FluControl{ delegate:FluControl{
id: item_control id:item_control
height: 38 height: 38
width: control.width width: control.width
onClicked: { onClicked:{
d.handleClick(modelData) d.handleClick(modelData)
} }
background: Rectangle{ background: Rectangle{
@ -103,7 +103,7 @@ FluTextBox{
} }
} }
contentItem: FluText{ contentItem: FluText{
text: modelData[textRole] text:modelData.title
leftPadding: 10 leftPadding: 10
rightPadding: 10 rightPadding: 10
verticalAlignment : Qt.AlignVCenter verticalAlignment : Qt.AlignVCenter
@ -128,7 +128,7 @@ FluTextBox{
if(d.flagVisible){ if(d.flagVisible){
var pos = control.mapToItem(null, 0, 0) var pos = control.mapToItem(null, 0, 0)
if(d.window.height>pos.y+control.height+rect_background.implicitHeight){ if(d.window.height>pos.y+control.height+rect_background.implicitHeight){
control_popup.y = Qt.binding(function(){return control.height}) control_popup.y = control.height
} else if(pos.y>rect_background.implicitHeight){ } else if(pos.y>rect_background.implicitHeight){
control_popup.y = -rect_background.implicitHeight control_popup.y = -rect_background.implicitHeight
} else { } else {

View File

@ -196,11 +196,6 @@ Rectangle {
id:com_table_delegate id:com_table_delegate
MouseArea{ MouseArea{
id:item_table_mouse 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 rowObject : control.getRow(row)
property var itemModel: model property var itemModel: model
property bool editVisible: { property bool editVisible: {
@ -279,9 +274,9 @@ Rectangle {
if(typeof(display) == "object"){ if(typeof(display) == "object"){
return return
} }
loader_edit.display = display
d.editDelegate = d.getEditDelegate(column) d.editDelegate = d.getEditDelegate(column)
updateEditPosition() updateEditPosition()
loader_edit.display = display
} }
onClicked: onClicked:
(event)=>{ (event)=>{

View File

@ -6,7 +6,6 @@ FluTextBox{
property var items:[] property var items:[]
property string emptyText: qsTr("No results found") property string emptyText: qsTr("No results found")
property int autoSuggestBoxReplacement: FluentIcons.Search property int autoSuggestBoxReplacement: FluentIcons.Search
property string textRole: "title"
property var filter: function(item){ property var filter: function(item){
if(item.title.indexOf(control.text)!==-1){ if(item.title.indexOf(control.text)!==-1){
return true return true
@ -25,7 +24,7 @@ FluTextBox{
function handleClick(modelData){ function handleClick(modelData){
control_popup.visible = false control_popup.visible = false
control.itemClicked(modelData) control.itemClicked(modelData)
control.updateText(modelData[textRole]) control.updateText(modelData.title)
} }
function loadData(){ function loadData(){
var result = [] var result = []
@ -48,6 +47,7 @@ FluTextBox{
} }
Popup{ Popup{
id:control_popup id:control_popup
y:control.height
focus: false focus: false
padding: 0 padding: 0
enter: Transition { enter: Transition {
@ -61,7 +61,7 @@ FluTextBox{
contentItem: FluClip{ contentItem: FluClip{
radius: [5,5,5,5] radius: [5,5,5,5]
ListView{ ListView{
id: list_view id:list_view
anchors.fill: parent anchors.fill: parent
clip: true clip: true
boundsBehavior: ListView.StopAtBounds boundsBehavior: ListView.StopAtBounds
@ -71,7 +71,7 @@ FluTextBox{
height: visible ? 38 : 0 height: visible ? 38 : 0
visible: list_view.count === 0 visible: list_view.count === 0
FluText{ FluText{
text: emptyText text:emptyText
anchors{ anchors{
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
left: parent.left left: parent.left
@ -80,10 +80,10 @@ FluTextBox{
} }
} }
delegate:FluControl{ delegate:FluControl{
id: item_control id:item_control
height: 38 height: 38
width: control.width width: control.width
onClicked: { onClicked:{
d.handleClick(modelData) d.handleClick(modelData)
} }
background: Rectangle{ background: Rectangle{
@ -102,7 +102,7 @@ FluTextBox{
} }
} }
contentItem: FluText{ contentItem: FluText{
text: modelData[textRole] text:modelData.title
leftPadding: 10 leftPadding: 10
rightPadding: 10 rightPadding: 10
verticalAlignment : Qt.AlignVCenter verticalAlignment : Qt.AlignVCenter
@ -127,7 +127,7 @@ FluTextBox{
if(d.flagVisible){ if(d.flagVisible){
var pos = control.mapToItem(null, 0, 0) var pos = control.mapToItem(null, 0, 0)
if(d.window.height>pos.y+control.height+rect_background.implicitHeight){ if(d.window.height>pos.y+control.height+rect_background.implicitHeight){
control_popup.y = Qt.binding(function(){return control.height}) control_popup.y = control.height
} else if(pos.y>rect_background.implicitHeight){ } else if(pos.y>rect_background.implicitHeight){
control_popup.y = -rect_background.implicitHeight control_popup.y = -rect_background.implicitHeight
} else { } else {

View File

@ -196,11 +196,6 @@ Rectangle {
id:com_table_delegate id:com_table_delegate
MouseArea{ MouseArea{
id:item_table_mouse 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 rowObject : control.getRow(row)
property var itemModel: model property var itemModel: model
property bool editVisible: { property bool editVisible: {
@ -279,9 +274,9 @@ Rectangle {
if(typeof(display) == "object"){ if(typeof(display) == "object"){
return return
} }
loader_edit.display = display
d.editDelegate = d.getEditDelegate(column) d.editDelegate = d.getEditDelegate(column)
updateEditPosition() updateEditPosition()
loader_edit.display = display
} }
onClicked: onClicked:
(event)=>{ (event)=>{