Index: kstyle/demo/main.cpp =================================================================== --- kstyle/demo/main.cpp +++ kstyle/demo/main.cpp @@ -54,6 +54,7 @@ app.setAttribute( Qt::AA_UseHighDpiPixmaps, commandLine.isSet( enableHighDpi ) ); #endif + app.setAttribute(Qt::AA_DontUseNativeMenuBar); app.setApplicationName( i18n( "Oxygen Demo" ) ); app.setWindowIcon( QIcon::fromTheme( QStringLiteral( "oxygen" ) ) ); Index: kstyle/demo/oxygendemodialog.h =================================================================== --- kstyle/demo/oxygendemodialog.h +++ kstyle/demo/oxygendemodialog.h @@ -75,6 +75,7 @@ //! toggle RightToLeft virtual void toggleRightToLeft( bool ); + virtual void layoutDirectionChanged( Qt::LayoutDirection ); protected: Index: kstyle/demo/oxygendemodialog.cpp =================================================================== --- kstyle/demo/oxygendemodialog.cpp +++ kstyle/demo/oxygendemodialog.cpp @@ -79,7 +79,11 @@ buttonBox->addButton( _enableCheckBox, QDialogButtonBox::ResetRole ); _rightToLeftCheckBox = new QCheckBox( i18n( "Right to left layout" ) ); + _rightToLeftCheckBox->setChecked( qApp->isRightToLeft() ); connect( _rightToLeftCheckBox, SIGNAL(toggled(bool)), SLOT(toggleRightToLeft(bool)) ); +#if QT_VERSION >= 0x050400 + connect( qApp, SIGNAL(layoutDirectionChanged(Qt::LayoutDirection)), SLOT(layoutDirectionChanged(Qt::LayoutDirection)) ); +#endif buttonBox->addButton( _rightToLeftCheckBox, QDialogButtonBox::ResetRole ); #ifdef HAVE_SCHEME_CHOOSER @@ -153,7 +157,7 @@ // mdi { page = new KPageWidgetItem( widget = new MdiDemoWidget() ); - page->setName( i18n( "MDI Windows" ) ); + page->setName( i18n( "MDI Windows & Menus" ) ); setPageIcon( page, QStringLiteral( "preferences-system-windows" ) ); page->setHeader( i18n( "Shows the appearance of MDI windows" ) ); pageWidget->addPage( page ); @@ -233,6 +237,10 @@ { qApp->setLayoutDirection( value ? Qt::RightToLeft:Qt::LeftToRight ); } //_______________________________________________________________ + void DemoDialog::layoutDirectionChanged( Qt::LayoutDirection direction ) + { _rightToLeftCheckBox->setChecked( direction == Qt::RightToLeft ); } + + //_______________________________________________________________ void DemoDialog::closeEvent( QCloseEvent* event ) { emit abortSimulations(); Index: kstyle/demo/oxygenmdidemowidget.cpp =================================================================== --- kstyle/demo/oxygenmdidemowidget.cpp +++ kstyle/demo/oxygenmdidemowidget.cpp @@ -40,19 +40,44 @@ { setLayout( new QVBoxLayout() ); QMenuBar* menuBar = new QMenuBar( this ); + // let the menubar appear in the MDI window on all platforms + menuBar->setNativeMenuBar( false ); layout()->addWidget( menuBar ); QWidget* widget = new QWidget( this ); layout()->addWidget( widget ); ui.setupUi( widget ); QMenu* menu = menuBar->addMenu( i18n( "Layout" ) ); - connect( menu->addAction( i18n( "Tile" ) ), SIGNAL(triggered()), this, SLOT(setLayoutTiled()) ); - connect( menu->addAction( i18n( "Cascade" ) ), SIGNAL(triggered()), this, SLOT(setLayoutCascade()) ); - connect( menu->addAction( i18n( "Tabs" ) ), SIGNAL(triggered()), this, SLOT(setLayoutTabbed()) ); + QAction *action; +#if QT_VERSION < 0x050000 + action = new QAction( i18n( "Exclusive actions" ), this ); + action->setSeparator(true); + menu->addAction( action ); + menuBar->addMenu( menu ); +#else + menu->addSection( i18n( "Exclusive actions" ) ); +#endif + QActionGroup *aGroup = new QActionGroup( menu ); + action = menu->addAction( i18n( "Tile" ) ); + action->setCheckable( true ); + aGroup->addAction( action ); + connect( action, SIGNAL(triggered()), this, SLOT(setLayoutTiled()) ); + action = menu->addAction( i18n( "Cascade" ) ); + action->setCheckable( true ); + aGroup->addAction( action ); + connect( action, SIGNAL(triggered()), this, SLOT(setLayoutCascade()) ); + action = menu->addAction( i18n( "Tabs" ) ); + action->setCheckable( true ); + aGroup->addAction( action ); + connect( action, SIGNAL(triggered()), this, SLOT(setLayoutTabbed()) ); + + menu->addSeparator(); + + action = menu->addAction( i18n( "<- Check here" ) ); + action->setCheckable( true ); menu = menuBar->addMenu( i18n( "Tools" ) ); - QAction* action; connect( action = menu->addAction( QIcon::fromTheme( QStringLiteral( "arrow-right" ) ), i18n( "Select Next Window" ) ), SIGNAL(triggered()), ui.mdiArea, SLOT(activateNextSubWindow()) ); action->setShortcut( Qt::CTRL + Qt::Key_Tab ); addAction( action );