Back to index

salome-gui  6.5.0
Signals | Public Member Functions | Protected Member Functions | Private Slots | Private Attributes
QtxWorkstackTabBar Class Reference

Workstack tab bar widget. More...

#include <QtxWorkstack.h>

List of all members.

Signals

void dragActiveTab ()
 Emitted when dragging operation is started.
void contextMenuRequested (QPoint)
 Emitted when context popup menu is requested.

Public Member Functions

 QtxWorkstackTabBar (QWidget *=0)
 Constructor.
virtual ~QtxWorkstackTabBar ()
 Destructor.
bool isActive () const
 Check if the tab bar is active.
void setActive (const bool)
 Set tab bar active/inactive.
int tabId (const int) const
 Get tab page identifier.
int indexOf (const int) const
 Get tab page index by specified identifier.
void setTabId (const int, const int)
 Set tab page identifier.
void updateActiveState ()
 Update tab bar according to the 'active' state.

Protected Member Functions

virtual void changeEvent (QEvent *)
 Process widget change state events (style, palette, enable state changing, etc).
virtual void mouseMoveEvent (QMouseEvent *)
 Customize mouse move event handler.
virtual void mousePressEvent (QMouseEvent *)
 Customize mouse press event handler.
virtual void mouseReleaseEvent (QMouseEvent *)
 Customize mouse release event handler.
virtual void contextMenuEvent (QContextMenuEvent *)
 Customize context menu event handler.

Private Slots

void onCurrentChanged (int)
 Called when current tab page is changed.

Private Attributes

int myId
 current tab page index
bool myActive
 "active" status

Detailed Description

Workstack tab bar widget.

Definition at line 339 of file QtxWorkstack.h.


Constructor & Destructor Documentation

QtxWorkstackTabBar::QtxWorkstackTabBar ( QWidget *  parent = 0)

Constructor.

Parameters:
parentparent widget

Definition at line 1510 of file QtxWorkstack.cxx.

: QTabBar( parent ),
  myId( -1 ),myActive(false)
{
  setDrawBase( true );
  setElideMode( Qt::ElideNone );

  connect( this, SIGNAL( currentChanged( int ) ), this, SLOT( onCurrentChanged( int ) ) );
}

Here is the call graph for this function:

Destructor.

Definition at line 1523 of file QtxWorkstack.cxx.

{
}

Member Function Documentation

void QtxWorkstackTabBar::changeEvent ( QEvent *  ) [protected, virtual]

Process widget change state events (style, palette, enable state changing, etc).

Parameters:
echange event (not used)

Definition at line 1663 of file QtxWorkstack.cxx.

Here is the call graph for this function:

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

Customize context menu event handler.

Parameters:
econtext menu event

Definition at line 1653 of file QtxWorkstack.cxx.

{
  if ( e->reason() != QContextMenuEvent::Mouse )
    emit contextMenuRequested( e->globalPos() );
}

Here is the call graph for this function:

Emitted when context popup menu is requested.

Parameters:
ppoint popup menu to be shown at

Here is the caller graph for this function:

Emitted when dragging operation is started.

Here is the caller graph for this function:

int QtxWorkstackTabBar::indexOf ( const int  id) const

Get tab page index by specified identifier.

Parameters:
idtab page ID
Returns:
tab page index or -1 if not found

Definition at line 1555 of file QtxWorkstack.cxx.

{
  int index = -1;
  for ( int i = 0; i < (int)count() && index < 0; i++ )
  {
    if ( tabId( i ) == id )
      index = i;
  }
  return index;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Check if the tab bar is active.

Returns:
true if tab bar is active

Definition at line 1570 of file QtxWorkstack.cxx.

{
  return myActive;
}

Here is the caller graph for this function:

void QtxWorkstackTabBar::mouseMoveEvent ( QMouseEvent *  e) [protected, virtual]

Customize mouse move event handler.

Parameters:
emouse event

Definition at line 1612 of file QtxWorkstack.cxx.

{
  if ( myId != -1 && !tabRect( indexOf( myId ) ).contains( e->pos() ) )
  {
    myId = -1;
    emit dragActiveTab();
  }

  QTabBar::mouseMoveEvent( e );
}

Here is the call graph for this function:

void QtxWorkstackTabBar::mousePressEvent ( QMouseEvent *  e) [protected, virtual]

Customize mouse press event handler.

Parameters:
emouse event

Definition at line 1627 of file QtxWorkstack.cxx.

{
  QTabBar::mousePressEvent( e );

  if ( e->button() == Qt::LeftButton )
    myId = tabId( currentIndex() );
}

Here is the call graph for this function:

void QtxWorkstackTabBar::mouseReleaseEvent ( QMouseEvent *  e) [protected, virtual]

Customize mouse release event handler.

Parameters:
emouse event

Definition at line 1639 of file QtxWorkstack.cxx.

{
  QTabBar::mouseReleaseEvent( e );

  myId = -1;

  if ( e->button() == Qt::RightButton )
    emit contextMenuRequested( e->globalPos() );
}

Here is the call graph for this function:

void QtxWorkstackTabBar::onCurrentChanged ( int  ) [private, slot]

Called when current tab page is changed.

Parameters:
idxtab page index (not used)

Definition at line 1603 of file QtxWorkstack.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void QtxWorkstackTabBar::setActive ( const bool  on)

Set tab bar active/inactive.

Parameters:
onnew active state

Definition at line 1579 of file QtxWorkstack.cxx.

{
  if ( myActive == on )
    return;

  myActive = on;
  updateActiveState();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void QtxWorkstackTabBar::setTabId ( const int  index,
const int  id 
)

Set tab page identifier.

Parameters:
indextab page index
idtab page ID

Definition at line 1545 of file QtxWorkstack.cxx.

{
  setTabData( index, id );
}

Here is the caller graph for this function:

int QtxWorkstackTabBar::tabId ( const int  index) const

Get tab page identifier.

Parameters:
indextab page index
Returns:
tab page ID or -1 if index is out of range

Definition at line 1532 of file QtxWorkstack.cxx.

{
  QVariant v = tabData( index );
  if ( !v.canConvert( QVariant::Int ) )
    return -1;
  return v.toInt();
}

Here is the caller graph for this function:

Update tab bar according to the 'active' state.

Definition at line 1591 of file QtxWorkstack.cxx.

{
  QColor bc = palette().color( QPalette::Text );
  QColor ac = isActive() ? palette().color( QPalette::Highlight ) : bc;
  for ( int i = 0; i < (int)count(); i++ )
    setTabTextColor( i, currentIndex() == i ? ac : bc );
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

"active" status

Definition at line 372 of file QtxWorkstack.h.

int QtxWorkstackTabBar::myId [private]

current tab page index

Definition at line 371 of file QtxWorkstack.h.


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