Offsetting the tab in QTabWidget
-
I'm trying to use a QTabWidget to create a simple ribbon style bar.
As creating the QTabWidget where the tabs are on the top, the tabs always start from the left, like this:
What should I do as I want to shift the tabs to the right, to get something like this:
As also how to add a button to the space created by the right-shift? Ultimately I'd like to get something similar to word, like this:
Thanks!
-
Hi,
Not a direct answer however, did you saw QTitanRibbon ?
-
I'm trying to use a QTabWidget to create a simple ribbon style bar.
As creating the QTabWidget where the tabs are on the top, the tabs always start from the left, like this:
What should I do as I want to shift the tabs to the right, to get something like this:
As also how to add a button to the space created by the right-shift? Ultimately I'd like to get something similar to word, like this:
Thanks!
@Pauly
Hi for a "poor man's" version ;)
you can use a stylesheet withQTabWidget::tab-bar {
left: 50px; /* move to the right */
}It might be difficult to use in layout though as the round menu is half in over the tab
but you might be able to tweak to work ok. -
myTabWidget->setStyleSheet("content of my cool style sheet");
-
I still have to learn about stylesheet... So where do I set this? Thanks.
QTabWidget::tab-bar {
left: 50px; /* move to the right */
}@Pauly
For start just use Creator
Open a form UI file and place a tabwidget
Then right click it and select Change Stylesheet.
Its a mini editor.And then read
http://doc.qt.io/qt-5/stylesheet-syntax.html -
Thanks a lot. I'm able to get something like this... poor man version...
I think some of the pushbutton at the top left corner is behind the title bar. How can I deal with this? Thanks!
-
Thanks a lot. I'm able to get something like this... poor man version...
I think some of the pushbutton at the top left corner is behind the title bar. How can I deal with this? Thanks!
-
Yes, I made its y negative trying to have the button sit on top of the title bar, as the word scheme looks like. PushButton->raise(); does not raise it above the title bar. I read some post which said that title bar will always on top? Thanks...
-
After some researching, I hide the title bar by adding
setWindowFlags(Qt::Window | Qt::CustomizeWindowHint);
Now I get:
Gone with the title bar is the drag&move, the minimize/maximize/close buttons. I guess I can add some widget for those function. Is there a Qt class that handle these kind of actions (title bar actions)? Thanks!
-
After some researching, I hide the title bar by adding
setWindowFlags(Qt::Window | Qt::CustomizeWindowHint);
Now I get:
Gone with the title bar is the drag&move, the minimize/maximize/close buttons. I guess I can add some widget for those function. Is there a Qt class that handle these kind of actions (title bar actions)? Thanks!
-
I tried it and it is more invloving to redo the title bar with a widget. The title bar response to upside resize and width change etc. I decide to defer it to later time. Maybe that is not a good idea for poor man. :)