Re: Custom TabWidget button
If you want a direct equivalent then I'd add a tool button to the tab bar and reposition it as necessary.
1 Attachment(s)
Re: Custom TabWidget button
So i will not make new thread my question is: How i can give QMenu and QTabBar to Window frame like in Firefox Attachment 8081 and how i can style frame i don't mean QFrame but Window frame for example GOM Player hasn't got windows's usualy frame but it has it's frame
Re: Custom TabWidget button
I would start by creating a custom QWidget (derived from QTabBar) that contains both a QTabBar and a QToolBar widget in a layout. Then, derive a custom QTabWidget class that replaces its native QTabBar with an instance of your custom tab bar class (see QTabWidget::setTabBar()). This is a protected function, so you are forced to derive a new QTabWidget class. You would probably need to do that anyway, because you will be changing the tool bar contents depending on what is being displayed in a specific tab.
Re: Custom TabWidget button
thanks and how i can add toolbar to QWidget i try some thinks but they don't work
Added after 5 minutes:
Quote:
Originally Posted by
d_stranz
I would start by creating a custom QWidget (derived from QTabBar) that contains both a QTabBar and a QToolBar widget in a layout. Then, derive a custom QTabWidget class that replaces its native QTabBar with an instance of your custom tab bar class (see
QTabWidget::setTabBar()). This is a protected function, so you are forced to derive a new QTabWidget class. You would probably need to do that anyway, because you will be changing the tool bar contents depending on what is being displayed in a specific tab.
this isn't quite what i want because still stay window's frames. What you wrote is good but it will not look good i want tabbar in frame
I know how make QToolBar but i don't know how i can dock it to Top when i create toolbar in Widget
Code:
QToolbar *bar= new QToolbar("toolbar",this);
it make toolbar but the toolbar size is about 2x2 but i want toolba like toolbar in QMainWindow
3 Attachment(s)
Re: Custom TabWidget button
ok you can forget what i say. Now i have toolbar
Code:
QToolbar *bar= new QToolbar("toolbar",this);
Attachment 8084 but i want dock it to top like Attachment 8083
Re: Custom TabWidget button
Code:
// MainWindow.cpp constructor:
dock->setAllowedAreas( Qt::TopDockWidgetArea );
dock->setFloating( false );
dock->setWidget( toolbar );
Re: Custom TabWidget button
It's don't work like i want. I have QWidget and i want add toolbar to the Widget and i want same toolbar like in QMainWindow do you understand what i mean ???
Re: Custom TabWidget button
Then why don't you use QMainWindow instead of QWidget as your base class?
Re: Custom TabWidget button
I found how to solve it
Code:
vbox->addWidget(toolBar);
vbox->setContentsMargins(0,0,0,0);
vbox->setSpacing(0);
setLayout(vbox);
this is what i need :D