• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

Plasma

  • Plasma
  • TabBar
Public Slots | Signals | Public Member Functions | Protected Member Functions | Properties | List of all members
Plasma::TabBar Class Reference

#include <Plasma/Widgets/TabBar>

Inheritance diagram for Plasma::TabBar:
QGraphicsWidget

Public Slots

void setCurrentIndex (int index)
 

Signals

void currentChanged (int index)
 

Public Member Functions

 TabBar (QGraphicsWidget *parent=0)
 
 ~TabBar ()
 
Q_INVOKABLE int addTab (const QIcon &icon, const QString &label, QGraphicsLayoutItem *content=0)
 
Q_INVOKABLE int addTab (const QString &label, QGraphicsLayoutItem *content=0)
 
int count () const
 
int currentIndex () const
 
QGraphicsWidget * firstPositionWidget () const
 
Q_INVOKABLE int insertTab (int index, const QIcon &icon, const QString &label, QGraphicsLayoutItem *content=0)
 
Q_INVOKABLE int insertTab (int index, const QString &label, QGraphicsLayoutItem *content=0)
 
bool isTabBarShown () const
 
Q_INVOKABLE bool isTabHighlighted (int index) const
 
QGraphicsWidget * lastPositionWidget () const
 
KTabBar * nativeWidget () const
 
Q_INVOKABLE void removeTab (int index)
 
void setFirstPositionWidget (QGraphicsWidget *widget)
 
void setLastPositionWidget (QGraphicsWidget *widget)
 
void setStyleSheet (const QString &stylesheet)
 
void setTabBarShown (bool show)
 
Q_INVOKABLE void setTabHighlighted (int index, bool highlight)
 
Q_INVOKABLE void setTabIcon (int index, const QIcon &icon)
 
Q_INVOKABLE void setTabText (int index, const QString &label)
 
QString styleSheet () const
 
Q_INVOKABLE QGraphicsLayoutItem * tabAt (int index)
 
Q_INVOKABLE QIcon tabIcon (int index) const
 
Q_INVOKABLE QString tabText (int index) const
 
Q_INVOKABLE QGraphicsLayoutItem * takeTab (int index)
 

Protected Member Functions

void changeEvent (QEvent *event)
 
void resizeEvent (QGraphicsSceneResizeEvent *event)
 
void wheelEvent (QGraphicsSceneWheelEvent *event)
 

Properties

int count
 
int currentIndex
 
QGraphicsWidget * firstPositionWidget
 
QGraphicsWidget * lastPositionWidget
 
KTabBar * nativeWidget
 
QString styleSheet
 
bool tabBarShown
 

Detailed Description

A tab bar widget, to be used for tabbed interfaces.

Provides a Tab bar for use in a tabbed interface where each page is a QGraphicsLayoutItem. Only one of them is displayed at a given time. It is possible to add and remove tabs or modify their text label or their icon.

Definition at line 46 of file tabbar.h.

Constructor & Destructor Documentation

◆ TabBar()

Plasma::TabBar::TabBar ( QGraphicsWidget *  parent = 0)
explicit

Constructs a new TabBar.

Parameters
parentthe parent of this widget

Definition at line 221 of file tabbar.cpp.

◆ ~TabBar()

Plasma::TabBar::~TabBar ( )

Definition at line 269 of file tabbar.cpp.

Member Function Documentation

◆ addTab() [1/2]

int Plasma::TabBar::addTab ( const QIcon &  icon,
const QString &  label,
QGraphicsLayoutItem *  content = 0 
)

Adds a new tab in the last position.

Parameters
iconthe icon for this tab
labelthe text label of the tab
contentthe page content that will be shown by this tab
Returns
the index of the inserted tab

Definition at line 322 of file tabbar.cpp.

◆ addTab() [2/2]

int Plasma::TabBar::addTab ( const QString &  label,
QGraphicsLayoutItem *  content = 0 
)

Adds a new tab in the last position This is an overloaded member provided for convenience equivalent to addTab(QIcon(), label, page)

Parameters
labelthe text label of the tab
contentthe page content that will be shown by this tab
Returns
the index of the inserted tab

Definition at line 327 of file tabbar.cpp.

◆ changeEvent()

void Plasma::TabBar::changeEvent ( QEvent *  event)
protected

Definition at line 614 of file tabbar.cpp.

◆ count()

int Plasma::TabBar::count ( ) const
Returns
the number of tabs in this tabbar

Definition at line 429 of file tabbar.cpp.

◆ currentChanged

void Plasma::TabBar::currentChanged ( int  index)
signal

Emitted when the active tab changes.

Parameters
indexthe newly activated tab

◆ currentIndex()

int Plasma::TabBar::currentIndex ( ) const
Returns
the index of the tab currently active

Definition at line 332 of file tabbar.cpp.

◆ firstPositionWidget()

QGraphicsWidget * Plasma::TabBar::firstPositionWidget ( ) const
Returns
the widget in the first position
Since
4.6

Definition at line 645 of file tabbar.cpp.

◆ insertTab() [1/2]

int Plasma::TabBar::insertTab ( int  index,
const QIcon &  icon,
const QString &  label,
QGraphicsLayoutItem *  content = 0 
)

Adds a new tab in the desired position.

Parameters
indexthe position where to insert the new tab, if index <=0 will be the first position, if index >= count() will be the last
iconthe icon for this tab
labelthe text label of the tab
contentthe page content that will be shown by this tab
Returns
the index of the inserted tab

Definition at line 275 of file tabbar.cpp.

◆ insertTab() [2/2]

int Plasma::TabBar::insertTab ( int  index,
const QString &  label,
QGraphicsLayoutItem *  content = 0 
)

Adds a new tab in the desired position This is an overloaded member provided for convenience equivalent to insertTab(index, QIcon(), label);.

Parameters
indexthe position where to insert the new tab, if index <=0 will be the first position, if index >= count() will be the last
labelthe text label of the tab
contentthe page content that will be shown by this tab
Returns
the index of the inserted tab

Definition at line 317 of file tabbar.cpp.

◆ isTabBarShown()

bool Plasma::TabBar::isTabBarShown ( ) const
Returns
true if the tabbar is shown
Since
4.3

Definition at line 578 of file tabbar.cpp.

◆ isTabHighlighted()

bool Plasma::TabBar::isTabHighlighted ( int  index) const
Returns
if the tab at index is highlighted
Since
4.7

Definition at line 598 of file tabbar.cpp.

◆ lastPositionWidget()

QGraphicsWidget * Plasma::TabBar::lastPositionWidget ( ) const
Returns
the widget in the last position
Since
4.6

Definition at line 674 of file tabbar.cpp.

◆ nativeWidget()

KTabBar * Plasma::TabBar::nativeWidget ( ) const
Returns
the native widget wrapped by this TabBar

Definition at line 603 of file tabbar.cpp.

◆ removeTab()

void Plasma::TabBar::removeTab ( int  index)

Removes a tab, contents are deleted.

Parameters
indexthe index of the tab to remove

Definition at line 434 of file tabbar.cpp.

◆ resizeEvent()

void Plasma::TabBar::resizeEvent ( QGraphicsSceneResizeEvent *  event)
protected

Definition at line 337 of file tabbar.cpp.

◆ setCurrentIndex

void Plasma::TabBar::setCurrentIndex ( int  index)
slot

Activate a given tab.

Parameters
indexthe index of the tab to activate

Definition at line 350 of file tabbar.cpp.

◆ setFirstPositionWidget()

void Plasma::TabBar::setFirstPositionWidget ( QGraphicsWidget *  widget)

Set a widget to be displayed on one side of the TabBar, depending on the LayoutDirection and the Shape.

Parameters
widgetthe widget to be displayed. Passing 0 will show nothing. Any previous widget will be deleted.
Since
4.6

Definition at line 620 of file tabbar.cpp.

◆ setLastPositionWidget()

void Plasma::TabBar::setLastPositionWidget ( QGraphicsWidget *  widget)

Set a widget to be displayed on one side of the TabBar, depending on the LayoutDirection and the Shape.

Parameters
widgetthe widget to be displayed. Passing 0 will show nothing. Any previous widget will be deleted.
Since
4.6

Definition at line 650 of file tabbar.cpp.

◆ setStyleSheet()

void Plasma::TabBar::setStyleSheet ( const QString &  stylesheet)

Sets the stylesheet used to control the visual display of this TabBar.

Parameters
stylesheeta CSS string

Definition at line 583 of file tabbar.cpp.

◆ setTabBarShown()

void Plasma::TabBar::setTabBarShown ( bool  show)

shows or hides the tabbar, used if you just want to display the pages, when the tabbar doesn't have content pages at all this function has no effect

Parameters
showtrue if we want to show the tabbar
Since
4.3

Definition at line 559 of file tabbar.cpp.

◆ setTabHighlighted()

void Plasma::TabBar::setTabHighlighted ( int  index,
bool  highlight 
)

Highlight the specified tab.

Parameters
indexof the tab to highlight
highlighttrue if it should be highlighted, wrong if not
Since
4.7

Definition at line 593 of file tabbar.cpp.

◆ setTabIcon()

void Plasma::TabBar::setTabIcon ( int  index,
const QIcon &  icon 
)

Sets an icon for a given tab.

Parameters
indexthe index of the tab to modify
iconthe new icon for the given tab

Definition at line 549 of file tabbar.cpp.

◆ setTabText()

void Plasma::TabBar::setTabText ( int  index,
const QString &  label 
)

Sets the text label of the given tab.

Parameters
indexthe index of the tab to modify
labelthe new text label of the given tab

Definition at line 535 of file tabbar.cpp.

◆ styleSheet()

QString Plasma::TabBar::styleSheet ( ) const
Returns
the stylesheet currently used with this widget

Definition at line 588 of file tabbar.cpp.

◆ tabAt()

QGraphicsLayoutItem * Plasma::TabBar::tabAt ( int  index)

Returns the contents of a page.

Parameters
indexthe index of the tab to retrieve
Since
4.4

Definition at line 516 of file tabbar.cpp.

◆ tabIcon()

QIcon Plasma::TabBar::tabIcon ( int  index) const
Returns
the current icon for a given tab
Parameters
indexthe index of the tab we want to know its icon

Definition at line 554 of file tabbar.cpp.

◆ tabText()

QString Plasma::TabBar::tabText ( int  index) const
Returns
the text label of the given tab
Parameters
indexthe index of the tab we want to know its label

Definition at line 544 of file tabbar.cpp.

◆ takeTab()

QGraphicsLayoutItem * Plasma::TabBar::takeTab ( int  index)

Removes a tab, the page is reparented to 0 and is returned.

Parameters
indexthe index of the tab to remove
Since
4.4

Definition at line 467 of file tabbar.cpp.

◆ wheelEvent()

void Plasma::TabBar::wheelEvent ( QGraphicsSceneWheelEvent *  event)
protected

Definition at line 608 of file tabbar.cpp.

Property Documentation

◆ count

int Plasma::TabBar::count
read

Definition at line 1 of file tabbar.h.

◆ currentIndex

int Plasma::TabBar::currentIndex
readwrite

Definition at line 1 of file tabbar.h.

◆ firstPositionWidget

QGraphicsWidget * Plasma::TabBar::firstPositionWidget
readwrite

Definition at line 1 of file tabbar.h.

◆ lastPositionWidget

QGraphicsWidget * Plasma::TabBar::lastPositionWidget
readwrite

Definition at line 1 of file tabbar.h.

◆ nativeWidget

KTabBar * Plasma::TabBar::nativeWidget
read

Definition at line 1 of file tabbar.h.

◆ styleSheet

QString Plasma::TabBar::styleSheet
readwrite

Definition at line 1 of file tabbar.h.

◆ tabBarShown

bool Plasma::TabBar::tabBarShown
readwrite

Definition at line 1 of file tabbar.h.


The documentation for this class was generated from the following files:
  • tabbar.h
  • tabbar.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Plasma

Skip menu "Plasma"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal