当前位置: 首页>>代码示例>>C++>>正文


C++ QMenuBar::setFont方法代码示例

本文整理汇总了C++中QMenuBar::setFont方法的典型用法代码示例。如果您正苦于以下问题:C++ QMenuBar::setFont方法的具体用法?C++ QMenuBar::setFont怎么用?C++ QMenuBar::setFont使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QMenuBar的用法示例。


在下文中一共展示了QMenuBar::setFont方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: QMenuBar

QMenuBar*
ActionCollection::createMenuBar( QWidget *parent )
{
    QMenuBar* menuBar = new QMenuBar( parent );
    menuBar->setFont( TomahawkUtils::systemFont() );

    QMenu* controlsMenu = new QMenu( tr( "&Controls" ), menuBar );
    controlsMenu->setFont( TomahawkUtils::systemFont() );
    controlsMenu->addAction( m_actionCollection[ "playPause" ] );
    controlsMenu->addAction( m_actionCollection[ "previousTrack" ] );
    controlsMenu->addAction( m_actionCollection[ "nextTrack" ] );
    controlsMenu->addSeparator();
    controlsMenu->addAction( m_actionCollection[ "togglePrivacy" ] );
    controlsMenu->addAction( m_actionCollection[ "showOfflineSources" ] );
    controlsMenu->addSeparator();
    controlsMenu->addAction( m_actionCollection[ "importPlaylist" ] );
    controlsMenu->addAction( m_actionCollection[ "updateCollection" ] );
    controlsMenu->addAction( m_actionCollection[ "rescanCollection" ] );
    controlsMenu->addSeparator();
    controlsMenu->addAction( m_actionCollection[ "quit" ] );

    QMenu* settingsMenu = new QMenu( tr( "&Settings" ), menuBar );
    settingsMenu->setFont( TomahawkUtils::systemFont() );
#ifndef Q_OS_MAC
    settingsMenu->addAction( m_actionCollection[ "toggleMenuBar" ] );
#endif
    settingsMenu->addAction( m_actionCollection[ "preferences" ] );

    QMenu* helpMenu = new QMenu( tr( "&Help" ), menuBar );
    helpMenu->setFont( TomahawkUtils::systemFont() );
    helpMenu->addAction( m_actionCollection[ "diagnostics" ] );
    helpMenu->addAction( m_actionCollection[ "openLogfile" ] );
    helpMenu->addAction( m_actionCollection[ "legalInfo" ] );
    helpMenu->addAction( m_actionCollection["getSupport"] );
    helpMenu->addAction( m_actionCollection["reportBug"] );
    helpMenu->addAction( m_actionCollection["helpTranslate"] );
    helpMenu->addSeparator();
    QMenu* whatsNew = helpMenu->addMenu( ImageRegistry::instance()->icon( RESPATH "images/whatsnew.svg" ), tr( "What's New in ..." ) );
    whatsNew->setFont( TomahawkUtils::systemFont() );
    whatsNew->addAction( m_actionCollection[ "whatsnew_0_8" ] );
    helpMenu->addAction( m_actionCollection[ "aboutTomahawk" ] );

    // Setup update check
#ifndef Q_OS_MAC
    helpMenu->insertSeparator( m_actionCollection[ "legalInfo" ] );
#endif

#if defined( Q_OS_MAC ) && defined( HAVE_SPARKLE )
    helpMenu->addAction( m_actionCollection[ "checkForUpdates" ] );
#elif defined( Q_OS_WIN )
    helpMenu->addSeparator();
    helpMenu->addAction( m_actionCollection[ "checkForUpdates" ] );
#endif
    if ( qApp->arguments().contains( "--debug" ) )
    {
        helpMenu->addSeparator();
        helpMenu->addAction( m_actionCollection[ "crashNow" ] );
    }

    menuBar->addMenu( controlsMenu );
    menuBar->addMenu( settingsMenu );

#if defined( Q_OS_MAC )
    QMenu* windowMenu = new QMenu( tr( "&Window" ), menuBar );
    windowMenu->setFont( TomahawkUtils::systemFont() );
    windowMenu->addAction( m_actionCollection[ "minimize" ] );
    windowMenu->addAction( m_actionCollection[ "zoom" ] );
    windowMenu->addAction( m_actionCollection[ "fullscreen" ] );

    menuBar->addMenu( windowMenu );
#endif

    menuBar->addMenu( helpMenu );
    return menuBar;
}
开发者ID:AidedPolecat6,项目名称:tomahawk,代码行数:75,代码来源:ActionCollection.cpp


注:本文中的QMenuBar::setFont方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。