ZIMA CAD Parts
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Public Types | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | Properties | Friends | List of all members
NavBar Class Reference

Outlook-like navigation bar. More...

#include <navbar.h>

Inheritance diagram for NavBar:
Inheritance graph
[legend]
Collaboration diagram for NavBar:
Collaboration graph
[legend]

Public Types

enum  { NavBarMarker = 0x4e427232 }
 

Public Slots

void setCurrentIndex (int index)
 
void setCurrentWidget (QWidget *widget)
 
void setRowHeight (int height)
 
void setCollapsed (bool collapse)
 
void setAutoPopup (bool enable)
 
void setShowCollapseButton (bool show)
 
void setShowHeader (bool show)
 
void setShowOptionsMenu (bool show)
 
void setVisibleRows (int rows)
 
int showOptionsDialog ()
 

Signals

void currentChanged (int index)
 
void visibleRowsChanged (int rows)
 
void stateChanged (bool collapsed)
 

Public Member Functions

 NavBar (QWidget *parent=0, Qt::WindowFlags f=0)
 
 ~NavBar ()
 
int addPage (QWidget *page)
 
int addPage (QWidget *page, const QString &text)
 
int addPage (QWidget *page, const QString &text, const QIcon &icon)
 
int insertPage (int index, QWidget *page)
 
int insertPage (int index, QWidget *page, const QString &text)
 
int insertPage (int index, QWidget *page, const QString &text, const QIcon &icon)
 
void removePage (int index)
 
void setPageText (int index, const QString &text)
 
QString pageText (int index) const
 
void setPageIcon (int index, const QIcon &icon)
 
QIcon pageIcon (int index) const
 
void setPageEnabled (int index, bool enabled)
 
bool isPageEnabled (int index)
 
void setPageVisible (int index, bool visible)
 
bool isPageVisible (int index)
 
int currentIndex () const
 
QWidget * currentWidget () const
 
QWidget * widget (int index) const
 
int indexOf (QWidget *widget) const
 
int count () const
 
void setSmallIconSize (const QSize &size)
 
QSize smallIconSize () const
 
void setLargeIconSize (const QSize &size)
 
QSize largeIconSize () const
 
int rowHeight () const
 
bool isCollapsed () const
 
bool autoPopup () const
 
bool showCollapseButton () const
 
bool showHeader () const
 
bool showOptionsMenu () const
 
int visibleRows () const
 
QByteArray saveState (int version=0) const
 
bool restoreState (const QByteArray &state, int version=0)
 
QSize sizeHint () const
 

Static Public Member Functions

static QString loadStyle (const QString &filename)
 

Protected Member Functions

void resizeEvent (QResizeEvent *e)
 
void changeEvent (QEvent *e)
 

Properties

int count
 
int currentIndex
 
int rowHeight
 
bool collapsed
 
bool autoPopup
 
bool showCollapseButton
 
bool showHeader
 
bool showOptionsMenu
 
int visibleRows
 
QSize smallIconSize
 
QSize largeIconSize
 

Friends

class NavBarPageListWidget
 

Detailed Description

Outlook-like navigation bar.

navbar.png

The NavBar class provides a stack of pages where only one page is visible at a time, and page list in lower part of widget, which can be fully or partially folded into toolbar at the bottom.

Example:
NavBar *navBar = new NavBar(this);
navBar->setStyleSheet(NavBar::loadStyle(":/styles/office2003gray.css"));
navBar->addPage(new QLabel("Page 1 contents"), "Page 1", QIcon(":/images/mail.png"));
navBar->addPage(new QLabel("Page 2 contents"), "Page 2", QIcon(":/images/calendar.png"));

Member Enumeration Documentation

anonymous enum
Enumerator
NavBarMarker 

Constructor & Destructor Documentation

NavBar::NavBar ( QWidget *  parent = 0,
Qt::WindowFlags  f = 0 
)
explicit

Constructs new NavBar

Parameters
parentParent widget
fWindowFlags, passed to QFrame constructor
NavBar::~NavBar ( )

Member Function Documentation

int NavBar::addPage ( QWidget *  page)

Adds widget as new page to navigation bar

Parameters
pageWidget to be added as new page
Returns
The new page's index
int NavBar::addPage ( QWidget *  page,
const QString &  text 
)

Adds widget as new page to navigation bar

Parameters
pageWidget to be added as new page
textPage text
Returns
The new page's index
int NavBar::addPage ( QWidget *  page,
const QString &  text,
const QIcon &  icon 
)

Adds widget as new page to navigation bar

Parameters
pageWidget to be added as new page
textPage text
iconPage icon
Returns
The new page's index
bool NavBar::autoPopup ( ) const
void NavBar::changeEvent ( QEvent *  e)
protected
int NavBar::count ( ) const
NavBar::currentChanged ( int  index)
signal

This signal is emitted when the current item is changed.

Parameters
indexIndex of selected page
int NavBar::currentIndex ( ) const
QWidget * NavBar::currentWidget ( ) const

Returns a pointer to the current widget, or 0 if there is no such page.

Returns
Current widget
int NavBar::indexOf ( QWidget *  widget) const

Returns the index of widget, or -1 if the page does not exist.

Parameters
widgetWidget
Returns
Widget's index
int NavBar::insertPage ( int  index,
QWidget *  page 
)

Inserts new page at given position, or at the bottom of the navigation bar if index is out of range.

Parameters
indexPage position
pageWidget
Returns
The new page's index
int NavBar::insertPage ( int  index,
QWidget *  page,
const QString &  text 
)

Inserts new page at given position, or at the bottom of the navigation bar if index is out of range.

Parameters
indexPage position
pageWidget
textPage text
Returns
The new page's index
int NavBar::insertPage ( int  index,
QWidget *  page,
const QString &  text,
const QIcon &  icon 
)

Inserts new page at given position, or at the bottom of the navigation bar if index is out of range.

Parameters
indexPage position
pageWidget
textPage text
iconPage icon
Returns
The new page's index
bool NavBar::isCollapsed ( ) const
bool NavBar::isPageEnabled ( int  index)

Returns true if the page at given position is enabled; otherwise returns false.

Parameters
indexPage index
Returns
Enabled or disabled
bool NavBar::isPageVisible ( int  index)

Returns true if the page at given position is visible; otherwise returns false.

Parameters
indexPage index
Returns
Visible or not
QSize NavBar::largeIconSize ( ) const
QString NavBar::loadStyle ( const QString &  filename)
static

Helper function, which loads text file and returns it content as QString. There are some style sheets, included in resources under :/styles/ path:

  • office2003gray.css
  • office2003blue.css
  • office2003green.css
  • office2003silver.css
  • office2007blue.css
  • office2007black.css
  • office2007silver.css
Example:
navBar->setStyleSheet(NavBar::loadStyle(":/styles/office2003gray.css"));
Note
If you want to use style sheets from navbar resource file, when navbar compiled as static library, you should call Q_INIT_RESOURCE(navbar) in your application, see Q_INIT_RESOURCE.
Parameters
filenameStyle sheet file name
Returns
Style sheet
QIcon NavBar::pageIcon ( int  index) const

Returns the icon of the page at given position, or a null icon if index is out of range.

Parameters
indexPage index
Returns
Page icon
QString NavBar::pageText ( int  index) const

Returns the text of the page at given position, or an empty string if index is out of range.

Parameters
indexPage index
Returns
Page text
void NavBar::removePage ( int  index)

Removes widget from the NavBar. i.e., widget is not deleted but simply removed from the navigation bar, causing it to be hidden.

Parameters
indexIndex of widget to be removed
void NavBar::resizeEvent ( QResizeEvent *  e)
protected
bool NavBar::restoreState ( const QByteArray &  state,
int  version = 0 
)

Restores the state of navigation bar.

Parameters
stateState data
versionVersion number
Returns
True if successfull
int NavBar::rowHeight ( ) const
QByteArray NavBar::saveState ( int  version = 0) const

Saves the current state of navigation bar.

Parameters
versionVersion number, which be stored as part of the data
Returns
State data
void NavBar::setAutoPopup ( bool  enable)
slot

If turned on, navigation bar popup window will appear on page select (when collapsed).

Parameters
enableEnable/Disable
void NavBar::setCollapsed ( bool  collapse)
slot

Toggles navigation bar collapsed state.

Parameters
collapseCollapsed/Normal
void NavBar::setCurrentIndex ( int  index)
slot

Changes active page.

Parameters
indexPage index
void NavBar::setCurrentWidget ( QWidget *  widget)
slot

Makes widget the current widget. The widget must be an item in this navbar.

Parameters
widgetPointer to widget
void NavBar::setLargeIconSize ( const QSize &  size)

Sets size of icons in the bottom toolbar.

Parameters
sizeIcon size
void NavBar::setPageEnabled ( int  index,
bool  enabled 
)

If enabled is true then the page at given position is enabled; otherwise the page at position index is disabled.

Parameters
indexPage index
enabledEnable or disable
void NavBar::setPageIcon ( int  index,
const QIcon &  icon 
)

Sets the icon of the page at given position.

Parameters
indexPage index
iconNew icon
void NavBar::setPageText ( int  index,
const QString &  text 
)

Sets the text of the page at given position.

Parameters
indexPage index
textNew text
void NavBar::setPageVisible ( int  index,
bool  visible 
)

If visible is true then the page at given position is visible; otherwise the page at position index is invisible.

Parameters
indexPage index
enabledEnable or disable
void NavBar::setRowHeight ( int  height)
slot

Set height of a row in a page list.

Parameters
heightRow height
void NavBar::setShowCollapseButton ( bool  show)
slot

Show or hide navigation bar collapse button

Parameters
show
void NavBar::setShowHeader ( bool  show)
slot

Toggles visibility of navbar header

Parameters
showShow or hide
void NavBar::setShowOptionsMenu ( bool  show)
slot

Toggles visibility of options menu button in NavBar toolbar.

Parameters
showShow or hide
void NavBar::setSmallIconSize ( const QSize &  size)

Sets size of icons in the page list.

Parameters
sizeIcon size
void NavBar::setVisibleRows ( int  rows)
slot

Set number of currently visible rows.

Parameters
rowsNumber of rows
bool NavBar::showCollapseButton ( ) const
bool NavBar::showHeader ( ) const
int NavBar::showOptionsDialog ( )
slot

Shows navigation bar options dialog, allowing user to change page order and visibility.

Returns
DialogCode result.
bool NavBar::showOptionsMenu ( ) const
QSize NavBar::sizeHint ( ) const
QSize NavBar::smallIconSize ( ) const
NavBar::stateChanged ( bool  collapsed)
signal

This signal is emitted when navigation bar collapsed or expanded.

Parameters
collapsedTrue if collapsed
int NavBar::visibleRows ( ) const
NavBar::visibleRowsChanged ( int  rows)
signal

This signal is emitted when number of visible rows in navigation bar page list changed, e.g. when splitter is moved.

Parameters
rowsNumber of visible rows
QWidget * NavBar::widget ( int  index) const

Returns the widget at given index, or 0 if there is no such widget.

Parameters
indexWidget index
Returns
Widget

Friends And Related Function Documentation

friend class NavBarPageListWidget
friend

Property Documentation

bool NavBar::autoPopup
readwrite

If turned on, navigation bar popup window will appear on page select (when collapsed). bool autoPopup() const
void setAutoPopup(bool)

NavBar::collapsed
readwrite

Sets navigation bar collapsed state on/off bool isCollaped() const
void setCollapsed(bool) stateChanged(bool)

int NavBar::count
read

Number of pages in navigation bar. int count() const

int NavBar::currentIndex
readwrite

This property holds the index of the current page. int currentIndex() const
void setCurrentIndex(int) currentChanged(int)

QSize NavBar::largeIconSize
readwrite

This property holds size of icons in the page list. int smallIconSize() const
void setSmallIconSize(int)

int NavBar::rowHeight
readwrite

This property holds height of a row in a page list. int rowHeight() const
void setRowHeight(int)

bool NavBar::showCollapseButton
readwrite

Show or hide navigation bar collapse button bool showCollapseButton() const
void setShowCollapseButton(bool)

bool NavBar::showHeader
readwrite

This property controls visibility of NavBar header. bool showHeader() const
void setShowHeader(bool)

bool NavBar::showOptionsMenu
readwrite

This property controls visibility of options menu button in NavBar toolbar. bool showOptionsMenu() const
void setShowOptionsMenu(bool)

QSize NavBar::smallIconSize
readwrite

This property holds size of icons in the bottom toolbar. int smallIconSize() const
void setSmallIconSize(int)

int NavBar::visibleRows
readwrite

This property holds number of currently visible rows. It's value changed when splitter is moved. int visibleRows() const
void setVisibleRows(int) visibleRowsChanged(int)


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