tags:

views:

163

answers:

1

On my toolbar in Qt, I have several QMenus (all of which align to the left by default). I would like to make one of them align to the right side, but I can't seem to find the correct way to do this. Any ideas?

+1  A: 

QMotifStyle gave me the answer. In that style, after adding a separator in the menubar, subsequent menus are added to the right hand side of the menu. The solution was to use write a QStyle proxy class, but overload one method: styleHint, to return true on SH_DrawMenuBarSeparator (which is what QMotifStyle does).

int MyStyle::styleHint( StyleHint hint, const QStyleOption * option, const QWidget * widget, QStyleHintReturn * returnData) const

// Return true on menu bar separator so subsequent menu bars are 
// drawn on the right side of the bar!
if ( hint == SH_DrawMenuBarSeparator)
    return true;
else 
 return style->styleHint(hint, option, widget, returnData);
Will