osx - Combine toolbar and title bar in Qt -


how can toolbar implemented in top bar, like, example, tiled has done?

tiled normally, toolbar looks follows:

enter image description here

example code how currently:

class mainwindow : public qmainwindow {     q_object  public:     explicit mainwindow(qwidget *parent = nullptr) {         auto *tbar = new qtoolbar();           tbar->addwidget(new qpushbutton("push me"));         this->addtoolbar(tbar);     } }; 

if still using qt 4.x, can use setunifiedtitleandtoolbaronmac(bool set) function included in qmainwindow:

class mainwindow : public qmainwindow {     q_object  public:     explicit mainwindow(qwidget *parent = nullptr) {         auto *tbar = new qtoolbar();           tbar->addwidget(new qpushbutton("push me"));         this->addtoolbar(tbar);         this->setunifiedtitleandtoolbaronmac(true); // activate mac-style toolbar     } }; 

see also: https://qt-project.org/doc/qt-4.8/qmainwindow.html#unifiedtitleandtoolbaronmac-prop


Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -