Isis 3 Programmer Reference
Isis::TabBar Class Reference

A TabBar is a QToolBar which is specifically designed to store and manage Tabs, which are specialized QToolButtons that can hide and show other QWidgets (see Tab). More...

#include <TabBar.h>

Inheritance diagram for Isis::TabBar:
Inheritance graph
Collaboration diagram for Isis::TabBar:
Collaboration graph

Public Member Functions

 TabBar ()
 construct a TabBar
 
virtual ~TabBar ()
 destruct a TabBar
 
virtual void addTab (Tab *newTab)
 Adds a Tab to the TabBar.
 
int curSelectedTab () const
 
void setRadioStyle (const bool &radioStyle)
 If set to true then the effect is that Tabs in the same radio group can only be selected one at a time.
 
bool radioStyle ()
 
int size () const
 
void setSelected (const int &index, const bool &status)
 Sets whether the Tab at the specified index is selected or not.
 
bool isSelected (const int &index)
 
bool noneSelected ()
 
void setEnabled (bool)
 Custom setEnabled method that also calls setEnabled for each of our Tabs.
 

Private Slots

void tabClicked (const int &index)
 SLOT which performs actions that need to be done when we get a SIGNAL from a Tab telling us that it has been clicked.
 

Private Member Functions

bool noOthersInGrpSelected (const int &index) const
 
void deselectOthersInGrp (const int &index)
 

Private Attributes

QVector< Tab * > * tabs
 
bool radioStyleTabs
 

Detailed Description

A TabBar is a QToolBar which is specifically designed to store and manage Tabs, which are specialized QToolButtons that can hide and show other QWidgets (see Tab).

Author
2010-05-07 Eric Hyer
See also
Tab
History

2010-05-07 Eric Hyer - Original Version

2010-06-03 Eric Hyer - Added noneSelected method

2010-09-23 Eric Hyer - Tab's parent is now QAction

  • Removed useDefaults var and functionality
  • Fixed namespace issue

Definition at line 39 of file TabBar.h.

Constructor & Destructor Documentation

◆ TabBar()

Isis::TabBar::TabBar ( )

construct a TabBar

Definition at line 18 of file TabBar.cpp.

◆ ~TabBar()

Isis::TabBar::~TabBar ( )
virtual

destruct a TabBar

Definition at line 28 of file TabBar.cpp.

Member Function Documentation

◆ addTab()

void Isis::TabBar::addTab ( Tab * newTab)
virtual

Adds a Tab to the TabBar.

Note that The TabBar takes ownership of Tabs once they are added!

Parameters
newTabNew Tab to be added

Definition at line 44 of file TabBar.cpp.

References tabClicked().

◆ deselectOthersInGrp()

void Isis::TabBar::deselectOthersInGrp ( const int & index)
private
Parameters
indexIndex of the Tab. The first Tab added to the bar has an index of 0. The last Tab added has an index of size() - 1.

Deselects any other selected Tabs in the given Tab's radio group

Definition at line 206 of file TabBar.cpp.

Referenced by tabClicked().

◆ isSelected()

bool Isis::TabBar::isSelected ( const int & index)
Parameters
indexIndex of the Tab. The first Tab added to the bar has an index of 0. The last Tab added has an index of size() - 1.
Returns
True if the Tab at the given index is selected, false otherwise

Definition at line 111 of file TabBar.cpp.

References isSelected(), and size().

Referenced by isSelected(), noneSelected(), and tabClicked().

◆ noneSelected()

bool Isis::TabBar::noneSelected ( )
Returns
True if no Tabs are currently selected, false otherwise

Definition at line 123 of file TabBar.cpp.

References isSelected().

◆ noOthersInGrpSelected()

bool Isis::TabBar::noOthersInGrpSelected ( const int & index) const
private
Parameters
indexIndex of the Tab. The first Tab added to the bar has an index of 0. The last Tab added has an index of size() - 1.
Returns
True if there are no other Tabs in the given Tab's radio group which are selected, false otherwise.

Definition at line 184 of file TabBar.cpp.

Referenced by tabClicked().

◆ radioStyle()

bool Isis::TabBar::radioStyle ( )
Returns
The current radio style being used

Definition at line 75 of file TabBar.cpp.

Referenced by setRadioStyle().

◆ setEnabled()

void Isis::TabBar::setEnabled ( bool newEnabledStatus)

Custom setEnabled method that also calls setEnabled for each of our Tabs.

Parameters
newEnabledStatusThe new enabled status that will be applied to the TabBar and all of its Tabs

Definition at line 139 of file TabBar.cpp.

References size().

◆ setRadioStyle()

void Isis::TabBar::setRadioStyle ( const bool & radioStyle)

If set to true then the effect is that Tabs in the same radio group can only be selected one at a time.

When a Tab is selected all other Tabs in the same radio group would automatically be deselected. If set to false then all Tabs in the TabBar will behave independent from eachother regardless of how their radio groups are set.

Parameters
radioStyleTrue if radio style should be used, false otherwise

Definition at line 66 of file TabBar.cpp.

References radioStyle().

◆ setSelected()

void Isis::TabBar::setSelected ( const int & index,
const bool & status )

Sets whether the Tab at the specified index is selected or not.

Parameters
indexIndex of the Tab. The first Tab added to the bar has an index of 0. The last Tab added has an index of size() - 1
statusTrue if the Tab should be selected, false otherwise

Definition at line 98 of file TabBar.cpp.

References size().

◆ size()

int Isis::TabBar::size ( ) const
Returns
The number of Tabs currently in the TabBar

Definition at line 84 of file TabBar.cpp.

Referenced by isSelected(), setEnabled(), and setSelected().

◆ tabClicked

void Isis::TabBar::tabClicked ( const int & index)
privateslot

SLOT which performs actions that need to be done when we get a SIGNAL from a Tab telling us that it has been clicked.

What happens is that first the Tab is clicked. The Tab catches this signal and then emits its own clicked SIGNAL which contains its index. This SIGNAL is connected to this SLOT which then takes the appropriate action depending on a couple things. If radioStyle is not being used or if it is but there are no other Tabs in this Tab's radio group then we simply want to toggle the state of the Tab. If radio style is being used and there are others in this Tab's radio group which are selected then the other Tabs are first deselected before the Tab is set to be selected (We know it was not selected before since there was another Tab in its group which was).

Parameters
indexIndex of the Tab which emitted the clicked SIGNAL.

Definition at line 163 of file TabBar.cpp.

References deselectOthersInGrp(), isSelected(), and noOthersInGrpSelected().

Referenced by addTab().

Member Data Documentation

◆ radioStyleTabs

bool Isis::TabBar::radioStyleTabs
private

Definition at line 72 of file TabBar.h.

◆ tabs

QVector< Tab * >* Isis::TabBar::tabs
private

Definition at line 71 of file TabBar.h.


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