Skip to content
Snippets Groups Projects
Commit 751b692b authored by Anders H. Rebner's avatar Anders H. Rebner
Browse files

#98 Kodetabeller bruker felles hurtigtast-funksjoner

parent 89940f84
No related branches found
No related tags found
1 merge request!73#98 Kodefrasemodul
Pipeline #83713 passed with stages
in 2 minutes and 22 seconds
......@@ -10,6 +10,8 @@ from soitool.modules.module_base import (
ModuleBase,
get_table_size,
resize_table,
event_is_ctrl_minus,
event_is_ctrl_plus,
HEADLINE_FONT,
TABLE_CELL_DEFAULT_FONT,
)
......@@ -198,18 +200,13 @@ class CodeTableBase(ModuleBase, QTableWidget, metaclass=Meta):
def keyPressEvent(self, event):
"""Add or remove row when 'Ctrl + +' and 'Ctrl + -' are pressed."""
if (
event.modifiers() == Qt.ControlModifier
and event.key() == Qt.Key_Plus
):
if event_is_ctrl_plus(event):
# If a row is selected
row_index = self.currentRow()
if row_index != -1:
self.add_row(row_index)
elif (
event.modifiers() == Qt.ControlModifier
and event.key() == Qt.Key_Underscore
):
elif event_is_ctrl_minus(event):
# If at least two rows (+ headline-row) exists and a row other than
# headline-row is selected
row_index = self.currentRow()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment