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


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

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


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

示例1: createMenubar

//------------------------------------------------------------------------
// create all stuff for the menubar
//------------------------------------------------------------------------
void ApplicationWindow::createMenubar()
{
    QPixmap newIcon(filenew);
    QPixmap openIcon(fileopen);
    QPixmap quitIcon(quit);
    QFont boldfont;
    boldfont.setWeight(QFont::Bold);

    // File menu

    QMenu *file = new QMenu(tr("&File"), this);
    file->setFont(QFont("Helvetica", 8));
    file->addAction(newIcon, "&New", this, SLOT(newDoc()), Qt::CTRL + Qt::Key_N);
    file->addAction(openIcon, "&Open", this, SLOT(choose()), Qt::CTRL + Qt::Key_O);
    file->addSeparator();
    file->addAction(quitIcon, "&Quit", qApp, SLOT(closeAllWindows()), Qt::CTRL + Qt::Key_Q);

    // Preference menu

    QMenu *pref = new QMenu(tr("&Preference"), this);
    pref->setFont(QFont("Helvetica", 8));
    showMessageAreaAction = pref->addAction("Show MessageArea", this, SLOT(showMsg()));
    showMessageAreaAction->setChecked(false);

    // Style menu

    QMenu *styleMenu = new QMenu(tr("&Style"), this);
    styleMenu->setFont(QFont("Helvetica", 8));

    QActionGroup *ag = new QActionGroup(this);
    ag->setExclusive(true);

    QSignalMapper *styleMapper = new QSignalMapper(this);
    connect(styleMapper, SIGNAL(mapped(const QString &)),
            this, SLOT(setStyle(const QString &)));

    // Help menu
    QMenu *help = new QMenu(tr("&Help"), this);
    help->setFont(QFont("Helvetica", 8));
    help->addAction("&About", this, SLOT(about()), Qt::Key_F1);
    help->addSeparator();
    help->addAction("What's &This", this, SLOT(whatsThis()), Qt::SHIFT + Qt::Key_F1);

    menuBar()->setFont(boldfont);
    menuBar()->addMenu(file);
    menuBar()->addMenu(pref);
    menuBar()->addMenu(styleMenu);
    menuBar()->addMenu(help);
}
开发者ID:nixz,项目名称:covise,代码行数:52,代码来源:VRBapplication.cpp

示例2: tr

void favorites2::setOptionMenu( QMenu& m,bool addCancel )
{
	m.setFont( this->font() ) ;

	connect( m.addAction( tr( "Toggle AutoMount" ) ),&QAction::triggered,[ this ](){

		this->toggleAutoMount() ;
	} ) ;

	m.addSeparator() ;

	connect( m.addAction( tr( "Edit" ) ),&QAction::triggered,[ this ](){

		this->edit() ;
	} ) ;

	m.addSeparator() ;

	connect( m.addAction( tr( "Remove Selected Entry" ) ),&QAction::triggered,[ this ](){

		this->removeEntryFromFavoriteList() ;
	} ) ;

	m.addSeparator() ;

	if( addCancel ){

		m.addSeparator() ;

		m.addAction( tr( "Cancel" ) ) ;
	}
}
开发者ID:mhogomchungu,项目名称:SiriKali,代码行数:32,代码来源:favorites2.cpp

示例3: createStandardContextMenu

QMenu*
SpinBox::getRightClickMenu()
{
    QMenu* menu =  createStandardContextMenu();
    menu->setFont(QApplication::font()); // necessary
    return menu;
}
开发者ID:JamesLinus,项目名称:Natron,代码行数:7,代码来源:SpinBox.cpp

示例4: contextMenuEvent

void AudioItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *)
{
    QMenu menu;
    QFont menuFont = qApp->font();
    menuFont.setPixelSize(14);
    menu.setFont(menuFont);

    if (m_audio->getAudioDecoder() != NULL)
    {
        AudioDecoder *ad = m_audio->getAudioDecoder();
        AudioParameters ap = ad->audioParameters();

        if (ap.channels() == 1)
            m_previewLeftAction->setText(tr("Preview Mono"));
        menu.addAction(m_previewLeftAction);
        if (ap.channels() == 2)
        {
            m_previewLeftAction->setText(tr("Preview Left Channel"));
            menu.addAction(m_previewRightAction);
            menu.addAction(m_previewStereoAction);
        }
        menu.addSeparator();
    }

    foreach(QAction *action, getDefaultActions())
        menu.addAction(action);

    menu.exec(QCursor::pos());
}
开发者ID:PML369,项目名称:qlcplus,代码行数:29,代码来源:audioitem.cpp

示例5: createThemeMenu

void NMainMenuBar::createThemeMenu(QMenu *parentMenu) {
    QMenu *menu = parentMenu->addMenu(tr("Theme"));
    QStringList list = global.getThemeNames();
    QFont f = global.getGuiFont(QFont());

    global.settings->beginGroup(INI_GROUP_APPEARANCE);
    QString userTheme = global.settings->value("themeName", DEFAULT_THEME_NAME).toString();
    global.settings->endGroup();


    // Setup themes (we expect to find the DEFAULT_THEME_NAME theme as first one)
    for (int i = 0; i < list.size(); i++) {
        QString themeName(list[i]);
        if ((i == 0) && (QString::compare(themeName, DEFAULT_THEME_NAME, Qt::CaseInsensitive) != 0)) {
            QLOG_ERROR() << "First theme is expected to be " << DEFAULT_THEME_NAME;
        }


        QAction *themeAction = new QAction(themeName, this);
        themeAction->setData(themeName);
        themeAction->setCheckable(true);
        themeAction->setFont(f);
        connect(themeAction, SIGNAL(triggered()), parent, SLOT(reloadIcons()));
        if (themeName == userTheme) {
            themeAction->setChecked(true);
        }
        themeActions.append(themeAction);
    }
    menu->addActions(themeActions);
    menu->setFont(f);
}
开发者ID:jeffkowalski,项目名称:Nixnote2,代码行数:31,代码来源:nmainmenubar.cpp

示例6: mousePressEvent

void ConfigLabel::mousePressEvent(QMouseEvent *ev)
{
	if (QGuiApplication::mouseButtons() == Qt::RightButton)
	{
		QRect rect = this->rect();
		auto CIDlg = new ConfigInfoDlg(this, DevThr);
		int ret = CIDlg->exec();
		setDevice(Last_StoreData.DeviceType);
	}
	else if (QGuiApplication::mouseButtons() == Qt::LeftButton)
	{
		QMenu *ChooseMenu = new QMenu(this);
		QAction *Choose801Action = new QAction("TR801", this);
		QAction *Choose802Action = new QAction("TR802", this);
		QAction *Choose805Action = new QAction("TR805", this);
		connect(Choose801Action, &QAction::triggered, [&](){
			setDevice(TR801, true);
		});
		connect(Choose802Action, &QAction::triggered, [&](){
			setDevice(TR802, true);
		});
		connect(Choose805Action, &QAction::triggered, [&](){
			setDevice(TR805, true);
		});
		QFont font;
		font.setPointSize(10);
		ChooseMenu->setFont(font);
		ChooseMenu->addAction(Choose801Action);
		ChooseMenu->addAction(Choose802Action);
		ChooseMenu->addAction(Choose805Action);
		ChooseMenu->exec(QCursor::pos());
	}
}
开发者ID:chenzhengxi,项目名称:TR800-CFG,代码行数:33,代码来源:ConfigLabel.cpp

示例7: findStack

// Search through the list of known stack menu items & find the menu for
// this notebook's stack.  If one doesn't exist we add it.
QMenu* NotebookMenuButton::findStack(Notebook n) {
    if (!n.__isset.stack || QString::fromStdString(n.stack).trimmed() == "")
        return &rootMenu;

    QString stack = QString::fromStdString(n.stack).trimmed();
    for (int i=0; i<stackMenus.size(); i++) {
        if (stackMenus.at(i)->title().toLower() == stack.toLower())
            return stackMenus.at(i);
    }


    // Create a new stack.  We add a dummy action item to the
    // menu so we know where to add the menu later.  This
    // keeps things in sorted order
    QMenu *newMenu = new QMenu(this);
    newMenu->setTitle(stack);
    QFont f = newMenu->font();
    f.setPointSize(10);
    f.setBold(false);
    newMenu->setFont(f);
    stackMenus.append(newMenu);
    QAction *placeHolder = new QAction(this);
    placeHolder->setVisible(false);
    placeHolder->setText(stack);
    addNotebookMenuItem(&rootMenu, placeHolder);
    addStackMenuItem(newMenu);
    return newMenu;
}
开发者ID:,项目名称:,代码行数:30,代码来源:

示例8: QMenu

QMenu*
ActionCollection::createCompactMenu( QWidget* parent )
{
    QMenu* compactMenu = new QMenu( tr( "Main Menu" ), parent );
    compactMenu->setFont( TomahawkUtils::systemFont() );

    compactMenu->addAction( m_actionCollection[ "playPause" ] );
    compactMenu->addAction( m_actionCollection[ "previousTrack" ] );
    compactMenu->addAction( m_actionCollection[ "nextTrack" ] );
    compactMenu->addSeparator();
    compactMenu->addAction( m_actionCollection[ "togglePrivacy" ] );
    compactMenu->addAction( m_actionCollection[ "showOfflineSources" ] );
    compactMenu->addSeparator();
    compactMenu->addAction( m_actionCollection[ "importPlaylist" ] );
    compactMenu->addAction( m_actionCollection[ "updateCollection" ] );
    compactMenu->addAction( m_actionCollection[ "rescanCollection" ] );
    compactMenu->addSeparator();

#ifdef Q_OS_MAC // This should never happen anyway
    compactMenu->addAction( m_actionCollection[ "minimize" ] );
    compactMenu->addAction( m_actionCollection[ "zoom" ] );
#else
    compactMenu->addAction( m_actionCollection[ "toggleMenuBar" ] );
#endif
    compactMenu->addAction( m_actionCollection[ "preferences" ] );
    compactMenu->addSeparator();

    compactMenu->addAction( m_actionCollection[ "diagnostics" ] );
    compactMenu->addAction( m_actionCollection[ "openLogfile" ] );
    compactMenu->addAction( m_actionCollection[ "legalInfo" ] );
    QMenu* whatsNew = compactMenu->addMenu( ImageRegistry::instance()->icon( RESPATH "images/whatsnew.svg" ), tr( "What's New in ..." ) );
    whatsNew->addAction( m_actionCollection[ "whatsnew_0_8" ] );
    compactMenu->addAction( m_actionCollection[ "aboutTomahawk" ] );

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

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

    return compactMenu;
}
开发者ID:AidedPolecat6,项目名称:tomahawk,代码行数:59,代码来源:ActionCollection.cpp

示例9: contextMenuEvent

void RGBMatrixItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *)
{
    QMenu menu;
    QFont menuFont = qApp->font();
    menuFont.setPixelSize(14);
    menu.setFont(menuFont);

    foreach(QAction *action, getDefaultActions())
        menu.addAction(action);

    menu.exec(QCursor::pos());
}
开发者ID:exmatrikulator,项目名称:qlcplus,代码行数:12,代码来源:rgbmatrixitem.cpp

示例10: itemClicked

void favorites::itemClicked( QTableWidgetItem * current,bool clicked )
{
	QMenu m ;
	m.setFont( this->font() ) ;
	connect( m.addAction( tr( "Remove Selected Entry" ) ),SIGNAL( triggered() ),this,SLOT( removeEntryFromFavoriteList() ) ) ;

	m.addSeparator() ;
	m.addAction( tr( "Cancel" ) ) ;

	if( clicked ){
		m.exec( QCursor::pos() ) ;
	}else{
		int x = m_ui->tableWidget->columnWidth( 0 ) ;
		int y = m_ui->tableWidget->rowHeight( current->row() ) * current->row() + 20 ;
		m.exec( m_ui->tableWidget->mapToGlobal( QPoint( x,y ) ) ) ;
	}
}
开发者ID:bankonme,项目名称:zuluCrypt,代码行数:17,代码来源:favorites.cpp

示例11: itemClicked

void manageSystemVolumes::itemClicked( QTableWidgetItem * current,bool clicked )
{
	if( current ){
		QMenu m ;
		m.setFont( this->font() ) ;
		connect( m.addAction( tr( "remove selected entry" ) ),SIGNAL( triggered() ),this,SLOT( removeCurrentRow() ) ) ;

		m.addSeparator() ;
		m.addAction( tr( "cancel" ) ) ;

		if( clicked ){
			m.exec( QCursor::pos() ) ;
		}else{
			int x = m_ui->tableWidget->columnWidth( 0 ) / 2 ;
			int y = m_ui->tableWidget->rowHeight( current->row() ) * current->row() + 20 ;
			m.exec( m_ui->tableWidget->mapToGlobal( QPoint( x,y ) ) ) ;
		}
	}
}
开发者ID:jballard1991,项目名称:software,代码行数:19,代码来源:managesystemvolumes.cpp

示例12: contextMenuEvent

void RGBMatrixItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *)
{
    QMenu menu;
    QFont menuFont = qApp->font();
    menuFont.setPixelSize(14);
    menu.setFont(menuFont);

    menu.addAction(m_alignToCursor);
    if (isLocked())
    {
        m_lockAction->setText(tr("Unlock item"));
        m_lockAction->setIcon(QIcon(":/unlock.png"));
    }
    else
    {
        m_lockAction->setText(tr("Lock item"));
        m_lockAction->setIcon(QIcon(":/lock.png"));
    }
    menu.addAction(m_lockAction);

    menu.exec(QCursor::pos());
}
开发者ID:nomis52,项目名称:qlcplus,代码行数:22,代码来源:rgbmatrixitem.cpp

示例13: contextMenuEvent

void VideoItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *)
{
    QMenu menu;
    QFont menuFont = qApp->font();
    menuFont.setPixelSize(14);
    menu.setFont(menuFont);

    int screenCount = m_video->getScreenCount();
    if (screenCount > 0)
    {
        for (int i = 0; i < screenCount; i++)
        {
            QAction *scrAction = new QAction(tr("Screen %1").arg(i + 1), this);
            scrAction->setCheckable(true);
            if (m_video->screen() == i)
                scrAction->setChecked(true);
            scrAction->setData(i);
            connect(scrAction, SIGNAL(triggered()),
                    this, SLOT(slotScreenChanged()));
            menu.addAction(scrAction);
        }
    }
    menu.addAction(m_fullscreenAction);
    menu.addAction(m_alignToCursor);
    if (isLocked())
    {
        m_lockAction->setText(tr("Unlock item"));
        m_lockAction->setIcon(QIcon(":/unlock.png"));
    }
    else
    {
        m_lockAction->setText(tr("Lock item"));
        m_lockAction->setIcon(QIcon(":/lock.png"));
    }
    menu.addAction(m_lockAction);

    menu.exec(QCursor::pos());
}
开发者ID:nomis52,项目名称:qlcplus,代码行数:38,代码来源:videoitem.cpp

示例14: contextMenuEvent

void AudioItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *)
{
    QMenu menu;
    QFont menuFont = qApp->font();
    menuFont.setPixelSize(14);
    menu.setFont(menuFont);

    if (m_audio->getAudioDecoder() != NULL)
    {
        AudioDecoder *ad = m_audio->getAudioDecoder();
        AudioParameters ap = ad->audioParameters();

        if (ap.channels() == 1)
            m_previewLeftAction->setText(tr("Preview Mono"));
        menu.addAction(m_previewLeftAction);
        if (ap.channels() == 2)
        {
            m_previewLeftAction->setText(tr("Preview Left Channel"));
            menu.addAction(m_previewRightAction);
            menu.addAction(m_previewStereoAction);
        }
        menu.addSeparator();
    }
    menu.addAction(m_alignToCursor);
    if (isLocked())
    {
        m_lockAction->setText(tr("Unlock item"));
        m_lockAction->setIcon(QIcon(":/unlock.png"));
    }
    else
    {
        m_lockAction->setText(tr("Lock item"));
        m_lockAction->setIcon(QIcon(":/lock.png"));
    }
    menu.addAction(m_lockAction);

    menu.exec(QCursor::pos());
}
开发者ID:snowshow,项目名称:qlcplus,代码行数:38,代码来源:audioitem.cpp

示例15: showContextMenu

void MainWindow::showContextMenu( QTableWidgetItem * item,bool itemClicked )
{
	QMenu m ;

	m.setFont( this->font() ) ;

	int row = item->row() ;

	QString mt = m_ui->tableWidget->item( row,1 )->text() ;

	QString device = m_ui->tableWidget->item( row,0 )->text() ;

	if( mt == "Nil" ){

		connect( m.addAction( tr( "Mount" ) ),SIGNAL( triggered() ),this,SLOT( slotMount() ) ) ;
	}else{
		QString mp = QString( "/run/media/private/%1/" ).arg( utility::userName() ) ;
		QString mp_1 = QString( "/home/%1/" ).arg( utility::userName() ) ;

		if( mt.startsWith( mp ) || mt.startsWith( mp_1 ) ){

			connect( m.addAction( tr( "Unmount" ) ),SIGNAL( triggered() ),this,SLOT( pbUmount() ) ) ;

			m.addSeparator() ;

			QString fs = m_ui->tableWidget->item( row,2 )->text() ;

			if( fs != "encfs" ){

				connect( m.addAction( tr( "Properties" ) ),SIGNAL( triggered() ),this,SLOT( volumeProperties() ) ) ;
				m.addSeparator() ;
			}

			m_sharedFolderPath = utility::sharedMountPointPath( mt ) ;

			if( m_sharedFolderPath.isEmpty() ){

				connect( m.addAction( tr( "Open Folder" ) ),SIGNAL( triggered() ),
					 this,SLOT( slotOpenFolder() ) ) ;
			}else{
				connect( m.addAction( tr( "Open Private Folder" ) ),SIGNAL( triggered() ),
					 this,SLOT( slotOpenFolder() ) ) ;
				connect( m.addAction( tr( "Open Shared Folder" ) ),SIGNAL( triggered() ),
					 this,SLOT( slotOpenSharedFolder() ) ) ;
			}
		}else{
			m_sharedFolderPath = utility::sharedMountPointPath( mt ) ;

			if( m_sharedFolderPath.isEmpty() ){

				if( utility::pathIsReadable( mt ) ){

					connect( m.addAction( tr( "Properties" ) ),SIGNAL( triggered() ),this,SLOT( volumeProperties() ) ) ;
					m.addSeparator() ;
					connect( m.addAction( tr( "Open Folder" ) ),SIGNAL( triggered() ),
						 this,SLOT( slotOpenFolder() ) ) ;
				}else{
					connect( m.addAction( tr( "Properties" ) ),SIGNAL( triggered() ),this,SLOT( volumeProperties() ) ) ;
				}
			}else{
				connect( m.addAction( tr( "Properties" ) ),SIGNAL( triggered() ),this,SLOT( volumeProperties() ) ) ;

				m.addSeparator() ;

				connect( m.addAction( tr( "Open Shared Folder" ) ),SIGNAL( triggered() ),
					 this,SLOT( slotOpenSharedFolder() ) ) ;
			}
		}
	}

	m.addSeparator() ;
	m.addAction( tr( "Close Menu" ) ) ;

	if( itemClicked ){
		m.exec( QCursor::pos() ) ;
	}else{
		QPoint p = this->pos() ;
		int x = p.x() + 100 + m_ui->tableWidget->columnWidth( 0 ) ;
		int y = p.y() + 50 + m_ui->tableWidget->rowHeight( 0 ) * item->row() ;
		p.setX( x ) ;
		p.setY( y ) ;
		m.exec( p ) ;
	}
}
开发者ID:bankonme,项目名称:zuluCrypt,代码行数:84,代码来源:mainwindow.cpp


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