CustomizableHeaderView Class Reference

An enhaced QHeaderView providing a context menu where the user can choose which rows/columns to display and which not. More...

#include <customizableheaderview.h>

List of all members.

Signals

void sectionAboutToBeHidden (int index, Qt::Orientation orientation)
void sectionAboutToBeShown (int index, Qt::Orientation orientation)
void sectionHidden (int index, Qt::Orientation orientation)
void sectionShown (int index, Qt::Orientation orientation)

Public Member Functions

 CustomizableHeaderView (Qt::Orientation orientation, QWidget *parent=0)
virtual ~CustomizableHeaderView ()
QString contextMenuTitle () const
void resetContextMenuTitle ()
void setContextMenuTitle (const QString &title)

Protected Member Functions

virtual void contextMenuEvent (QContextMenuEvent *e)

Properties

QString contextMenuTitle

Private Attributes

QString m_contextMenuTitle


Detailed Description

An enhaced QHeaderView providing a context menu where the user can choose which rows/columns to display and which not.

Each time a context menu is requested by the user, a new context menu is created with the actual data (column/row header names and maybe a menu title).

This class uses by default KMenu from the kdelibs (KDEUI) for the context menu, which gives support for visible menu titles. However when you want a Qt-only version of CustomizableHeaderView, just remove the defination KDE4_SUPPORT from the header file. (In this case, the property contextMenuTitle will no longer be available.)

Definition at line 48 of file customizableheaderview.h.


Constructor & Destructor Documentation

CustomizableHeaderView::CustomizableHeaderView ( Qt::Orientation  orientation,
QWidget *  parent = 0 
) [explicit]

Creates a new generic header.

Parameters:
orientation Qt::Horizontal or Qt::Vertical
parent parent widget

Definition at line 27 of file customizableheaderview.cpp.

CustomizableHeaderView::~CustomizableHeaderView (  )  [virtual]

Generic destructor.

Definition at line 32 of file customizableheaderview.cpp.


Member Function Documentation

void CustomizableHeaderView::contextMenuEvent ( QContextMenuEvent *  e  )  [protected, virtual]

Displays the context menu.

Reimplemented from class QAbstractScrollArea.

Definition at line 58 of file customizableheaderview.cpp.

References contextMenuTitle(), sectionAboutToBeHidden(), sectionAboutToBeShown(), sectionHidden(), and sectionShown().

Here is the call graph for this function:

QString CustomizableHeaderView::contextMenuTitle (  )  const

See property contextMenuTitle.

Referenced by contextMenuEvent().

Here is the caller graph for this function:

void CustomizableHeaderView::resetContextMenuTitle (  ) 

See property contextMenuTitle.

Definition at line 51 of file customizableheaderview.cpp.

References setContextMenuTitle().

Here is the call graph for this function:

void CustomizableHeaderView::sectionAboutToBeHidden ( int  index,
Qt::Orientation  orientation 
) [signal]

This signal is emitted immediately before hiding a row or column because the user used the context menu. It is not emitted when hideSection() or setSectionHidden() was called.

Parameters:
index index of the row or column that will be hidden.
orientation The orientation of the header. If Qt::Horizontal, than a column will be hidden, if Qt::Vertical, a row will be hidden.

Referenced by contextMenuEvent().

Here is the caller graph for this function:

void CustomizableHeaderView::sectionAboutToBeShown ( int  index,
Qt::Orientation  orientation 
) [signal]

This signal is emitted immediately before showing a row or column because the user used the context menu. It is not emitted when setSectionHidden() was called.

Parameters:
index index of the row or column that will be shown.
orientation The orientation of the header. If Qt::Horizontal, than a column will be shown, if Qt::Vertical, a row will be shown.

Referenced by contextMenuEvent().

Here is the caller graph for this function:

void CustomizableHeaderView::sectionHidden ( int  index,
Qt::Orientation  orientation 
) [signal]

This signal is emitted immediately after hiding a row or column because the user used the context menu. It is not emitted when hideSection() or setSectionHidden() was called.

Parameters:
index index of the row or column that has been hidden.
orientation The orientation of the header. If Qt::Horizontal, than a column was hidden, if Qt::Vertical, a row was hidden.

Referenced by contextMenuEvent().

Here is the caller graph for this function:

void CustomizableHeaderView::sectionShown ( int  index,
Qt::Orientation  orientation 
) [signal]

This signal is emitted immediately after showing a row or column because the user used the context menu. It is not emitted when setSectionHidden() was called.

Parameters:
index index of the row or column that has been shown.
orientation The orientation of the header. If Qt::Horizontal, than a column was shown, if Qt::Vertical, a row was shown.

Referenced by contextMenuEvent().

Here is the caller graph for this function:

void CustomizableHeaderView::setContextMenuTitle ( const QString &  title  ) 

See property contextMenuTitle.

Definition at line 46 of file customizableheaderview.cpp.

References m_contextMenuTitle.

Referenced by resetContextMenuTitle().

Here is the caller graph for this function:


Member Data Documentation

Used internally to store the property contextMenuTitle.

Definition at line 132 of file customizableheaderview.h.

Referenced by setContextMenuTitle().


Property Documentation

QString CustomizableHeaderView::contextMenuTitle [read, write]

This property holds the title of the context menu. If empty (which is default), no title is displayed.

This property is only available when KDE4_SUPPORT is defined - what is the default.
See also:
m_contextMenuTitle

KDE4_SUPPORT

Definition at line 67 of file customizableheaderview.h.


The documentation for this class was generated from the following files:

doxygen