qtabwidget

PyQT - setting the text color for a QTabWidget

余生颓废 提交于 2019-12-02 11:47:49
问题 Is there any way to set the text color of a certain tab that's part of a QTabWidget? QTabBar seems to have a method to set the tab text color, but I do not see a similar method for QTabWidget. 回答1: The tab text color can be set via the tab-widget's tabBar method: tabwidget.tabBar().setTabTextColor(index, color) 来源: https://stackoverflow.com/questions/9170638/pyqt-setting-the-text-color-for-a-qtabwidget

widgets placement in tabs

让人想犯罪 __ 提交于 2019-12-01 12:49:33
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 getLang import sys, os, configparser config = configparser.ConfigParser() config.read("Settings.ini") # Config get setting and change setting #print(config.get("Main", "language")) #config.set("Main", "language", "danish") #with open("Settings.ini", "w") as cfg_file: #config.write(cfg_file) class App(QMainWindow): def __init__(self): super().__init__() #

widgets placement in tabs

爷,独闯天下 提交于 2019-12-01 10:49:26
问题 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 getLang import sys, os, configparser config = configparser.ConfigParser() config.read("Settings.ini") # Config get setting and change setting #print(config.get("Main", "language")) #config.set("Main", "language", "danish") #with open("Settings.ini", "w"

Qt TabWidget Each tab Title Background Color

谁说我不能喝 提交于 2019-11-30 09:38:47
问题 This is the original Tabwidget without setting title background color My customer ask me to do something like this; Set different background colour for title All - Yellow purchase - light blue POS Sales - light green Cash Sales - Pink invoice - light purple I have try the SetStyleSheet like: QTabBar { background-color : Yellow; } But all tab Color changed Somebody know how to setting each QTabBar background color? 回答1: These properties can not be set through QSS. To change the style to each

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

你说的曾经没有我的故事 提交于 2019-11-30 06:44:47
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? Alternatively, I would be happy enough with a QTabWidget with such a button. You will have to write your own class for the QTabBar. The plus button can be added by using absolute positioning. I have some code here for PySide; it should give you the basic idea. class TabBarPlus(QtGui.QTabBar): """Tab bar that has a plus button floating to the right of

How do I disable one tab in a QTabWidget?

家住魔仙堡 提交于 2019-11-30 03:25:00
问题 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 would be as simple as this code: bool result = false; if (result == false) { tabWidget->widget(1)->setDisabled(true); } Unfortunately, this code does not disable the tab, it remains enabled even when I check it: tabWidget->tabBar()->isTabEnabled(1); //

Qt TabWidget Each tab Title Background Color

谁都会走 提交于 2019-11-29 16:36:11
This is the original Tabwidget without setting title background color My customer ask me to do something like this; Set different background colour for title All - Yellow purchase - light blue POS Sales - light green Cash Sales - Pink invoice - light purple I have try the SetStyleSheet like: QTabBar { background-color : Yellow; } But all tab Color changed Somebody know how to setting each QTabBar background color? These properties can not be set through QSS. To change the style to each tab we must create a custom QTabBar and override its paintEvent method, to be able to change the style of

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

时光毁灭记忆、已成空白 提交于 2019-11-29 06:25:39
问题 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? Alternatively, I would be happy enough with a QTabWidget with such a button. 回答1: You will have to write your own class for the QTabBar. The plus button can be added by using absolute positioning. I have some code here for PySide; it should give you

How to implement vertical tabs in QT?

纵饮孤独 提交于 2019-11-29 04:56:54
I am trying to implement vertical tabs with horizontal text with QT but I cannot find any similar option in QTabWidget . Somebody in SO asked for something similar here , however, the answers contain broken links and I doubt that they present a real solution. Anybody has been able to do that? You have to implement a custom QTabBar overwriting the tabSizeHint() and paintEvent() methods as shown below: #include <QApplication> #include <QStyleOptionTab> #include <QStylePainter> #include <QTabBar> #include <QTabWidget> class TabBar: public QTabBar{ public: QSize tabSizeHint(int index) const{ QSize

Qt: Styling QTabWidget

社会主义新天地 提交于 2019-11-28 18:27:27
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 2 (the best thing would be to be able to set a fading color). Or another solution would be that the tabs float out to cover the whole screen. I use the following stylesheet right now: QTabWidget::tab-bar { } QTabBar::tab { background: gray; color: white; padding: 10px; } QTabBar::tab:selected { background: lightgray; } Is there a way to set the