| OpenMS 2.5.0

Public Slots | Signals | Public Member Functions | Protected Slots | Protected Member Functions | List of all members
TOPPASTabBar Class Reference
Visual

Convenience tab bar implementation. More...

`#include <OpenMS/VISUAL/TOPPASTabBar.h>`

Inheritance diagram for TOPPASTabBar:

## Public Slots

void | removeId (int id)
| Remove the tab with identifier `id`. More...

## Signals

void | currentIdChanged (int id)
| Signal that indicates that the current tab changed. More...
void | aboutToCloseId (int id)
| Signal that indicates that the tab with identifier `id` is about to be removed (double click or context menu) More...

## Public Member Functions

| TOPPASTabBar (QWidget *parent=nullptr)
| Constructor. More...
| ~TOPPASTabBar () override
| Destructor. More...
int | addTab (const String &text, int id)
| Adds a new tab with the name `text` and the identifier `id`. More...
void | setCurrentId (int id)
| Selects the tab with identifier `id`. More...

## Protected Slots

void | currentChanged_ (int id)
| Slot that translates the currentChanged(int) signal to currentIdChanged(int) More...

## Protected Member Functions

int | tabAt_ (const QPoint &pos)
| Returns the QTabBar index of the tab at position `pos`. If there is no tab at that position -1 is returned. More...
Reimplemented Qt events
void | mouseDoubleClickEvent (QMouseEvent *e) override
void | contextMenuEvent (QContextMenuEvent *e) override

## Detailed Description

Convenience tab bar implementation.

This tab bar differs in several ways from the QTabBar:

- you can close a tab by double-clicking it or through its context menu.
- it works based on tab identifiers (a fixed id stored in tab data) rather than on tab indices, which might change when inserting or removing a tab.

## Constructor & Destructor Documentation

## ◆ TOPPASTabBar()

TOPPASTabBar | ( | QWidget * | parent = `nullptr` | ) |

Constructor.

## ◆ ~TOPPASTabBar()

~TOPPASTabBar | ( |  | ) |

override

Destructor.

## Member Function Documentation

## ◆ aboutToCloseId

void aboutToCloseId | ( | int | id | ) |

signal

Signal that indicates that the tab with identifier `id` is about to be removed (double click or context menu)

## ◆ addTab()

int addTab | ( | const String & | text,
|  | int | id
| ) |  |

Adds a new tab with the name `text` and the identifier `id`.

Referenced by TOPPASBase::showAsWindow_(), and TOPPASBase::TOPPASBase().

## ◆ contextMenuEvent()

void contextMenuEvent | ( | QContextMenuEvent * | e | ) |

override protected

## ◆ currentChanged_

void currentChanged_ | ( | int | id | ) |

protected slot

Slot that translates the currentChanged(int) signal to currentIdChanged(int)

## ◆ currentIdChanged

void currentIdChanged | ( | int | id | ) |

signal

Signal that indicates that the current tab changed.

## ◆ mouseDoubleClickEvent()

void mouseDoubleClickEvent | ( | QMouseEvent * | e | ) |

override protected

## ◆ removeId

void removeId | ( | int | id | ) |

slot

Remove the tab with identifier `id`.

Referenced by TOPPASBase::closeByTab(), and TOPPASBase::TOPPASBase().

## ◆ setCurrentId()

void setCurrentId | ( | int | id | ) |

Selects the tab with identifier `id`.

Referenced by TOPPASBase::showAsWindow_(), and TOPPASBase::updateTabBar().

## ◆ tabAt_()

int tabAt_ | ( | const QPoint & | pos | ) |

protected

Returns the QTabBar index of the tab at position `pos`. If there is no tab at that position -1 is returned.