[PyQt] HeaderToolTip and Coredump

2009-05-28 Thread Jeroen Andreß

Hi,

I have solved the problem.

the HeaderToolTip must saved in a gobal var.

-- self.__t = HeaderToolTip(table.horizontalHeader())

Jeroen Andreß
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] HeaderToolTip and Coredump

2009-05-18 Thread Jeroen Andreß

hi,

i am working with python qt 3.3. And I want a tooltip on a table header.
Here is my code:

#!/usr/bin/python
# -.- coding: utf-8 -.-

import sys
from qt import *
from qttable import *

class HeaderToolTip(QToolTip):
def __init__(self, header, group=None):
QToolTip.__init__(self, header, group)


def maybeTip(self, p):
header = QToolTip.parentWidget(self)
section = 0
print header.orientation()
if header.orientation() == Qt.Horizontal:
section = header.sectionAt( header.offset() + p.x() )
else:
section = header.sectionAt( header.offset() + p.y() )

tipString = header.label( section )
QToolTip.tip( self, header.sectionRect( section ), tipString )



class MainWidget(QWidget):
def __init__(self, parent=None):
QWidget.__init__(self, parent)
print self
self.layout = QHBoxLayout(self, 5,5,layout)

table = QTable(2,2,self, table)


HeaderToolTip(table.horizontalHeader())

t = HeaderToolTip(table.horizontalHeader())


self.layout.addWidget( table )



if __name__==__main__:
a = QApplication(sys.argv)  
w = MainWidget(None)
table = QTable(5,5,w,table2)
w.layout.addWidget(table)
print w
t = HeaderToolTip(table.horizontalHeader())
a.setMainWidget(w)
w.show()
a.exec_loop()


The rigth table works, but the left exits with core dump.

jeroen
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt