Browse Source

sort out column resizing by user and program

master 0.2
Ivan Holmes 5 years ago
parent
commit
b0aa4621fb
  1. 16
      chordsheet/tableView.py

16
chordsheet/tableView.py

@ -30,9 +30,14 @@ class MTableView(QtWidgets.QTableView):
def __init__(self, parent): def __init__(self, parent):
super().__init__(parent) super().__init__(parent)
self.model = MItemModel()
self.setModel(self.model)
self.verticalHeader().hide() self.verticalHeader().hide()
self.horizontalHeader().show() self.horizontalHeader().show()
self.horizontalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Stretch)
self.horizontalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Interactive)
self.horizontalHeader().setStretchLastSection(True)
self.setShowGrid(False) self.setShowGrid(False)
#self.setDragDropMode(self.InternalMove) #self.setDragDropMode(self.InternalMove)
#self.setDragDropOverwriteMode(False) #self.setDragDropOverwriteMode(False)
@ -40,9 +45,6 @@ class MTableView(QtWidgets.QTableView):
# Set our custom style - this draws the drop indicator across the whole row # Set our custom style - this draws the drop indicator across the whole row
self.setStyle(MProxyStyle()) self.setStyle(MProxyStyle())
self.model = MItemModel()
self.setModel(self.model)
class ChordTableView(MTableView): class ChordTableView(MTableView):
def __init__(self, parent): def __init__(self, parent):
@ -60,6 +62,8 @@ class ChordTableView(MTableView):
self.model.appendRow(rowList) self.model.appendRow(rowList)
self.resizeColumnsToContents()
class BlockTableView(MTableView): class BlockTableView(MTableView):
def __init__(self, parent): def __init__(self, parent):
@ -75,4 +79,6 @@ class BlockTableView(MTableView):
item.setEditable(False) item.setEditable(False)
item.setDropEnabled(False) item.setDropEnabled(False)
self.model.appendRow(rowList)
self.model.appendRow(rowList)
self.resizeColumnsToContents()
Loading…
Cancel
Save