Merge pull request #325 from vkbo/project_tree_stay_put
Don't Auto-Scroll Project Tree
This commit is contained in:
+1
-1
@@ -1815,7 +1815,7 @@ class GuiDocEditHeader(QWidget):
|
|||||||
"""Capture a click on the title and ensure that the item is
|
"""Capture a click on the title and ensure that the item is
|
||||||
selected in the project tree.
|
selected in the project tree.
|
||||||
"""
|
"""
|
||||||
self.theParent.treeView.setSelectedHandle(self.theHandle)
|
self.theParent.treeView.setSelectedHandle(self.theHandle, doScroll=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiDocEditHeader
|
# END Class GuiDocEditHeader
|
||||||
|
|||||||
+1
-1
@@ -542,7 +542,7 @@ class GuiDocViewHeader(QWidget):
|
|||||||
"""Capture a click on the title and ensure that the item is
|
"""Capture a click on the title and ensure that the item is
|
||||||
selected in the project tree.
|
selected in the project tree.
|
||||||
"""
|
"""
|
||||||
self.theParent.treeView.setSelectedHandle(self.theHandle)
|
self.theParent.treeView.setSelectedHandle(self.theHandle, doScroll=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiDocViewHeader
|
# END Class GuiDocViewHeader
|
||||||
|
|||||||
+2
-2
@@ -569,14 +569,14 @@ class GuiProjectTree(QTreeWidget):
|
|||||||
selHandles.append(selItems[n].data(self.C_NAME, Qt.UserRole))
|
selHandles.append(selItems[n].data(self.C_NAME, Qt.UserRole))
|
||||||
return selHandles
|
return selHandles
|
||||||
|
|
||||||
def setSelectedHandle(self, tHandle):
|
def setSelectedHandle(self, tHandle, doScroll=False):
|
||||||
"""Set a specific handle as the selected item.
|
"""Set a specific handle as the selected item.
|
||||||
"""
|
"""
|
||||||
if tHandle in self.theMap:
|
if tHandle in self.theMap:
|
||||||
self.clearSelection()
|
self.clearSelection()
|
||||||
self.theMap[tHandle].setSelected(True)
|
self.theMap[tHandle].setSelected(True)
|
||||||
selItems = self.selectedIndexes()
|
selItems = self.selectedIndexes()
|
||||||
if selItems:
|
if selItems and doScroll:
|
||||||
self.scrollTo(
|
self.scrollTo(
|
||||||
selItems[0], QAbstractItemView.PositionAtCenter
|
selItems[0], QAbstractItemView.PositionAtCenter
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -41,14 +41,14 @@
|
|||||||
<type>ROOT</type>
|
<type>ROOT</type>
|
||||||
<class>NOVEL</class>
|
<class>NOVEL</class>
|
||||||
<status>New</status>
|
<status>New</status>
|
||||||
<expanded>True</expanded>
|
<expanded>False</expanded>
|
||||||
</item>
|
</item>
|
||||||
<item handle="25fc0e7096fc6" order="0" parent="73475cb40a568">
|
<item handle="25fc0e7096fc6" order="0" parent="73475cb40a568">
|
||||||
<name>New Chapter</name>
|
<name>New Chapter</name>
|
||||||
<type>FOLDER</type>
|
<type>FOLDER</type>
|
||||||
<class>NOVEL</class>
|
<class>NOVEL</class>
|
||||||
<status>New</status>
|
<status>New</status>
|
||||||
<expanded>True</expanded>
|
<expanded>False</expanded>
|
||||||
</item>
|
</item>
|
||||||
<item handle="31489056e0916" order="0" parent="25fc0e7096fc6">
|
<item handle="31489056e0916" order="0" parent="25fc0e7096fc6">
|
||||||
<name>Just a Page</name>
|
<name>Just a Page</name>
|
||||||
|
|||||||
Reference in New Issue
Block a user