qtabbar

Qt Use QTabBar in a Different QLayout

无人久伴 提交于 2019-12-25 06:35:07
问题 I have a custom QTabWidget and a custom QTabBar. Everything is working fine and I can go through the tabs and stuff. But the thing is, I wanna put the QTabBar in a different layout than the QTabWidget. This way I can make a Menu Bar type of layout where I have the tabs and a couple differnt QPushButtons next to it all going left to right in the same row aligned. So, basically can I move the QTabBar into a separate QHBoxLayout or QGridLayout away from the tab widget, but keep the functionality

Qt (C++): dynamically style an individual tab in QTabWidget

孤者浪人 提交于 2019-12-24 06:43:33
问题 I know, that this question has been discussed here and on other sites, but there has not been a really solution yet, although I think, that I'm not the only one with this problem: 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 a tab requires his attention, by letting it flash in another color

Internal QWidgets of QTabBar's tab?

我怕爱的太早我们不能终老 提交于 2019-12-19 11:45:07
问题 As a follow up of " Hide label text for Qt tabs without setting text to empty string " : Can I directly access the widgets within the tabs of the QTabBar . I do not mean the corresponding widget which is shown when I select a tab, but the tab's widgets (so in the screenshot below the log label and log icon). I have tried QTabBar::findChildren , but with no success. Any idea? 回答1: QTabBar header sections are not actually widgets. They are drawn by QStylePainter inside QTabBar::paintEvent .

Expand QTabBar dynamically

一个人想着一个人 提交于 2019-12-12 03:22:41
问题 I'm inserting tabs via QLineEdit dynamically which works fine. To fill the whole width of the screen (800px) I'm expanding the tabs using my own eventFilter: tabs.h class ResizeFilter : public QObject { QTabBar *target_tabs; public: ResizeFilter(QTabBar *target_tabs) : QObject(target_tabs), target_tabs(target_tabs) {} bool eventFilter(QObject *object, QEvent *event) { if (object == target_tabs) { if (event->type() == QEvent::Resize) { // The width of each tab is the width of the tabbar / # of

QTabWidget tabPosition when using stylesheets

家住魔仙堡 提交于 2019-12-11 06:26:18
问题 I'm currently using stylesheets to theme an application. Here is the stylesheet I use for QTabWidget: /*QTabBar et QTabWidget*/ QTabBar::tab { background: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(73, 73, 74, 255), stop:1 rgba(40, 40, 40, 255)); border: 1px solid rgb(190, 190, 190); max-height: 0.6em; min-width: 0.6em; padding: 5px; margin-left: -1px; margin-right: -1px; } QTabBar::tab:selected, QTabBar::tab:hover { background: qlineargradient(spread:pad, x1:0.5, y1

QtabBar text and icon

南笙酒味 提交于 2019-12-11 03:57:20
问题 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 . 回答1: There seems to be only one way to change icon placement - reimplement QTabBar's paintEvent. Code like this may help: class MyTabBar : public QTabBar { ... protected: void paintEvent(QPaintEvent *) { QStylePainter painter(this); for(int i = 0; i < 3; ++i) {

Hiding bottom line in QTabBar

自作多情 提交于 2019-12-10 15:24:29
问题 There doesn't seem to be a way of setting a stylesheet for the bottom line (shown in the image below) of a QTabBar , which I want to be removed. How can I remove it? 回答1: Haven't used Qt in 6-7 months now so I'm not sure if this will work nor can I test it. Give QTabBar::drawBase a try. Plus the Qt library are very well documents so you should find a solution to your problems if you just carefully sift through it. Hope you are using the Qt SDK. 来源: https://stackoverflow.com/questions/11458431

Qt Increase QTabWidget's QTabBar size

僤鯓⒐⒋嵵緔 提交于 2019-12-09 14:05:42
问题 I need to make the tabs that I have oriented at the bottom of my QTabWidget larger. We'll be using a touch-screen, so the default sizes are a little too small. I see no easy way to do this (currently seeing no good way to even do it at all. The only methods pertaining to the QTabBar that I see in QTabWidget are protected, and I don't see a need to inherit from the class other than for this express purpose). Question: What I'd like to do is to just set the QTabBar to a certain specific size.

How to implement vertical tabs in QT?

微笑、不失礼 提交于 2019-12-03 13:51:16
问题 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? 回答1: You have to implement a custom QTabBar overwriting the tabSizeHint() and paintEvent() methods as shown below: #include <QApplication> #include <QStyleOptionTab> #include <QStylePainter> #include

Internal QWidgets of QTabBar's tab?

南笙酒味 提交于 2019-12-01 14:15:48
As a follow up of " Hide label text for Qt tabs without setting text to empty string " : Can I directly access the widgets within the tabs of the QTabBar . I do not mean the corresponding widget which is shown when I select a tab, but the tab's widgets (so in the screenshot below the log label and log icon). I have tried QTabBar::findChildren , but with no success. Any idea? QTabBar header sections are not actually widgets. They are drawn by QStylePainter inside QTabBar::paintEvent . Thus you can't get access to them. As a workaround you can add a tab with an empty text and set a custom widget