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


C++ QAction::setIconVisibleInMenu方法代码示例

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


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

示例1: privacyModeChanged

void
ActionCollection::togglePrivateListeningMode()
{
    tDebug() << Q_FUNC_INFO;
    if ( TomahawkSettings::instance()->privateListeningMode() == TomahawkSettings::PublicListening )
        TomahawkSettings::instance()->setPrivateListeningMode( TomahawkSettings::FullyPrivate );
    else
        TomahawkSettings::instance()->setPrivateListeningMode( TomahawkSettings::PublicListening );

    QAction *privacyToggle = m_actionCollection[ "togglePrivacy" ];
    bool isPublic = TomahawkSettings::instance()->privateListeningMode() == TomahawkSettings::PublicListening;
    privacyToggle->setText( ( isPublic ? tr( "&Listen Privately" ) : tr( "&Listen Publicly" ) ) );
    privacyToggle->setIconVisibleInMenu( isPublic );

    emit privacyModeChanged();
}
开发者ID:AndyCoder,项目名称:tomahawk,代码行数:16,代码来源:ActionCollection.cpp

示例2: qWarning

Command *ActionManagerPrivate::registerOverridableAction(QAction *action, const QString &id, bool checkUnique)
{
    OverrideableAction *a = 0;
    const int uid = UniqueIDManager::instance()->uniqueIdentifier(id);

    if (CommandPrivate * c = m_idCmdMap.value(uid, 0)) {
        a = qobject_cast<OverrideableAction *>(c);
        if (!a) {
            qWarning() << "registerAction: id" << id << "is registered with a different command type.";
            return c;
        }
    } else {
        a = new OverrideableAction(uid);
        m_idCmdMap.insert(uid, a);
    }

    if (!a->action()) {
        QAction *baseAction = new QAction(m_mainWnd);
        baseAction->setObjectName(id);
        baseAction->setCheckable(action->isCheckable());
        baseAction->setIcon(action->icon());
        baseAction->setIconText(action->iconText());
        baseAction->setText(action->text());
        baseAction->setToolTip(action->toolTip());
        baseAction->setStatusTip(action->statusTip());
        baseAction->setWhatsThis(action->whatsThis());
        baseAction->setChecked(action->isChecked());
        baseAction->setSeparator(action->isSeparator());
        baseAction->setShortcutContext(Qt::ApplicationShortcut);
        baseAction->setEnabled(false);
        baseAction->setParent(m_mainWnd);
#ifdef Q_WS_MAC
        baseAction->setIconVisibleInMenu(false);
#endif
        a->setAction(baseAction);
        m_mainWnd->addAction(baseAction);
        a->setKeySequence(a->keySequence());
        a->setDefaultKeySequence(QKeySequence());
    } else if (checkUnique) {
        qWarning() << "registerOverridableAction: id" << id << "is already registered.";
    }

    return a;
}
开发者ID:MorS25,项目名称:OpenPilot,代码行数:44,代码来源:actionmanager.cpp

示例3: QAction

void
ActionCollection::initActions()
{
    QAction *latchOn = new QAction( tr( "&Listen Along" ), this );
    latchOn->setIcon( QIcon( RESPATH "images/headphones-sidebar.png" ) );
    m_actionCollection[ "latchOn" ] = latchOn;
    QAction *latchOff = new QAction( tr( "Stop &Listening Along" ), this );
    latchOff->setIcon( QIcon( RESPATH "images/headphones-off.png" ) );
    m_actionCollection[ "latchOff" ] = latchOff;

    QAction *realtimeFollowingAlong = new QAction( tr( "&Follow in real-time" ), this );
    realtimeFollowingAlong->setCheckable( true );
    m_actionCollection[ "realtimeFollowingAlong" ] = realtimeFollowingAlong;

    bool isPublic = TomahawkSettings::instance()->privateListeningMode() == TomahawkSettings::PublicListening;
    QAction *privacyToggle = new QAction( ( isPublic ? tr( "&Listen Privately" ) : tr( "&Listen Publicly" ) ), this );
    privacyToggle->setIcon( QIcon( RESPATH "images/private-listening.png" ) );
    privacyToggle->setIconVisibleInMenu( isPublic );
    m_actionCollection[ "togglePrivacy" ] = privacyToggle;
    connect( m_actionCollection[ "togglePrivacy" ], SIGNAL( triggered() ), SLOT( togglePrivateListeningMode() ), Qt::UniqueConnection );

    m_actionCollection[ "loadPlaylist" ] = new QAction( tr( "&Load Playlist" ), this );
    m_actionCollection[ "renamePlaylist" ] = new QAction( tr( "&Rename Playlist" ), this );
    m_actionCollection[ "copyPlaylist" ] = new QAction( tr( "&Copy Playlist Link" ), this );
    m_actionCollection[ "playPause" ] = new QAction( tr( "&Play" ), this );
    m_actionCollection[ "stop" ] = new QAction( tr( "&Stop" ), this );
    m_actionCollection[ "previousTrack" ] = new QAction( tr( "&Previous Track" ), this );
    m_actionCollection[ "nextTrack" ] = new QAction( tr( "&Next Track" ), this );
    m_actionCollection[ "quit" ] = new QAction( tr( "&Quit" ), this );

    // connect actions to AudioEngine
    AudioEngine *ae = AudioEngine::instance();
    connect( m_actionCollection[ "playPause" ],     SIGNAL( triggered() ), ae,   SLOT( playPause() ), Qt::UniqueConnection );
    connect( m_actionCollection[ "stop" ],          SIGNAL( triggered() ), ae,   SLOT( stop() ),      Qt::UniqueConnection );
    connect( m_actionCollection[ "previousTrack" ], SIGNAL( triggered() ), ae,   SLOT( previous() ),  Qt::UniqueConnection );
    connect( m_actionCollection[ "nextTrack" ],     SIGNAL( triggered() ), ae,   SLOT( next() ),      Qt::UniqueConnection );
}
开发者ID:creichert,项目名称:tomahawk,代码行数:37,代码来源:ActionCollection.cpp

示例4: QAction

void
ActionCollection::initActions()
{
    QAction *latchOn = new QAction( tr( "&Listen Along" ), this );
    latchOn->setIcon( ImageRegistry::instance()->icon( RESPATH "images/headphones.svg" ) );
    m_actionCollection[ "latchOn" ] = latchOn;
    QAction *latchOff = new QAction( tr( "Stop &Listening Along" ), this );
    latchOff->setIcon( ImageRegistry::instance()->icon( RESPATH "images/headphones-off.svg" ) );
    m_actionCollection[ "latchOff" ] = latchOff;

    QAction *realtimeFollowingAlong = new QAction( tr( "&Follow in real-time" ), this );
    realtimeFollowingAlong->setCheckable( true );
    m_actionCollection[ "realtimeFollowingAlong" ] = realtimeFollowingAlong;

    bool isPublic = TomahawkSettings::instance()->privateListeningMode() == TomahawkSettings::PublicListening;
    QAction *privacyToggle = new QAction( ( isPublic ? tr( "&Listen Privately" ) : tr( "&Listen Publicly" ) ), this );
    privacyToggle->setIcon( ImageRegistry::instance()->icon( RESPATH "images/private-listening.svg" ) );
    privacyToggle->setIconVisibleInMenu( isPublic );
    m_actionCollection[ "togglePrivacy" ] = privacyToggle;
    connect( m_actionCollection[ "togglePrivacy" ], SIGNAL( triggered() ), SLOT( togglePrivateListeningMode() ), Qt::UniqueConnection );

    m_actionCollection[ "loadPlaylist" ] =   new QAction( tr( "&Load Playlist" ), this );
    m_actionCollection[ "loadStation" ] =    new QAction( tr( "&Load Station" ), this );
    m_actionCollection[ "renamePlaylist" ] = new QAction( tr( "&Rename Playlist" ), this );
    m_actionCollection[ "renameStation" ] = new QAction( tr( "&Rename Station" ), this );
    m_actionCollection[ "copyPlaylist" ] =   new QAction( tr( "&Copy Playlist Link" ), this );
    m_actionCollection[ "playPause" ] =      new QAction( tr( "&Play" ), this );
    m_actionCollection[ "playPause" ]->setIcon( ImageRegistry::instance()->icon( RESPATH "images/play-rest.svg" ) );
    m_actionCollection[ "playPause" ]->setShortcut( Qt::Key_Space );
    m_actionCollection[ "playPause" ]->setShortcutContext( Qt::ApplicationShortcut );
    m_actionCollection[ "stop" ] =           new QAction( tr( "&Stop" ), this );
    m_actionCollection[ "previousTrack" ] =  new QAction( tr( "&Previous Track" ), this );
    m_actionCollection[ "previousTrack" ]->setIcon( ImageRegistry::instance()->icon( RESPATH "images/back-rest.svg" ) );
    m_actionCollection[ "nextTrack" ] =      new QAction( tr( "&Next Track" ), this );
    m_actionCollection[ "nextTrack" ]->setIcon( ImageRegistry::instance()->icon( RESPATH "images/skip-rest.svg" ) );
    m_actionCollection[ "quit" ] =           new QAction( tr( "&Quit" ), this );
    m_actionCollection[ "quit" ]->setShortcut( QKeySequence::Quit );
    m_actionCollection[ "quit" ]->setShortcutContext( Qt::ApplicationShortcut );
    m_actionCollection[ "quit" ]->setMenuRole( QAction::QuitRole );

    // connect actions to AudioEngine
    AudioEngine *ae = AudioEngine::instance();
    connect( m_actionCollection[ "playPause" ],     SIGNAL( triggered() ), ae,   SLOT( playPause() ), Qt::UniqueConnection );
    connect( m_actionCollection[ "stop" ],          SIGNAL( triggered() ), ae,   SLOT( stop() ),      Qt::UniqueConnection );
    connect( m_actionCollection[ "previousTrack" ], SIGNAL( triggered() ), ae,   SLOT( previous() ),  Qt::UniqueConnection );
    connect( m_actionCollection[ "nextTrack" ],     SIGNAL( triggered() ), ae,   SLOT( next() ),      Qt::UniqueConnection );

    // main menu actions
    m_actionCollection[ "loadXSPF" ] = new QAction( tr( "Load &XSPF..." ), this );
    m_actionCollection[ "updateCollection" ] = new QAction( tr( "U&pdate Collection" ), this );
    m_actionCollection[ "rescanCollection" ] = new QAction( tr( "Fully &Rescan Collection" ), this );
    m_actionCollection[ "showOfflineSources" ] = new QAction( tr( "Show Offline Sources" ), this );
    m_actionCollection[ "showOfflineSources" ]->setCheckable( true );
    m_actionCollection[ "preferences" ] = new QAction( tr( "&Configure Tomahawk..." ), this );
    m_actionCollection[ "preferences" ]->setIcon( ImageRegistry::instance()->icon( RESPATH "images/configure.svg" ) );
    m_actionCollection[ "preferences" ]->setMenuRole( QAction::PreferencesRole );
#ifdef Q_OS_MAC
    m_actionCollection[ "minimize" ] = new QAction( tr( "Minimize" ), this );
    m_actionCollection[ "minimize" ]->setShortcut( QKeySequence( "Ctrl+M" ) );
    m_actionCollection[ "zoom" ] = new QAction( tr( "Zoom" ), this );
    m_actionCollection[ "zoom" ]->setShortcut( QKeySequence( "Meta+Ctrl+Z" ) );
    m_actionCollection[ "fullscreen" ] = new QAction( tr( "Enter Full Screen" ), this );
    m_actionCollection[ "fullscreen" ]->setShortcut( QKeySequence( "Meta+Ctrl+F" ) );
#else
    m_actionCollection[ "toggleMenuBar" ] = new QAction( tr( "Hide Menu Bar" ), this );
    m_actionCollection[ "toggleMenuBar" ]->setShortcut( QKeySequence( "Ctrl+M" ) );
    m_actionCollection[ "toggleMenuBar" ]->setShortcutContext( Qt::ApplicationShortcut );
#endif
    m_actionCollection[ "diagnostics" ] = new QAction( tr( "Diagnostics..." ), this );
    m_actionCollection[ "diagnostics" ]->setMenuRole( QAction::ApplicationSpecificRole );
    m_actionCollection[ "aboutTomahawk" ] = new QAction( tr( "About &Tomahawk..." ), this );
    m_actionCollection[ "aboutTomahawk" ]->setIcon( ImageRegistry::instance()->icon( RESPATH "images/info.svg" ) );
    m_actionCollection[ "aboutTomahawk" ]->setMenuRole( QAction::AboutRole );
    m_actionCollection[ "legalInfo" ] = new QAction( tr( "&Legal Information..." ), this );
    m_actionCollection[ "legalInfo" ]->setMenuRole( QAction::ApplicationSpecificRole );
    m_actionCollection[ "openLogfile" ] = new QAction( tr( "&View Logfile" ), this );
    m_actionCollection[ "openLogfile" ]->setMenuRole( QAction::ApplicationSpecificRole );
    #if defined( Q_OS_MAC ) && defined( HAVE_SPARKLE ) || defined( Q_WS_WIN )
    m_actionCollection[ "checkForUpdates" ] = new QAction( tr( "Check For Updates..." ), this );
    m_actionCollection[ "checkForUpdates" ]->setMenuRole( QAction::ApplicationSpecificRole );
#endif
    m_actionCollection[ "crashNow" ] = new QAction( "Crash now...", this );
}
开发者ID:Nskif,项目名称:tomahawk,代码行数:83,代码来源:ActionCollection.cpp

示例5: Editor

TilesetEditor::TilesetEditor(QObject *parent)
    : Editor(parent)
    , mMainWindow(new TilesetEditorWindow(this))
    , mMainToolBar(new MainToolBar(mMainWindow))
    , mWidgetStack(new QStackedWidget(mMainWindow))
    , mAddTiles(new QAction(this))
    , mRemoveTiles(new QAction(this))
    , mShowAnimationEditor(new QAction(this))
    , mPropertiesDock(new PropertiesDock(mMainWindow))
    , mUndoDock(new UndoDock(mMainWindow))
    , mTerrainDock(new TerrainDock(mMainWindow))
    , mTileCollisionDock(new TileCollisionDock(mMainWindow))
    , mWangDock(new WangDock(mMainWindow))
    , mZoomComboBox(new QComboBox)
    , mStatusInfoLabel(new QLabel)
    , mTileAnimationEditor(new TileAnimationEditor(mMainWindow))
    , mCurrentTilesetDocument(nullptr)
    , mCurrentTile(nullptr)
{
#if QT_VERSION >= 0x050600
    mMainWindow->setDockOptions(mMainWindow->dockOptions() | QMainWindow::GroupedDragging);
#endif
    mMainWindow->setDockNestingEnabled(true);
    mMainWindow->setCentralWidget(mWidgetStack);

    QAction *editTerrain = mTerrainDock->toggleViewAction();
    QAction *editCollision = mTileCollisionDock->toggleViewAction();
    QAction *editWang = mWangDock->toggleViewAction();

    mAddTiles->setIcon(QIcon(QLatin1String(":images/16x16/add.png")));
    mRemoveTiles->setIcon(QIcon(QLatin1String(":images/16x16/remove.png")));
    mShowAnimationEditor->setIcon(QIcon(QLatin1String(":images/24x24/animation-edit.png")));
    mShowAnimationEditor->setCheckable(true);
    mShowAnimationEditor->setIconVisibleInMenu(false);
    editTerrain->setIcon(QIcon(QLatin1String(":images/24x24/terrain.png")));
    editTerrain->setIconVisibleInMenu(false);
    editCollision->setIcon(QIcon(QLatin1String(":images/48x48/tile-collision-editor.png")));
    editCollision->setIconVisibleInMenu(false);
    editWang->setIcon(QIcon(QLatin1String(":images/24x24/wangtile.png")));
    editWang->setIconVisibleInMenu(false);

    Utils::setThemeIcon(mAddTiles, "add");
    Utils::setThemeIcon(mRemoveTiles, "remove");

    mTilesetToolBar = mMainWindow->addToolBar(tr("Tileset"));
    mTilesetToolBar->setObjectName(QLatin1String("TilesetToolBar"));
    mTilesetToolBar->addAction(mAddTiles);
    mTilesetToolBar->addAction(mRemoveTiles);
    mTilesetToolBar->addSeparator();
    mTilesetToolBar->addAction(editTerrain);
    mTilesetToolBar->addAction(editCollision);
    mTilesetToolBar->addAction(editWang);
    mTilesetToolBar->addAction(mShowAnimationEditor);

    mMainWindow->statusBar()->addPermanentWidget(mZoomComboBox);
    mMainWindow->statusBar()->addWidget(mStatusInfoLabel);

    resetLayout();

    connect(mMainWindow, &TilesetEditorWindow::urlsDropped, this, &TilesetEditor::addTiles);

    connect(mWidgetStack, &QStackedWidget::currentChanged, this, &TilesetEditor::currentWidgetChanged);

    connect(mAddTiles, &QAction::triggered, this, &TilesetEditor::openAddTilesDialog);
    connect(mRemoveTiles, &QAction::triggered, this, &TilesetEditor::removeTiles);

    connect(editTerrain, &QAction::toggled, this, &TilesetEditor::setEditTerrain);
    connect(editCollision, &QAction::toggled, this, &TilesetEditor::setEditCollision);
    connect(editWang, &QAction::toggled, this, &TilesetEditor::setEditWang);
    connect(mShowAnimationEditor, &QAction::toggled, mTileAnimationEditor, &TileAnimationEditor::setVisible);

    connect(mTileAnimationEditor, &TileAnimationEditor::closed, this, &TilesetEditor::onAnimationEditorClosed);

    connect(mTerrainDock, &TerrainDock::currentTerrainChanged, this, &TilesetEditor::currentTerrainChanged);
    connect(mTerrainDock, &TerrainDock::addTerrainTypeRequested, this, &TilesetEditor::addTerrainType);
    connect(mTerrainDock, &TerrainDock::removeTerrainTypeRequested, this, &TilesetEditor::removeTerrainType);

    connect(mWangDock, &WangDock::currentWangSetChanged, this, &TilesetEditor::currentWangSetChanged);
    connect(mWangDock, &WangDock::currentWangIdChanged, this, &TilesetEditor::currentWangIdChanged);
    connect(mWangDock, &WangDock::wangColorChanged, this, &TilesetEditor::wangColorChanged);
    connect(mWangDock, &WangDock::addWangSetRequested, this, &TilesetEditor::addWangSet);
    connect(mWangDock, &WangDock::removeWangSetRequested, this, &TilesetEditor::removeWangSet);
    connect(mWangDock->wangColorView(), &WangColorView::wangColorColorPicked,
            this, &TilesetEditor::setWangColorColor);

    connect(this, &TilesetEditor::currentTileChanged,
            mTileAnimationEditor, &TileAnimationEditor::setTile);
    connect(this, &TilesetEditor::currentTileChanged,
            mTileCollisionDock, &TileCollisionDock::setTile);

    connect(mTileCollisionDock, &TileCollisionDock::dummyMapDocumentChanged,
            this, [this]() {
        mPropertiesDock->setDocument(mCurrentTilesetDocument);
    });
    connect(mTileCollisionDock, &TileCollisionDock::hasSelectedObjectsChanged,
            this, &TilesetEditor::hasSelectedCollisionObjectsChanged);
    connect(mTileCollisionDock, &TileCollisionDock::statusInfoChanged,
            mStatusInfoLabel, &QLabel::setText);
    connect(mTileCollisionDock, &TileCollisionDock::visibilityChanged,
            this, &Editor::enabledStandardActionsChanged);
//.........这里部分代码省略.........
开发者ID:zilluss,项目名称:tiled,代码行数:101,代码来源:tileseteditor.cpp

示例6: main


//.........这里部分代码省略.........
        if (blIconHasExt == false && blIconHasPath == false) {
            qaAction->setIcon(QIcon::fromTheme(mliListTemp.strIcon));
        } else
        // path
        if (blIconHasPath == true) {
            qaAction->setIcon(QIcon(mliListTemp.strIcon));
        } else
        // extension but no path
        if (blIconHasExt == true && blIconHasPath == false) {
            qaAction->setIcon(QIcon::fromTheme(mliListTemp.strIcon));
        }

        if (qaAction->icon().isNull()) {
            if (file.exists(strSysPix + "/" + mliListTemp.strIcon)) {
                qaAction->setIcon(QIcon(strSysPix + "/" + mliListTemp.strIcon));
            } else
            if (file.exists(strSysIco + "/" + mliListTemp.strIcon + ".png")) {
                qaAction->setIcon(QIcon(strSysIco + "/" + mliListTemp.strIcon + ".png"));
            } else
            if (file.exists(strSysIco + "/hicolor/scalable/apps/" + mliListTemp.strIcon + ".svg")) {
                qaAction->setIcon(QIcon(strSysIco + "/hicolor/scalable/apps/" + mliListTemp.strIcon + ".svg"));
            } else
            if (file.exists(strSysPix + "/" + mliListTemp.strIcon + ".png")) {
                qaAction->setIcon(QIcon(strSysPix + "/" + mliListTemp.strIcon + ".png"));
            } else
            if (file.exists(strSysPix + "/" + mliListTemp.strIcon + ".xpm")) {
                qaAction->setIcon(QIcon(strSysPix + "/" + mliListTemp.strIcon + ".xpm"));
            } else
            if (file.exists(strSysPix + "/" + mliListTemp.strIcon + ".svg")) {
                qaAction->setIcon(QIcon(strSysPix + "/" + mliListTemp.strIcon + ".svg"));
            }
        }

        qaAction->setIconVisibleInMenu(true);
        qaAction->setData(mliListTemp.strExec);

        menTemp->addAction(qaAction);
    }


    // add separator if there are customs
    if (blHasCustoms) {
        menMain->addSeparator();
    }

    // preferences
    if (menPref->actions().count() > 0) {
        menMain->addMenu(menPref);
        menMain->addSeparator();
    }

    // accessories
    if (menAcc->actions().count() > 0) {
        menMain->addMenu(menAcc);
    }

    // development
    if (menDevel->actions().count() > 0) {
        menMain->addMenu(menDevel);
    }

    // education
    if (menEdu->actions().count() > 0) {
        menMain->addMenu(menEdu);
    }
开发者ID:ViktorNova,项目名称:qtmenu-standalone,代码行数:66,代码来源:main.cpp

示例7: QListWidget


//.........这里部分代码省略.........
    // Sort By Size
    QAction *dateSort = new QAction(QIcon::fromTheme("folder"), "Date Modified", this);
    dateSort->setCheckable(true);
    dateSort->setDisabled(true);
    sortGroup->addAction(dateSort);
    sortMenu->addAction(dateSort);

    // Refresh
    QAction *refresh = new QAction(QIcon::fromTheme("folder"), "Refresh", this);
    menu->addAction(refresh);

    // Add a separator to the menu
    menu->addSeparator();

    // Paste
    QAction *paste = new QAction(QIcon::fromTheme("folder"), "Paste", this);
    paste->setEnabled(false);
    menu->addAction(paste);

    // Paste Shortcut
    QAction *pasteShortCut = new QAction(QIcon::fromTheme("folder"), "Paste Shortcut", this);
    pasteShortCut->setEnabled(false);
    menu->addAction(pasteShortCut);

    // Add a separator to the menu
    menu->addSeparator();

    // New Menu
    QMenu *create = menu->addMenu(tr("&New"));

    // Create Folder
    QAction *createFolder = new QAction(QIcon::fromTheme("folder"), tr("&Folder"), this);
    create->addAction(createFolder);
    createFolder->setIconVisibleInMenu(true);
    connect(createFolder, SIGNAL(triggered()), this, SLOT(createFolder()));

    // Create Launcher
    QAction *createLauncher = new QAction(QIcon::fromTheme("application-x-desktop"), tr("&Launcher"), this);
    create->addAction(createLauncher);
    createLauncher->setIconVisibleInMenu(true);
    connect(createLauncher, SIGNAL(triggered()), this, SLOT(createLauncher()));

    // Create Empty File
    QAction *createEmptyFile = new QAction(QIcon::fromTheme("text-plain"), tr("&Empty File"), this);
    create->addAction(createEmptyFile);
    createEmptyFile->setIconVisibleInMenu(true);
    connect(createEmptyFile, SIGNAL(triggered()), this, SLOT(createEmptyFile()));

    // Add a separator to the menu
    menu->addSeparator();

    // Paste
    QAction *desktopSettings = new QAction(QIcon::fromTheme("preferences-desktop"), "Desktop Settings", this);
    desktopSettings->setIconVisibleInMenu(true);
    menu->addAction(desktopSettings);
    connect(desktopSettings, SIGNAL(triggered()), this, SLOT(execDesktopSettings()));

    // Right Click Desktop Icon Menu
    iconMenu = new QIconMenu(this);

    //
    desktopDir = new QFileSystemWatcher;
    desktopDir->addPath(QDesktopServices::storageLocation(QDesktopServices::DesktopLocation));

    //
    dSettings = new QSettings("chipara", "desktop");
开发者ID:aaronblanchard,项目名称:Quantum,代码行数:67,代码来源:qdesktopview.cpp

示例8: setupMenu


//.........这里部分代码省略.........
    m_settingsMenu->addAction(m_actionManager->find("preferences"));
    // Temporary out while SQA is done
    m_actionManager->enable("preferences", false);

// Temporary out while SQA is done
    // Setting up the insert menu
    // setupInsertActions();
    // Menu Insert
    m_insertMenu = new QMenu(tr("&Import"), this);
    menuBar()->addMenu(m_insertMenu);

    // Adding Options insert scene, insert layer and insert frame
    /*
    m_insertMenu->addAction(m_actionManager->find("InsertScene"));
    m_insertMenu->addAction(m_actionManager->find("InsertLayer"));
    m_insertMenu->addAction(m_actionManager->find("InsertFrame"));
    m_insertMenu->addSeparator();
    */

    // Adding Options import bitmap and import audio file
    m_insertMenu->addAction(m_actionManager->find("importbitmap"));
    m_insertMenu->addAction(m_actionManager->find("importbitmaparray"));
    m_insertMenu->addAction(m_actionManager->find("importsvg"));
    m_insertMenu->addAction(m_actionManager->find("importsvgarray"));

    //m_insertMenu->addAction(m_actionManager->find("importaudiofile"));

    // Setting up the window menu
    // setupWindowActions();
    m_windowMenu = new QMenu(tr("&Window"),this);
    menuBar()->addMenu(m_windowMenu);

    // Adding Options show debug, palette, pen, library, timeline, scenes, exposure, help
    m_windowMenu->addAction(m_actionManager->find("show palette"));
    m_windowMenu->addAction(m_actionManager->find("show pen"));
    m_windowMenu->addAction(m_actionManager->find("show library"));
    m_windowMenu->addAction(m_actionManager->find("show timeline"));
    m_actionManager->enable("show timeline", false);
    m_windowMenu->addAction(m_actionManager->find("show scenes"));
    m_windowMenu->addAction(m_actionManager->find("show exposure"));
    m_windowMenu->addAction(m_actionManager->find("show help"));

#if defined(QT_GUI_LIB) && defined(K_DEBUG)
    m_windowMenu->addAction(m_actionManager->find("show debug"));
#endif

    // m_actionManager->enable("show help", false);
    m_windowMenu->addSeparator();

    // Setup perspective menu
    m_viewMenu = new QMenu(tr("Modules"),this);
    QActionGroup *group = new QActionGroup(this);
    group->setExclusive(true);

    // Adding Option Animation
    QAction *drawingPerspective = new QAction(tr("Animation"), this);
    drawingPerspective->setIcon(QPixmap(THEME_DIR + "icons/animation_mode.png")); 
    drawingPerspective->setIconVisibleInMenu(true);
    drawingPerspective->setShortcut(QKeySequence("Ctrl+1"));
    drawingPerspective->setData(Animation);
    group->addAction(drawingPerspective);

    // Adding Option Player 
    QAction *animationPerspective = new QAction(tr("Player"), this);
    animationPerspective->setIcon(QPixmap(THEME_DIR + "icons/play_small.png"));
    animationPerspective->setIconVisibleInMenu(true);
    animationPerspective->setShortcut(QKeySequence("Ctrl+2"));
    animationPerspective->setData(Player);
    group->addAction(animationPerspective);

   // Adding Option Help 
    QAction *helpPerspective = new QAction(tr("Help"), this);
    helpPerspective->setIcon(QPixmap(THEME_DIR + "icons/help_mode.png"));
    helpPerspective->setIconVisibleInMenu(true);
    helpPerspective->setShortcut(QKeySequence("Ctrl+3"));
    helpPerspective->setData(Help);
    group->addAction(helpPerspective);

   // Adding Option News 
    QAction *newsPerspective = new QAction(tr("News"), this);
    newsPerspective->setIcon(QPixmap(THEME_DIR + "icons/news_mode.png"));
    newsPerspective->setIconVisibleInMenu(true);
    newsPerspective->setShortcut(QKeySequence("Ctrl+4"));
    newsPerspective->setData(News);
    group->addAction(newsPerspective);

    m_viewMenu->addActions(group->actions());
    connect(group, SIGNAL(triggered(QAction *)), this, SLOT(changePerspective(QAction *)));
    menuBar()->addMenu(m_viewMenu);
	
    // Setting up the help menu
    setupHelpActions();
    m_helpMenu = new QMenu(tr("&Help"),this);
    menuBar()->addMenu(m_helpMenu);
    m_helpMenu->addAction(m_actionManager->find("tipofday"));
    m_helpMenu->addSeparator();
    m_helpMenu->addAction(m_actionManager->find("about tupi"));

    setMenuItemsContext(false);
}
开发者ID:skaarj37,项目名称:tupi,代码行数:101,代码来源:tupmainwindow_gui.cpp

示例9: setIconVisibleInMenu

void QActionProto::setIconVisibleInMenu(bool visible)
{
  QAction *item = qscriptvalue_cast<QAction*>(thisObject());
  if (item)
    item->setIconVisibleInMenu(visible);
}
开发者ID:Wushaowei001,项目名称:xtuple-1,代码行数:6,代码来源:qactionproto.cpp

示例10: initList


//.........这里部分代码省略.........
        }

        custom = findFolder(i18nc("Folder Name", "Custom"));
        if (custom == NULL) {
            custom = new QTreeWidgetItem((QTreeWidget*)0, QStringList(i18nc("Folder Name", "Custom")));
            custom->setData(0, TypeRole, QString::number((int) EffectsList::EFFECT_FOLDER));
            custom->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
            insertTopLevelItem(0, custom);
        }
    }

    //insertTopLevelItems(0, folders);
    if (transitionMode) {
        loadEffects(&MainWindow::transitions, misc, &folders, EffectsList::TRANSITION_TYPE, current, &found);
    }
    else {
        loadEffects(&MainWindow::videoEffects, misc, &folders, EffectsList::EFFECT_VIDEO, current, &found);
        loadEffects(&MainWindow::audioEffects, audio, &folders, EffectsList::EFFECT_AUDIO, current, &found);
        loadEffects(&MainWindow::customEffects, custom, static_cast<QList<QTreeWidgetItem *> *>(0), EffectsList::EFFECT_CUSTOM, current, &found);
        if (!found && !currentFolder.isEmpty()) {
            // previously selected effect was removed, focus on its parent folder
            for (int i = 0; i < topLevelItemCount(); ++i) {
                if (topLevelItem(i)->text(0) == currentFolder) {
                    setCurrentItem(topLevelItem(i));
                    break;
                }
            }
        }
    }
    setSortingEnabled(true);
    sortByColumn(0, Qt::AscendingOrder);

    // populate effects menu
    QMenu *sub1 = NULL;
    QMenu *sub2 = NULL;
    QMenu *sub3 = NULL;
    QMenu *sub4 = NULL;
    for (int i = 0; i < topLevelItemCount(); ++i) {
        if (topLevelItem(i)->data(0, TypeRole) == EffectsList::TRANSITION_TYPE) {
            QTreeWidgetItem *item = topLevelItem(i);
            QAction *a = new QAction(item->icon(0), item->text(0), effectsMenu);
            QStringList data = item->data(0, IdRole).toStringList();
            QString id = data.at(1);
            if (id.isEmpty()) id = data.at(0);
            a->setData(data);
            a->setIconVisibleInMenu(false);
            effectsMenu->addAction(a);
            effectActions->addAction("transition_" + id, a);
            continue;
        }
        if (!topLevelItem(i)->childCount())
            continue;
        QMenu *sub = new QMenu(topLevelItem(i)->text(0), effectsMenu);
        effectsMenu->addMenu(sub);
        int effectsInCategory = topLevelItem(i)->childCount();
        bool hasSubCategories = false;
        if (effectsInCategory > 60) {
            // create subcategories if there are too many effects
            hasSubCategories = true;
            sub1 = new QMenu(i18nc("menu name for effects names between these 2 letters", "0 - F"), sub);
            sub->addMenu(sub1);
            sub2 = new QMenu(i18nc("menu name for effects names between these 2 letters", "G - L"), sub);
            sub->addMenu(sub2);
            sub3 = new QMenu(i18nc("menu name for effects names between these 2 letters", "M - R"), sub);
            sub->addMenu(sub3);
            sub4 = new QMenu(i18nc("menu name for effects names between these 2 letters", "S - Z"), sub);
            sub->addMenu(sub4);
        }
        for (int j = 0; j < effectsInCategory; ++j) {
            QTreeWidgetItem *item = topLevelItem(i)->child(j);
            QAction *a = new QAction(item->icon(0), item->text(0), sub);
            QStringList data = item->data(0, IdRole).toStringList();
            QString id = data.at(1);
            if (id.isEmpty()) id = data.at(0);
            a->setData(data);
            a->setIconVisibleInMenu(false);
            if (hasSubCategories) {
                // put action in sub category
                QRegExp rx("^[s-z].+");
                if (rx.exactMatch(item->text(0).toLower())) {
                    sub4->addAction(a);
                } else {
                    rx.setPattern(QStringLiteral("^[m-r].+"));
                    if (rx.exactMatch(item->text(0).toLower())) {
                        sub3->addAction(a);
                    }
                    else {
                        rx.setPattern(QStringLiteral("^[g-l].+"));
                        if (rx.exactMatch(item->text(0).toLower())) {
                            sub2->addAction(a);
                        }
                        else sub1->addAction(a);
                    }
                }
            }
            else sub->addAction(a);
            effectActions->addAction("video_effect_" + id, a);
        }
    }
}
开发者ID:JongHong,项目名称:kdenlive,代码行数:101,代码来源:effectslistwidget.cpp

示例11: createMenu

void Plot::createMenu ()
{
  setContextMenuPolicy(Qt::CustomContextMenu);
  connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(showContextMenu()));

  _menu = new QMenu(this);
  
  _dateAction = new QAction(QIcon(":icons/calendar"), tr("Show &Dates"), this);
  _dateAction->setIconVisibleInMenu(true);
  _dateAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_D));
  _dateAction->setToolTip(tr("Show/Hide Date"));
  _dateAction->setStatusTip(tr("Show/Hide Date"));
  _dateAction->setCheckable(true);
  _dateAction->setChecked(true);
  connect(_dateAction, SIGNAL(triggered(bool)), this, SLOT(showDate(bool)));
  _menu->addAction(_dateAction);

  _gridAction = new QAction(QIcon(":icons/grid"), tr("Show &Grid"), this);
  _gridAction->setIconVisibleInMenu(true);
  _gridAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_G));
  _gridAction->setToolTip(tr("Show/Hide Grid"));
  _gridAction->setStatusTip(tr("Show/Hide Grid"));
  _gridAction->setCheckable(true);
  _gridAction->setChecked(true);
  connect(_gridAction, SIGNAL(triggered(bool)), this, SLOT(setGrid(bool)));
  _menu->addAction(_gridAction);

  _infoAction = new QAction(QIcon(":icons/info"), tr("Show Bar &Info"), this);
  _infoAction->setIconVisibleInMenu(true);
  _infoAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_I));
  _infoAction->setToolTip(tr("Show/Hide Bar Info"));
  _infoAction->setStatusTip(tr("Show/Hide Bar Info"));
  _infoAction->setCheckable(true);
  _infoAction->setChecked(true);
  connect(_infoAction, SIGNAL(triggered(bool)), this, SLOT(setInfo(bool)));
  _menu->addAction(_infoAction);

  _menu->addSeparator();
  
  // create the chart object menu
  QMenu *mm = new QMenu(this);
  mm->setTitle(tr("New Plot Marker..."));
  connect(mm, SIGNAL(triggered(QAction *)), this, SLOT(markerMenuSelected(QAction *)));
  _menu->addMenu(mm);

  // buy
  QAction *a = new QAction(QIcon(":icons/buy"), tr("&Buy"), this);
  a->setToolTip(tr("Create Buy Arrow Plot Marker"));
  a->setIconVisibleInMenu(true);
  a->setStatusTip(QString(tr("Create Buy Arrow Plot Marker")));
  a->setData(QVariant("MarkerBuy"));
  mm->addAction(a);

  // sell
  a = new QAction(QIcon(":icons/sell"), tr("&Sell"), this);
  a->setToolTip(tr("Create Sell Arrow Plot Marker"));
  a->setIconVisibleInMenu(true);
  a->setStatusTip(QString(tr("Create Sell Arrow Plot Marker")));
  a->setData(QVariant("MarkerSell"));
  mm->addAction(a);

  // tline
  a = new QAction(QIcon(":icons/trend"), tr("Trend &Line"), this);
  a->setIconVisibleInMenu(true);
  a->setToolTip(tr("Create Trend Line Plot Marker"));
  a->setStatusTip(QString(tr("Create Trend Line Plot Marker")));
  a->setData(QVariant("MarkerTLine"));
  mm->addAction(a);

  // tline
  a = new QAction(QIcon(":icons/trend"), tr("&Horizontal Line"), this);
  a->setIconVisibleInMenu(true);
  a->setToolTip(tr("Create Trend Line Plot Marker"));
  a->setStatusTip(QString(tr("Create Trend Line Plot Marker")));
  a->setData(QVariant("MarkerHLine"));
  mm->addAction(a);

  // marker menu
  _markerMenu = new QMenu(this);
  _markerMenu->addAction(QIcon(":icons/edit"), QObject::tr("&Edit"), this, SLOT(markerDialog()), QKeySequence(Qt::ALT+Qt::Key_E));
  _markerMenu->addAction(QIcon(":icons/delete"), QObject::tr("&Delete"), this, SLOT(deleteMarker()), QKeySequence(Qt::ALT+Qt::Key_D));
  _markerMenu->menuAction()->setIconVisibleInMenu(true);
}
开发者ID:Fantasticer,项目名称:qttrader,代码行数:83,代码来源:Plot.cpp

示例12: onAccountChanged

/**
 * Update the account menu when accounts changed
 */
void AccountView::onAccountChanged()
{
    const std::vector<Account>& accounts = seafApplet->accountManager()->accounts();

    // Remove all menu items
    account_menu_->clear();

    if (!accounts.empty()) {
        for (size_t i = 0, n = accounts.size(); i < n; i++) {
            const Account &account = accounts[i];
            QString text = account.username + "(" + account.serverUrl.host() + ")";
            if (!account.isValid()) {
                text += ", " + tr("not logged in");
            }
            QMenu *submenu = new QMenu(text, account_menu_);
            if (i == 0) {
                submenu->setIcon(QIcon(":/images/account-checked.png"));
            } else {
                submenu->setIcon(QIcon(":/images/account-else.png"));
            }

            QAction *submenu_action = submenu->menuAction();
            submenu_action->setData(QVariant::fromValue(account));
            connect(submenu_action, SIGNAL(triggered()), this, SLOT(onAccountItemClicked()));

            QAction *action = new QAction(tr("Choose"), submenu);
            action->setIcon(QIcon(":/images/account-checked.png"));
            action->setIconVisibleInMenu(true);
            action->setData(QVariant::fromValue(account));
            connect(action, SIGNAL(triggered()), this, SLOT(onAccountItemClicked()));

            submenu->addAction(action);
            submenu->setDefaultAction(action);

            QAction *account_settings_action = new QAction(tr("Account settings"), this);
            account_settings_action->setIcon(QIcon(":/images/account-settings.png"));
            account_settings_action->setIconVisibleInMenu(true);
            account_settings_action->setData(QVariant::fromValue(account));
            connect(account_settings_action, SIGNAL(triggered()), this, SLOT(editAccountSettings()));
            submenu->addAction(account_settings_action);

            QAction *toggle_action = new QAction(this);
            toggle_action->setIcon(QIcon(":/images/logout.png"));
            toggle_action->setIconVisibleInMenu(true);
            toggle_action->setData(QVariant::fromValue(account));
            connect(toggle_action, SIGNAL(triggered()), this, SLOT(toggleAccount()));
            if (account.isValid())
                toggle_action->setText(tr("Logout"));
            else
                toggle_action->setText(tr("Login"));
            submenu->addAction(toggle_action);

            QAction *delete_account_action = new QAction(tr("Delete"), this);
            delete_account_action->setIcon(QIcon(":/images/delete-account.png"));
            delete_account_action->setIconVisibleInMenu(true);
            delete_account_action->setData(QVariant::fromValue(account));
            connect(delete_account_action, SIGNAL(triggered()), this, SLOT(deleteAccount()));
            submenu->addAction(delete_account_action);

            account_menu_->addMenu(submenu);
        }

        account_menu_->addSeparator();
    }

    add_account_action_ = new QAction(tr("Add an account"), this);
    add_account_action_->setIcon(QIcon(":/images/add-account.png"));
    add_account_action_->setIconVisibleInMenu(true);
    connect(add_account_action_, SIGNAL(triggered()), this, SLOT(showAddAccountDialog()));
    account_menu_->addAction(add_account_action_);

    updateAccountInfoDisplay();
}
开发者ID:Geosparc,项目名称:seafile-client,代码行数:76,代码来源:account-view.cpp


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