osx - Combine toolbar and title bar in Qt -
how can toolbar implemented in top bar, like, example, tiled has done?
normally, toolbar looks follows:

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
Post a Comment