mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-05-18 11:52:25 +12:00
Avoid error when moving indexes opened in tabs
This commit is contained in:
parent
3ecd277923
commit
bbf8360b91
|
@ -863,8 +863,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||
self.splitterOutlineV.setStretchFactor(0, 75)
|
||||
self.splitterOutlineV.setStretchFactor(1, 25)
|
||||
|
||||
self.splitterRedac.setStretchFactor(0, 20)
|
||||
self.splitterRedac.setStretchFactor(1, 60)
|
||||
self.splitterRedac.setStretchFactor(0, 30)
|
||||
self.splitterRedac.setStretchFactor(1, 50)
|
||||
self.splitterRedac.setStretchFactor(2, 20)
|
||||
|
||||
# Help box
|
||||
|
|
|
@ -19,6 +19,7 @@ class editorWidget(QWidget, Ui_editorWidget_ui):
|
|||
QWidget.__init__(self, parent)
|
||||
self.setupUi(self)
|
||||
self.currentIndex = QModelIndex()
|
||||
self.currentID = None
|
||||
self.txtEdits = []
|
||||
self.scroll.setBackgroundRole(QPalette.Base)
|
||||
self.toggledSpellcheck.connect(self.txtRedacText.toggleSpellcheck, AUC)
|
||||
|
@ -196,13 +197,22 @@ class editorWidget(QWidget, Ui_editorWidget_ui):
|
|||
def setCurrentModelIndex(self, index=None):
|
||||
if index.isValid():
|
||||
self.currentIndex = index
|
||||
self.currentID = self.mw.mdlOutline.ID(index)
|
||||
#self._model = index.model()
|
||||
else:
|
||||
self.currentIndex = QModelIndex()
|
||||
|
||||
self.setView()
|
||||
|
||||
def updateIndexFromID(self):
|
||||
idx = self.mw.mdlOutline.getIndexByID(self.currentID)
|
||||
if idx != self.currentIndex:
|
||||
self.currentIndex = idx
|
||||
self.setView()
|
||||
|
||||
def modelDataChanged(self, topLeft, bottomRight):
|
||||
if self.currentID:
|
||||
self.updateIndexFromID()
|
||||
if not self.currentIndex:
|
||||
return
|
||||
if topLeft.row() <= self.currentIndex.row() <= bottomRight.row():
|
||||
|
|
|
@ -87,6 +87,7 @@ class mainEditor(QWidget, Ui_mainEditor):
|
|||
if len(self.mw.treeRedacOutline.selectionModel().
|
||||
selection().indexes()) == 0:
|
||||
hidden = False
|
||||
idx = QModelIndex()
|
||||
else:
|
||||
idx = self.mw.treeRedacOutline.currentIndex()
|
||||
|
||||
|
@ -121,10 +122,6 @@ class mainEditor(QWidget, Ui_mainEditor):
|
|||
self.currentEditor().setCurrentModelIndex(index)
|
||||
self.tab.setTabText(self.tab.currentIndex(), title)
|
||||
|
||||
#FIXME: check if tab is already open
|
||||
|
||||
#self.redacEditor.txtRedacText.setCurrentModelIndex
|
||||
#FIXME
|
||||
|
||||
###############################################################################
|
||||
# UI
|
||||
|
@ -182,11 +179,8 @@ class mainEditor(QWidget, Ui_mainEditor):
|
|||
###############################################################################
|
||||
|
||||
def setFolderView(self, view):
|
||||
#FIXME
|
||||
if self.currentEditor():
|
||||
self.currentEditor().setFolderView(view)
|
||||
pass
|
||||
#self.redacEditor.setFolderView(settings.folderView)
|
||||
|
||||
def setCorkSizeFactor(self, val):
|
||||
for w in self.allTabs():
|
||||
|
|
|
@ -76,7 +76,7 @@ class textEditView(QTextEdit):
|
|||
self.spellcheck = False
|
||||
|
||||
if self._highlighting and not self.highlighter:
|
||||
self.highlighter = t2tHighlighter(self)
|
||||
self.highlighter = basicHighlighter(self)
|
||||
self.highlighter.setDefaultBlockFormat(self._defaultBlockFormat)
|
||||
|
||||
def setModel(self, model):
|
||||
|
|
Loading…
Reference in a new issue