Skip to content

Commit

Permalink
update style
Browse files Browse the repository at this point in the history
  • Loading branch information
hanjinliu committed Jul 8, 2024
1 parent fb3bc6a commit 42b6f0a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tabulous/_qt/_table/_base/_enhanced_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,11 @@ def _on_moved(self, src: Index, dst: Index) -> None:
self._update_all(rect)
return None

def _close_editor(self):
if isinstance(line := self._focused_widget, (QCellLiteralEdit, QCellLabelEdit)):
cast("QCellLiteralEdit | QCellLabelEdit", line)._hide_and_delete()
return None

def copy(self, link: bool = True) -> _QTableViewEnhanced:
"""Make a copy of the table."""
new = _QTableViewEnhanced(self.parentTable())
Expand All @@ -284,6 +289,7 @@ def copy(self, link: bool = True) -> _QTableViewEnhanced:
new._selection_model = self._selection_model
new._selection_model.moving.connect(new._on_moving)
new._selection_model.moved.connect(new._on_moved)
new.rightClickedSignal.connect(self.parentTable().showContextMenu)
new._table_map = self._table_map
new.setZoom(self.zoom())
new._selection_model.current_index = self._selection_model.current_index
Expand Down Expand Up @@ -400,6 +406,10 @@ def mouseDoubleClickEvent(self, e: QtGui.QMouseEvent) -> None:
index = self.indexAt(e.pos())
if not index.isValid():
return None

if e.buttons() != Qt.MouseButton.LeftButton:
return None

from ._table_base import QMutableTable

table = self.parentTable()
Expand Down
4 changes: 4 additions & 0 deletions tabulous/style/_style.qss
Original file line number Diff line number Diff line change
Expand Up @@ -622,3 +622,7 @@ QCircularProgressBar {
qproperty-color: #[highlight0];
qproperty-grooveColor: #[background0];
}

QtDockWidget {
border: 1px solid #[highlight0];
}
1 change: 1 addition & 0 deletions tabulous/widgets/_mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ def add_layer(self, input: TableBase, *, update: bool = False):
table_has_focus = table.native._qtable_view.hasFocus()
else:
table_has_focus = False
self.current_table._qwidget._qtable_view._close_editor()
if (
update
and (table := self.tables.get(input.name, None))
Expand Down

0 comments on commit 42b6f0a

Please sign in to comment.