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
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
2 answers

How to make the background color the same as the form background?

In PyQt5 I'm getting some unexpected behavior from QTabWidget, the background seems to be white instead of the default form color (roughly light gray). Here is an example: # QTabWidget2.py from PyQt5.QtWidgets import QApplication, QWidget,…
cdahms
  • 3,402
  • 10
  • 49
  • 75
2
votes
1 answer

PyQt5 adding add and remove widget buttons beside every tab

I want to add buttons to the tabs in the QTabWidget. My first instinct was to try to get the position of each tab and then add the button ontop of the tab, but I cant figure out how to get the position of the tab! Only the entire tab widget. I was…
N. Berg
  • 79
  • 1
  • 7
2
votes
1 answer

Dynamically insert checkboxes into a tabWidget

I am building a small application using pyQt5. Till now I've built a UI using QtCreator, converted that to a Python file using pyuic and now on the push of a button, it should dynamically populate the tabWidget's tabs with checkboxes having labels…
Raghav Kukreti
  • 552
  • 5
  • 18
2
votes
1 answer

Change main window active tab from a dialogbox action

I have two windows in 2 separate classes. The main window and a dialogbox window. The main window contains a Qtabwidget with multiple tabs. The dialogbox has a button. From the main window, on the click of a button the dialogbox opens. The user…
Kevin_ALA
  • 233
  • 2
  • 11
2
votes
1 answer

How to update values between PyQt5 Tabs created as classes

I have 2 tabs in PyQT5 created as separate classes. 1 class (tab) is to load excel file, second to set rules for removing unneeded rows. When I load file I need to post all headers to QComboBox in other tab so I can create rules. Can't make that to…
2
votes
1 answer

Make content and tab expandable in pyqt5

here's a thing I'm trying to solve in QT Creator. I want to make contents of the tab widget as well as the tab widget itself to be stretchable depending on the screen size. So far I've been looking for solutions on StackOverflow but couldn't find…
Ren
  • 944
  • 1
  • 13
  • 26
2
votes
1 answer

Change color of single QTabWidget tab

I want to change the color of a single tab, please see screenshot below. The FOO_SUPtab should be red (right now only the button is), all others not. For the text color there is bar->setTabTextColor(index, QColor(Qt::red)), but not the whole tab.…
Horst Walter
  • 13,663
  • 32
  • 126
  • 228
2
votes
1 answer

QTabWidget strange behavior

I have two tabs where placed QTableWidget with cell widget. See image. QTabWidget *tab = new QTabWidget(this); for (int i = 0; i < 2; ++i) { QTableWidget *t = new QTableWidget(1, 1); QPushButton *btn = new QPushButton("Click on me!"); …
Nick Brian
  • 53
  • 5
2
votes
1 answer

widgets placement in tabs

So I have this code: from PyQt5.QtWidgets import QMainWindow, QApplication, QPushButton, QWidget, QAction, QTabWidget, QVBoxLayout, QHBoxLayout, QComboBox, QLabel from PyQt5.QtGui import QIcon from PyQt5.QtCore import pyqtSlot from lang import…
HelloThereToad
  • 249
  • 1
  • 3
  • 14
2
votes
1 answer

Adding QScrollArea to QTabWidget

I'm trying to add a scroll area to a QTabWideget. At the moment I've set it up with two different tabs and the scrollArea is added to the second tab. When I run my program, items are added to the scrollArea and the scroll bar is visible(policy set…
Chris
  • 185
  • 1
  • 4
  • 13
2
votes
0 answers

how to check if second tab from QTabWidget is active in order to run a function

I have a program that include QTabWidget with 2 tabs. what I need is to check if the second Tab is active or has focus run a function. I tried this code until now but did not work def checkTab2(self): if self.tabWidget.currentIndex()==1: …
Propy Propy
  • 57
  • 10
2
votes
1 answer

How to set the mouse cursor on QTabWidget tabs

I am dealing with a simple problem I don't succeed to solve. I am working with Python-3.6 and PyQt5. What I wish is to change the mouse cursor when the user has the mouse above the inactive tab (to understand he can click on it to change the active…
Mathieu Gauquelin
  • 601
  • 11
  • 35
2
votes
4 answers

pyqt qtabwidget horizontal tab and horizontal text in QtDesigner

i am having problem to change text alignment using pyqt4 desginer i have made tabs horizontal by aligning west but the text in that goes north to south that looks bad i want to change alignment of text as horizontal how can i do that...thanks in…
Sahil Jain
  • 450
  • 1
  • 8
  • 19
2
votes
1 answer

How can we open a tab specific tab in pyqt on button click?

i have made 10 tabs in my design page using qt designer and have made a menu bar on the top of it. Now i want to connect one of the options in the menubar to a tab (say tab 5). i.e. when i click on menu->button then the tab5 gets opened
Sahil Jain
  • 450
  • 1
  • 8
  • 19