qt - How to display fix banner between QMenubar and QToolBar in QMainWindow -


how can show fixed banner (with widget label , button ) in between qmenubar , qtoolbar ? qstatusbar in between qmenubar , qtoolbar. tried implement using qtoolbar.

 // toolbar banner lable inside it.  qlabel * bannerlabel = new qlabel(" bannertoobar label banner.");  bannerlabel->setalignment( qt::alignvcenter );  ui.bannertoobar->addwidget( bannerlabel );  ui.bannertoobar->setallowedareas(qt::toolbararea::toptoolbararea);  ui.bannertoobar->setmovable( false );    qsize banner_sz = ui.bannertoobar->size();  ui.bannertoobar->setfixedheight( banner_sz.height() * 2 );  qsizepolicy banner_szpolicy( qsizepolicy::policy::maximum,  qsizepolicy::policy::fixed );   banner_szpolicy.sethorizontalstretch(255);  ui.bannertoobar->setsizepolicy( banner_szpolicy ); 

but can't prevent user draging maintoolbar , droping in same row bannertoolbar

you can force wrap using qmainwindow::addtoolbarbreak, don't know way prevent being put there later user (except making toolbars non-moveable).

if there qtoolbar::docklocationchanged signal (which seems have been requsted , resolved in https://bugreports.qt-project.org/browse/qtbug-1274, still don't see signal anywhere), suppose use inserttoolbarbreak fix whenever things have changed. maybe there's hackish way notified when toolbars move.

or use qmainwindow::setmenuwidget place widget containing both qmenubar , else menu area of qmainwindow. tricky if want support styles (mac/gnome/etc) menubar gets lifted out of window top-of-screen , toolbar gets unified window title decorations. idea of banner between menubar , toolbar naturally has problems in such cases :-)


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -