Skip to content

Commit

Permalink
fix mouse hover in Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
kklmn committed Mar 8, 2024
1 parent 0b15631 commit 1130744
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 10 additions & 8 deletions parseq/gui/fileTreeModelView.py
Original file line number Diff line number Diff line change
Expand Up @@ -896,10 +896,12 @@ def paint(self, painter, option, index):

active = (option.state & qt.QStyle.State_Selected or
option.state & qt.QStyle.State_MouseOver)
if active:
if active and self.parent().transformNode:
loadState = index.data(LOAD_DATASET_ROLE)
cf = self.parent().transformNode.widget.columnFormat
cf = cf.saveButton.setEnabled(loadState is not None)
else:
loadState = None

if option.state & qt.QStyle.State_MouseOver:
# color = self.parent().palette().highlight().color()
Expand Down Expand Up @@ -942,10 +944,10 @@ def __init__(self, transformNode=None, parent=None, rootPath=''):

self.initModel()

if transformNode is not None:
self.setItemDelegateForColumn(0, SelectionDelegate(self))
if parent is not None:
self.parent().setMouseTracking(True)
self.setItemDelegateForColumn(0, SelectionDelegate(self))
if parent is not None:
self.parent().setMouseTracking(True) # for Windows
self.viewport().setAttribute(qt.Qt.WA_Hover) # for Linux

# self.setMinimumSize(
# qt.QSize(int(COLUMN_NAME_WIDTH*csi.screenFactor), 250))
Expand Down Expand Up @@ -978,8 +980,8 @@ def __init__(self, transformNode=None, parent=None, rootPath=''):
"View text file (will be displayed in 'metadata' panel)",
self.viewTextFile, "F3")

self.setStyleSheet("QTreeView"
"{selection-background-color: transparent;}")
# self.setStyleSheet("QTreeView"
# "{selection-background-color: transparent;}")

# # uncomment for testing the file model:
# from ..tests.modeltest import ModelTest
Expand Down Expand Up @@ -1570,7 +1572,7 @@ def gotoWhenReady(self, path, callback=True):
"""Going directly to a file or directory is not possible because of the
lazy loading mechanism. This is implemented here in 3 steps:
1) Go to the containing dir. This sends reques to QFileSystemModel to
1) Go to the containing dir. This sends request to QFileSystemModel to
populate it.
2) When the dir is ready, QFileSystemModel emits directoryLoaded
Expand Down
2 changes: 0 additions & 2 deletions parseq/tests/test_fileTreeModelView.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

import sys; sys.path.append('../..') # analysis:ignore
from parseq.gui.fileTreeModelView import FileTreeView
# from silx.gui.hdf5.Hdf5TreeView import Hdf5TreeView


def test1():
Expand Down Expand Up @@ -52,7 +51,6 @@ def gotoLastData():
path = 'silx:data/hdf5/20240213s.h5::/entry29270/instrument'

view = FileTreeView()
# view = Hdf5TreeView()
view.setMinimumSize(qt.QSize(700, 600))
view.header().resizeSection(0, 320)
view.setWindowTitle("Merged Tree Model: QFileSystemModel + h5Model")
Expand Down

0 comments on commit 1130744

Please sign in to comment.