Wow, I feel dumb. That does work perfectly. I must have forgotten to enable mouse tracking when I initially tested it, and then enabled it later when I created the workaround :-)
Nice call, Anthony. On Wed, Jun 17, 2015 at 6:41 PM Anthony Tan <[email protected]> wrote: > Ha. I just went aaaaal the way into the event model and back out again, > subclassing QMainWindow, QListView, etc etc and inspecting things trying to > work out what was up...and then I noticed that stock QListView doesn't > start off tracking mouse movements. > > *sigh* > > Two things. > > - First, just do a setMouseTracking(True) call on your QListView. > > - Second, when you say status line, I presume you mean the main window > status line as in, the Maya master window? If so, this should work. > > If you're expecting it the QMainWindow's status bar, not so much. Works as > expected in Nuke, but I haven't really hacked around much in Maya lately so > can't shed much light on it there or how to easily patch into that. I may > have a play this w/e if the rain keeps up.. > > > > > On Wed, Jun 17, 2015, at 07:39 AM, Justin Israel wrote: > > Good question. I wonder why that isn't working as expected. While it does > store a status tip value that can be retrieved, it doesn't seem to > propagate that. Maybe someone else knows an exact reason... but you could > work around it if you really wanted a status tip to show. QListWidget has > an explicit event for an itemEntered, and with QListView you would have to > track it yourself: > > > *from* PySide *import* QtCore, QtGui > *class* ListView(QtGui.QListView): *def* __init__(self, *args, **kwargs): > super(ListView, self).__init__(*args, **kwargs) > self.__statusBar = *None* *def* mouseMoveEvent(self, e): *if* > self.__statusBar: > idx = self.indexAt(e.pos()) > *if* idx.isValid(): > tip = idx.data(QtCore.Qt.StatusTipRole) > self.__statusBar.showMessage(tip, 5*1000) > *else*: > self.__statusBar.clearMessage() > > *def* setStatusBar(self, bar): *''' Set a reference to a QStatusBar, for > messages '''* > self.__statusBar = bar > self.setMouseTracking(bool(bar)) > *# Usage* > win = QtGui.QMainWindow() > listW = ListView(win) > listW.setStatusBar(win.statusBar()) > mod = QtGui.QStandardItemModel(listW) > listW.setModel(mod) > > item = QtGui.QStandardItem(*"name"*) > item.setToolTip(*"tooltip"*) > item.setStatusTip(*"status tip"*) > mod.appendRow(item) > > win.setCentralWidget(listW) > win.show() > win.raise_() > > > I actually do something a little bit similar to this, when I have my own > random QStatusBar within a widget layout (not the main status bar) and I > want to do custom status bar messages from child widgets. > > On Wed, Jun 17, 2015 at 7:22 AM ynedelin <[email protected]> wrote: > > hey guys, > In QListView QStandartItem statusTip does not show up in the status line > > I am in maya 2015 using pyside > > I have a QListView with a QStandardItemModel with several appended rows of > QStandardItem > > model = QtGui.QStandardItemModel. > item = QtGui.QStandardItem(k) > model.appendRow(item) > item.setToolTip("this is tool tip") > item.setStatusTip("this is status tip") > > tool tip shows up with the mouse hoovering over the item but the status > line remains empty. > > Any ideas ? > > Thanks > Yury > > > > -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/python_inside_maya/78bbbd46-fe77-41b7-84a9-8b3b9161e21a%40googlegroups.com > <https://groups.google.com/d/msgid/python_inside_maya/78bbbd46-fe77-41b7-84a9-8b3b9161e21a%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > > > -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2CsZLahEpTdj50kd5mL0STLn6-1FfXqSe79R-NsPguvw%40mail.gmail.com > <https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2CsZLahEpTdj50kd5mL0STLn6-1FfXqSe79R-NsPguvw%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > > > > -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/python_inside_maya/1434523295.2152909.297684433.1F5ABE9C%40webmail.messagingengine.com > <https://groups.google.com/d/msgid/python_inside_maya/1434523295.2152909.297684433.1F5ABE9C%40webmail.messagingengine.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0jWSQKd3mokp33ePBrmf31GoEzVUBLfm-eBjTvnVAjTA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
