Questions tagged [qtabwidget]

The QTabWidget class, part of the Qt framework, provides a stack of tabbed widgets.

The QTabWidget class provides a stack of tabbed widgets. A tab widget provides a tab bar and a "page area" that is used to display pages related to each tab.

Qt documentation for QTabWidget can be found here for Qt 5 and here for Qt 4.8.

365 questions
44
votes
3 answers

Set label text in QTabWidget tab

I have QTabWidget on my form and two tabs on it. These tabs have standard text Tab1 and Tab2. How can I change it?
0xAX
  • 20,957
  • 26
  • 117
  • 206
25
votes
4 answers

How to set current tab of QTabWidget by name?

PyQt5's QTabWidget has a method setCurrentIndex that you can use to get a particular tab to become the active tab. I can't seem to find any way to index by tab name though (which I set in Qt Designer). Is there any way (either direct or indirect) to…
aoh
  • 1,090
  • 2
  • 13
  • 25
24
votes
1 answer

Get all tabs widgets in QTabWidget

Is it possible to get all tabs widgets that where added by addTab(QWidget() in QTabWidget in a list. We can use self.findChildren(QWidget), but it also returns all other widgets inside itself, and there is no way to filter them.
Qiao
  • 16,565
  • 29
  • 90
  • 117
20
votes
7 answers

How can I add a "new tab" button next to the tabs of a QMdiArea in tabbed view mode?

I'd like to have a "new tab" button much like Chrome or Firefox has for my QMdiArea. I can make a button or menu item somewhere that adds a new subdocument to the MDI thing, but how can I make it a visually appealing tiny tab with a "+" as label?…
rubenvb
  • 74,642
  • 33
  • 187
  • 332
19
votes
1 answer

QTabBar vs QTabWidget

I am using QTabWidget in my project. Is there any good reason I should use QTabBar and not QTabWidget? What advantages I have if I use QTabWidget?
RLT
  • 4,219
  • 4
  • 37
  • 91
18
votes
6 answers

QSplitter becoming undistinguishable between QWidget and QTabWidget

I am puting a QWidget and a QTabWidget next to each other in one horisontal splitter. And the splitter loses it's shape, you can know that there is a splitter only by hovering mouse on it. How to make it visible? Thanks.
Narek
  • 38,779
  • 79
  • 233
  • 389
18
votes
4 answers

QTabWidget: close tab button not working

I have set ui->tabWidget->setTabsClosable(true); but QTabwidget only showing a cross on each tab that is not closing tab on click on this button. What else I have to do to make tabs closable? I tried to connect any slot (which would be proper for…
Tab
  • 785
  • 2
  • 11
  • 27
15
votes
3 answers

QTabWidget tabs on the vertical, but text in horizontal

I'm trying to make an app in C++ Qt with a sidebar like this one: But when making QTabWidget's orientation to West, it makes the text vertical. How to have the text on the left, but horizontally-aligned? Ps: I don't need icons. Thanks in advance.
Délisson Junio
  • 1,296
  • 4
  • 21
  • 43
14
votes
4 answers

How do I disable one tab in a QTabWidget?

I have a QTabWidget called tabWidget. It has three tabs: "Basic", "Advanced", and "Current Structure". The tabs are displayed in the widget in that order. I want to disable the "Advanced" tab whenever the Boolean result is false. I thought it…
Joey Kleingers
  • 297
  • 1
  • 4
  • 13
13
votes
3 answers

Putting a close button on QTabWidget

I'm using a QTabWidget to render multiple documents in a window, and I want to draw a close button on each tab. I'm using Vista and Qt4, so the tab widget is a native windows control; this may affect the feasibility. Does anyone know if it is…
conmulligan
  • 7,038
  • 6
  • 33
  • 44
12
votes
5 answers

How to identify when the current tab is changing in a QTabWidget?

I'm using a QTabWidget and I need a way to handle the change of the current tab before it actually happens, and possibly cancel it if certain conditions are met. The QTabWidget::currentChanged signal is received after the current tab has changed,…
user360607
  • 363
  • 1
  • 5
  • 14
12
votes
4 answers

Qt: Styling QTabWidget

I'm using Qt and I have a QTabWidget setup in the Qt Designer Editor, you can see it in picture 1. As you can see after Tab4 there is an empty space all the way to the right edge, in someway I need to fill that space with a color, like in picture…
Martin
  • 1,675
  • 11
  • 34
  • 46
11
votes
2 answers

Show/Hide sub-tab on QTabWidget

Assuming I have a QTabWidget that contains 5 sub-tabs. Now I want to show/hide a sub-tab in one of 5 sub-tabs by following code ui->twListTabs->widget(0)->hide(); // Hide first sub-tab But this didn’t work for me. Do you have any…
Tan Viet
  • 1,983
  • 6
  • 25
  • 36
10
votes
4 answers

QTabWidget tab context menu

I need to display a context menu whenever a tab is clicked on and it needs to react to that specific tab. Is there any way to do this without subclassing it?
deuces
  • 733
  • 1
  • 10
  • 17
10
votes
2 answers

How to insert a space between two tabs in a QTabWidget?

I'd like to insert a space to separate the second tab from the third. Is this possible? I've tried some stylesheets but as this widget is kind of new to me I've had no success so far.
SamuelNLP
  • 4,038
  • 9
  • 59
  • 102
1
2 3
24 25