StandardTableView: Remove the editable feature for now

This commit can be reverted when we want to introduce it again.
There is a few bugs with the editable property:
 - The text is not in sync with the model if the model changes after an
   edit. (can be seen by making an edit and then sort)
 - The highlight of the current row doesn't work properly
 - We should probably only edit on double click or some shortcut instead
   of just clicking
 - The editable field exist but does nothing for the StandardListView
This commit is contained in:
Olivier Goffart 2023-01-23 16:22:50 +01:00 committed by Olivier Goffart
parent b718c9c043
commit a0fdf94fb1
9 changed files with 9 additions and 47 deletions

View file

@ -400,7 +400,6 @@ PropertyAnimation := _ {
export struct StandardListViewItem := {
//-name:slint::StandardListViewItem
text: string,
editable: bool,
}
export struct TableColumn := {

View file

@ -185,17 +185,7 @@ export component StandardTableView {
max-width: (index < columns.length && columns[index].width >= 1px) ? max(columns[index].min-width, columns[index].width) : 100000px;
Rectangle {
// height: 100%;
line-edit := LineEditInner {
opacity: self.has-focus ? 1.0 : 0.0;
visible: cell.editable;
text: cell.text;
edited => {
cell.text = self.text;
}
}
if(!cell.editable || !line-edit.has-focus) : Text {
Text {
width: 100%;
height: 100%;
overflow: elide;

View file

@ -181,16 +181,7 @@ export component StandardTableView {
max-width: (index < columns.length && columns[index].width >= 1px) ? max(columns[index].min-width, columns[index].width) : 100000px;
Rectangle {
line-edit := LineEditInner {
opacity: self.has-focus ? 1.0 : 0.0;
visible: cell.editable;
text: cell.text;
edited => {
cell.text = self.text;
}
}
if(!cell.editable || !line-edit.has-focus) : Text {
Text {
width: 100%;
height: 100%;
overflow: elide;

View file

@ -317,19 +317,7 @@ export component StandardTableView {
preferred-width: self.min-width;
max-width: (index < columns.length && columns[index].width >= 1px) ? max(columns[index].min-width, columns[index].width) : 100000px;
HorizontalLayout {
if cell.editable : NativeStandardListViewItem {
index: i;
//is-selected: root.current-item == i;
has-hover: row-ta.has-hover;
LineEditInner {
text: cell.text;
edited => {
cell.text = self.text;
}
}
}
if !cell.editable : NativeStandardListViewItem {
NativeStandardListViewItem {
item: cell;
index: i;
//is-selected: root.current-item == i;