QTabBar is a class from the Qt Toolkit which provides a tab bar, e.g. for use in tabbed dialogs.
Questions tagged [qtabbar]
95 questions
3
votes
1 answer
Make every tab the same width and also expandable
I'm trying to achieve something like the tabs from a Browser. All tabs must have the same width and also be expandable so when there are a lot of them they need to resize and fit the window (exactly like Chrome or Firefox does).
The Problem:
If a…

Carlos Barros
- 319
- 1
- 6
- 11
3
votes
1 answer
dynamically style an individual tab in QTabWidget
How can I individually and dynamically access a single tab (not its content resp. the widget in the tab) for styling purposes, such as changing the background color or adding graphical effects to it?
An application could be to notify the user, that…

CatPlusPlus
- 118
- 8
3
votes
5 answers
Different close buttons on tabs
I am using QTabWidget, and I would like to know if I can use different icons for close buttons on tabs? I think style and setCornerWidget may not work for this case.
Thanks!

echo
- 789
- 2
- 12
- 21
3
votes
3 answers
Close button only on active tab of QTabWidget
To save space in a QTabWidget, I would like to show the close icon only for the current tab, like e.g. Firefox is doing:
Is there a simple way using a style sheet, some thing like (not working like this)
QTabBar::tab::!selected::close-button…

Tim Hoffmann
- 1,325
- 9
- 28
3
votes
1 answer
Inline renaming of a tab in QTabBar/QTabWidget
I really want to have a QTabWidget that can be renamed by double-click on tab caption.
I have googled and found this solution, but it's more like an outline for a developer who knows his way through Qt and subclassing it's widgets.
I'm kind of stuck…

Eduard Sukharev
- 1,188
- 2
- 15
- 37
3
votes
1 answer
Change background of indexed QTabBar tabs using stylesheets
Using Qt stylesheets, is it possible to set a different background colour for each tab in a QTabBar that has 4 or more tabs?
My Qt application has 6 tabs underneath the menu bar. I'd like to change their background colours to 6 different colours…

Robin
- 695
- 2
- 8
- 23
3
votes
1 answer
How can I set background color/image specific tab at QTabWidget?
After the long visitor status, finally, this is my first post.
I create tabs dynamically in my TabWidget(from config). Like;
-it is python code, pyqt, answers can be coded c++, dosn’t matter for me :) –
baseWidget = QWidget()
//fill baseWidget with…

cengizkrbck
- 704
- 6
- 21
2
votes
2 answers
How to use an event handler to detect clicking on the empty space after tab bar?
I have a QTabWidget, and I need to trigger an event when i press the area on the tab widget where you normally would see the tab name, accept its an empty space with no tab.
Clicking the red area should trigger an event:
Here is how the result…

FiveEight
- 33
- 4
2
votes
1 answer
QtabBar text and icon
hi i would like to place icon and an text below the icon in each tab of an tabbar in QtabBar widget. by default the text and icon are set next to each other i would like to display one below the other . how can we do it .

karthick
- 21
- 3
2
votes
1 answer
QTabWidget some tabs have a close button, and some tabs do not have a close button
I am creating a QTabWidget, and I set True to its setTabsClosable method, so that each tab has a close button. The effect I want is that the first tab has no close button, and the second button has a close button. How should I set it?
from…

redj
- 171
- 1
- 10
2
votes
1 answer
How to pin a tab in Qt
Is it possible to pin a tab with Qt?
I want a tab to always stay in place (index 0) while still able to move other tabs.
So far I tried to listen to QTabBar::tabMoved and revert the move but that's too late. I don't want it even to attempt to…

MLoga
- 53
- 5
2
votes
1 answer
Set and retain color on individual tabs in QTabBar
I am trying to check existing tabs in a QTabBar against the list of items within a QMenu. And if the existing tabs contains item(s) that are not found in the QMenu, that said tab is to be highlighted in red.
Initially I was using the tabTextColor…

Teh Ki
- 455
- 1
- 3
- 14
2
votes
1 answer
Using c++ enum in qml
I have an enum that I use in qml
class SettingManager : public QObject
{
Q_OBJECT
public:
enum BookKinds{
BookKind1=0,
BookKind2=1,
};
Q_ENUMS(BookKinds)
Q_PROPERTY(BookKinds bookKind READ bookKind WRITE…

mohsen
- 1,763
- 3
- 17
- 55
2
votes
1 answer
QTabWidget or QTabBar displaying the same QWidget in different tabs using C++
I'm working with a QTabWidget right now displaying just one QWidget with different elements (labels, buttons, ...). Working with Ubuntu and Qt5.5.
QTabWidget *tw;
QString title = "1";
ui->tw->addTab(&tab, title); // tab is my QWidget
I'd like to…

MichaW.
- 37
- 5
2
votes
0 answers
Simple ribbon: autosizing toolbars and tabs
I'm trying to implement simple tabbed interface with Qt5. I use QTabWidget with QToolBars placed inside its tabs and I add QActions to the QToolBars:
The toolbar and the widget below are within a vertical layout. I'd like toolbars to autosize their…

Vercetti
- 437
- 1
- 6
- 17