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

python - How to create a legend for 3D bar in matplotlib? -

php - Dynamic url re-writing using htaccess -

java - Multi-Label Document Classification -