mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-05-14 09:52:27 +12:00
Tracking segfault, hopefuly done now
This commit is contained in:
parent
e6913849de
commit
50dc7f3739
|
@ -605,8 +605,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||
self.mdlCharacter.dataChanged.connect(self.mdlPlots.updatePlotPersoButton)
|
||||
self.lstOutlinePlots.setPlotModel(self.mdlPlots)
|
||||
self.lstOutlinePlots.setShowSubPlot(True)
|
||||
self.plotPersoDelegate = outlineCharacterDelegate(self.mdlCharacter, self)
|
||||
self.lstPlotPerso.setItemDelegate(self.plotPersoDelegate)
|
||||
self.plotCharacterDelegate = outlineCharacterDelegate(self.mdlCharacter, self)
|
||||
self.lstPlotPerso.setItemDelegate(self.plotCharacterDelegate)
|
||||
self.plotDelegate = plotDelegate(self)
|
||||
self.lstSubPlots.setItemDelegateForColumn(Subplot.meta.value, self.plotDelegate)
|
||||
|
||||
|
|
|
@ -30,12 +30,9 @@ class characterModel(QAbstractItemModel):
|
|||
# Returns characters infos
|
||||
return 2
|
||||
else:
|
||||
return 1
|
||||
return len(C)
|
||||
|
||||
def data(self, index, role=Qt.DisplayRole):
|
||||
if not index.isValid():
|
||||
return None
|
||||
|
||||
c = index.internalPointer()
|
||||
if type(c) == Character:
|
||||
if role == Qt.DisplayRole:
|
||||
|
|
|
@ -101,9 +101,9 @@ class outlineCharacterDelegate(QStyledItemDelegate):
|
|||
# s = QStyledItemDelegate.sizeHint(self, option, index)
|
||||
|
||||
item = QModelIndex()
|
||||
for i in range(self.mdlCharacter.rowCount()):
|
||||
if self.mdlCharacter.ID(i) == index.data():
|
||||
item = self.mdlCharacter.index(i, Character.name.value)
|
||||
character = self.mdlCharacter.getCharacterByID(index.data())
|
||||
if character:
|
||||
item = character.index(Character.name.value)
|
||||
|
||||
opt = QStyleOptionViewItem(option)
|
||||
self.initStyleOption(opt, item)
|
||||
|
@ -158,18 +158,21 @@ class outlineCharacterDelegate(QStyledItemDelegate):
|
|||
# QStyledItemDelegate.paint(self, painter, option, index)
|
||||
##option.rect.setWidth(option.rect.width() + 18)
|
||||
|
||||
item = QModelIndex()
|
||||
for i in range(self.mdlCharacter.rowCount()):
|
||||
if self.mdlCharacter.ID(i) == index.data():
|
||||
item = self.mdlCharacter.index(i, Character.name.value)
|
||||
itemIndex = QModelIndex()
|
||||
character = self.mdlCharacter.getCharacterByID(index.data())
|
||||
if character:
|
||||
itemIndex = character.index(Character.name.value)
|
||||
else:
|
||||
# Character ID not found in character model.
|
||||
return
|
||||
|
||||
opt = QStyleOptionViewItem(option)
|
||||
self.initStyleOption(opt, item)
|
||||
self.initStyleOption(opt, itemIndex)
|
||||
|
||||
qApp.style().drawControl(QStyle.CE_ItemViewItem, opt, painter)
|
||||
|
||||
# if index.isValid() and index.internalPointer().data(Outline.POV.value) not in ["", None]:
|
||||
if index.isValid() and self.mdlCharacter.data(index) not in ["", None]:
|
||||
if itemIndex.isValid() and self.mdlCharacter.data(itemIndex) not in ["", None]:
|
||||
opt = QStyleOptionComboBox()
|
||||
opt.rect = option.rect
|
||||
r = qApp.style().subControlRect(QStyle.CC_ComboBox, opt, QStyle.SC_ComboBoxArrow)
|
||||
|
|
Loading…
Reference in a new issue