qtabwidget

OSGViewer in Qt's TabWidget

戏子无情 提交于 2020-01-06 12:28:47
问题 I am using OpenSceneGraph 3.0.1 and having a problem with the Qt integration using the osgQt::GLWidget when adding it to a tab control during startup (inside the constructor of my main window. MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); QWidget* viewerWidget = new MyViewerWidget(new osgViewer::Viewer()); ui->tabWidget->addTab(viewerWidget, "My Osg View"); // tab entry was added but nothing to see than empty Osg Window } It works,

PySide create horizontal tabs with horizontal text

前提是你 提交于 2020-01-06 05:47:30
问题 I am trying to use this solution by @eyllanesc: pyqt qtabwidget horizontal tab and horizontal text in QtDesigner. My main window has a QStackedWidget in which one of the pages is the page with horizontal tabs. I used Qt designer to create a dialog with a tab widget, and set the tabPosition to West. Then I promoted the TabWidget like shown in the original post. This is what the resulting window looks like. There are no outlines around the tabs, and the tabs are not clickable: This is my main

PyQt mouse events for QTabWidget

谁说我不能喝 提交于 2020-01-02 04:58:06
问题 I want to detect middle mouse clicks on a QTabWidget. I was expecting there to be a mouse event related signal on QWidget, but all I am seeing are methods. Do I need to subclass the QTabWidget and then override said methods in order to do what I want, or am I missing something? 回答1: You can either install an event filter on the QTabBar (returned by QTabWidget.tabBar() ) to receive and handle press and release events, or subclass QTabBar to redefine mousePressEvent and mouseReleaseEvent and

How to add an icon to a QTabWidget (not for each tab)?

喜欢而已 提交于 2019-12-25 18:46:10
问题 I would like to add an icon at the top left of the QTabWidget . I don't want to add an icon for each tab. How to do that using a stylesheet or programmatically in C++? 回答1: Stylesheet below will add an image to the left of all tabs, but not to individual tabs. However, it is very likely that you'll need to tweak other attributes in the CSS to polish the final result. QTabWidget > QTabBar { background: url(url-to-your-corner-image); background-repeat: norepeat; margin-top: 10px; /* whatever

Qt Use QTabBar in a Different QLayout

﹥>﹥吖頭↗ 提交于 2019-12-25 06:35:22
问题 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 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

How can I make two rows of tabs in Qt

ぐ巨炮叔叔 提交于 2019-12-25 04:58:10
问题 I would like to have something like the following image. I want two rows of tabs. One is included in the other. Is using two QTabWidget the way to go? Also, I would like to mention that the program's main window will display this structure. If you have any suggestions... I would like the tabs to look like the following (of course, not exactly; this handmade image is awful). Image http://imageshack.us/a/img831/3889/subtabs.png 回答1: Use nested QTabWidgets: an outer primary tab which contains

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

How to reference a widget inside a specific tab of a QTabWidget?

倾然丶 夕夏残阳落幕 提交于 2019-12-23 23:45:46
问题 I am using PyQt to make a GUI for a circuit simulator, and am programmatically creating and deleting tabs (i.e. the user clicks on a button, and a new tab is added to a QTabWidget). This is already working (I drew a QFrame in Qt Creator and, in my code, add it as a new tab), but I need to refer to a widget which is inside a specific tab (e.g. a QwtPlot inside the 3rd tab). How can this be achieved? 回答1: You can retrieve the widget from a specific tab by calling QTabWidget.widget(index). 来源:

PyQt5 How To Set TabWidget West But Keep The Text Horizontal

回眸只為那壹抹淺笑 提交于 2019-12-22 07:59:22
问题 How To Make Text Direction From Left To Right Instade Of Top To Bottom 回答1: In this answer I will make a python translation of my another answer written in C++. from PyQt5 import QtCore, QtGui, QtWidgets class TabBar(QtWidgets.QTabBar): def tabSizeHint(self, index): s = QtWidgets.QTabBar.tabSizeHint(self, index) s.transpose() return s def paintEvent(self, event): painter = QtWidgets.QStylePainter(self) opt = QtWidgets.QStyleOptionTab() for i in range(self.count()): self.initStyleOption(opt, i