rastafaryd
1st June 2010, 21:02
Hi all,
I would like to create a context menu on my column table header, for this i've seen i need to inherit from QHeaderView and write something for contextMenuEvent.
But using even the simplest inherited class would cause me problem.
here is the simplest class :
#include <QHeaderView>
class columnHeaderView : public QHeaderView
{
Q_OBJECT
public :
columnHeaderView( Qt::Orientation p_orientation, QWidget *p_pere ):QHeaderView( p_orientation, p_pere )
{
}
} ;
and now if i do this :
view->setHorizontalHeader(new columnHeaderView( Qt::Horizontal, view )) ;
view->setSortingEnabled(true);
if i don't change the horizontalheader, then i can click on column headers and sort them, but i can't anymore after putting my inherited class....
do you have any comment on this please ?
I would like to create a context menu on my column table header, for this i've seen i need to inherit from QHeaderView and write something for contextMenuEvent.
But using even the simplest inherited class would cause me problem.
here is the simplest class :
#include <QHeaderView>
class columnHeaderView : public QHeaderView
{
Q_OBJECT
public :
columnHeaderView( Qt::Orientation p_orientation, QWidget *p_pere ):QHeaderView( p_orientation, p_pere )
{
}
} ;
and now if i do this :
view->setHorizontalHeader(new columnHeaderView( Qt::Horizontal, view )) ;
view->setSortingEnabled(true);
if i don't change the horizontalheader, then i can click on column headers and sort them, but i can't anymore after putting my inherited class....
do you have any comment on this please ?