WIP: replace notes TableWidgetItem with TextEdit
This commit is contained in:
parent
4fad05db6b
commit
7b2b7fada5
@ -6,12 +6,18 @@ from collections import namedtuple
|
|||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
from PyQt5.QtCore import QEvent, QModelIndex, Qt, pyqtSignal
|
from PyQt5.QtCore import (
|
||||||
|
pyqtSignal,
|
||||||
|
QEvent,
|
||||||
|
QModelIndex,
|
||||||
|
QSize,
|
||||||
|
Qt,
|
||||||
|
)
|
||||||
from PyQt5.QtGui import (
|
from PyQt5.QtGui import (
|
||||||
QBrush,
|
QBrush,
|
||||||
QColor,
|
QColor,
|
||||||
QFont,
|
QFont,
|
||||||
QDropEvent
|
QDropEvent,
|
||||||
)
|
)
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
QAbstractItemDelegate,
|
QAbstractItemDelegate,
|
||||||
@ -88,10 +94,14 @@ class NoSelectDelegate(QStyledItemDelegate):
|
|||||||
editor.selectionChanged.disconnect(deselect)
|
editor.selectionChanged.disconnect(deselect)
|
||||||
editor.deselect()
|
editor.deselect()
|
||||||
editor.selectionChanged.connect(deselect)
|
editor.selectionChanged.connect(deselect)
|
||||||
textedit = QTextEdit(parent)
|
# self.old_editor = editor
|
||||||
textedit.setPlainText(editor.text())
|
# textedit = QTextEdit(parent)
|
||||||
|
# textedit.setPlainText(editor.text())
|
||||||
return textedit
|
return textedit
|
||||||
|
|
||||||
|
# def destroyEditor(self, editor, index):
|
||||||
|
# self.old_editor.setText(editor.toPlainText())
|
||||||
|
# super().destroyEditor(self, self.old_editor, index)
|
||||||
|
|
||||||
class PlaylistTab(QTableWidget):
|
class PlaylistTab(QTableWidget):
|
||||||
# Qt.UserRoles
|
# Qt.UserRoles
|
||||||
@ -584,8 +594,12 @@ class PlaylistTab(QTableWidget):
|
|||||||
|
|
||||||
# As we have track info, any notes should be contained in
|
# As we have track info, any notes should be contained in
|
||||||
# the notes column
|
# the notes column
|
||||||
notes_item = QTableWidgetItem(row_data.note)
|
temp_item = QTableWidgetItem()
|
||||||
self.setItem(row, columns['row_notes'].idx, notes_item)
|
self.setItem(row, columns['row_notes'].idx, temp_item)
|
||||||
|
notes_item = QTextEdit(row_data.note)
|
||||||
|
minimum_size = QSize(25, 25)
|
||||||
|
notes_item.setMinimumSize(minimum_size)
|
||||||
|
self.setCellWidget(row, columns['row_notes'].idx, notes_item)
|
||||||
|
|
||||||
last_playtime = Playdates.last_played(session, row_data.track.id)
|
last_playtime = Playdates.last_played(session, row_data.track.id)
|
||||||
last_played_str = get_relative_date(last_playtime)
|
last_played_str = get_relative_date(last_playtime)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user