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


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

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


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

示例1: sPrepareWindowMenu

void menuWindow::sPrepareWindowMenu()
{
  _windowMenu->clear();

  if (! _parent->showTopLevel())
  {
    _windowMenu->addAction(_data->_cascade);
    _windowMenu->addAction(_data->_tile);

    _windowMenu->addSeparator();
  }

  _windowMenu->addAction(_data->_closeActive);
  _windowMenu->addAction(_data->_closeAll);

  QWidgetList windows = _parent->windowList();

  bool b;
  if(_preferences->value("InterfaceWindowOption") != "TopLevel")
  {
  b = windows.isEmpty();
  }
  else
  {
  b = !windows.isEmpty();
  }

  _data->_cascade->setEnabled(b);
  _data->_tile->setEnabled(b);

  _data->_closeActive->setEnabled(b);
  _data->_closeAll->setEnabled(b);

  _windowMenu->addSeparator();

  if (_parent->showTopLevel())
    _data->_lastActive = QApplication::activeWindow();
  else if (_parent->workspace() && _parent->workspace()->activeSubWindow())
    _data->_lastActive = _parent->workspace()->activeSubWindow()->widget();
  else
    _data->_lastActive = 0;

  if (_data->_lastActive)
  {
    if(!_data->_geometryMenu)
      _data->_geometryMenu = new QMenu();

    _data->_geometryMenu->clear();
    _data->_geometryMenu->setTitle(_data->_lastActive->windowTitle());

    QString objName = _data->_lastActive->objectName();
    
    _data->_rememberPos->setChecked(xtsettingsValue(objName + "/geometry/rememberPos", true).toBool());
    _data->_geometryMenu->addAction(_data->_rememberPos);
    _data->_rememberSize->setChecked(xtsettingsValue(objName + "/geometry/rememberSize", true).toBool());
    _data->_geometryMenu->addAction(_data->_rememberSize);

    _windowMenu->addMenu(_data->_geometryMenu);
    _windowMenu->addSeparator();
  }

  QAction *m = 0;
  foreach (QWidget *wind, windows)
  {
    m = _windowMenu->addAction(wind->windowTitle(), this, SLOT(sActivateWindow()));
    if(m)
    {
      m->setData(qVariantFromValue(wind));
      m->setCheckable(true);
      m->setChecked((_data->_lastActive == wind));
    }
  }
开发者ID:ChristopherCotnoir,项目名称:qt-client,代码行数:72,代码来源:menuWindow.cpp

示例2: if

void
SourceTreeView::setupMenus()
{
    m_playlistMenu.clear();
    m_roPlaylistMenu.clear();
    m_latchMenu.clear();
    m_privacyMenu.clear();

    bool readonly = true;
    SourcesModel::RowType type = ( SourcesModel::RowType )model()->data( m_contextMenuIndex, SourcesModel::SourceTreeItemTypeRole ).toInt();
    if ( type == SourcesModel::StaticPlaylist || type == SourcesModel::AutomaticPlaylist || type == SourcesModel::Station )
    {

        PlaylistItem* item = itemFromIndex< PlaylistItem >( m_contextMenuIndex );
        playlist_ptr playlist = item->playlist();
        if ( !playlist.isNull() )
        {
            readonly = !playlist->author()->isLocal();
        }
    }

    QAction* latchOnAction = ActionCollection::instance()->getAction( "latchOn" );
    m_latchMenu.addAction( latchOnAction );

    m_privacyMenu.addAction( ActionCollection::instance()->getAction( "togglePrivacy" ) );

    if ( type == SourcesModel::Collection )
    {
        SourceItem* item = itemFromIndex< SourceItem >( m_contextMenuIndex );
        source_ptr source = item->source();
        if ( !source.isNull() )
        {
            if ( m_latchManager->isLatched( source ) )
            {
                QAction *latchOffAction = ActionCollection::instance()->getAction( "latchOff" );
                m_latchMenu.addAction( latchOffAction );
                connect( latchOffAction, SIGNAL( triggered() ), SLOT( latchOff() ) );
                m_latchMenu.addSeparator();
                QAction *latchRealtimeAction = ActionCollection::instance()->getAction( "realtimeFollowingAlong" );
                latchRealtimeAction->setChecked( source->playlistInterface()->latchMode() == Tomahawk::PlaylistInterface::RealTime );
                m_latchMenu.addAction( latchRealtimeAction );
                connect( latchRealtimeAction, SIGNAL( toggled( bool ) ), SLOT( latchModeToggled( bool ) ) );
            }
        }
    }

    QAction *loadPlaylistAction = ActionCollection::instance()->getAction( "loadPlaylist" );
    m_playlistMenu.addAction( loadPlaylistAction );
    QAction *renamePlaylistAction = ActionCollection::instance()->getAction( "renamePlaylist" );
    m_playlistMenu.addAction( renamePlaylistAction );
    m_playlistMenu.addSeparator();

    QAction *copyPlaylistAction = m_playlistMenu.addAction( tr( "&Copy Link" ) );
    QAction *deletePlaylistAction = m_playlistMenu.addAction( tr( "&Delete %1" ).arg( SourcesModel::rowTypeToString( type ) ) );

    QString addToText = QString( "Add to my %1" );
    if ( type == SourcesModel::StaticPlaylist )
        addToText = addToText.arg( "Playlists" );
    if ( type == SourcesModel::AutomaticPlaylist )
        addToText = addToText.arg( "Automatic Playlists" );
    else if ( type == SourcesModel::Station )
        addToText = addToText.arg( "Stations" );

    QAction *addToLocalAction = m_roPlaylistMenu.addAction( tr( addToText.toUtf8(), "Adds the given playlist, dynamic playlist, or station to the users's own list" ) );

    m_roPlaylistMenu.addAction( copyPlaylistAction );
    deletePlaylistAction->setEnabled( !readonly );
    renamePlaylistAction->setEnabled( !readonly );
    addToLocalAction->setEnabled( readonly );

    if ( type == SourcesModel::StaticPlaylist )
        copyPlaylistAction->setText( tr( "&Export Playlist" ) );

    connect( loadPlaylistAction,   SIGNAL( triggered() ), SLOT( loadPlaylist() ) );
    connect( renamePlaylistAction, SIGNAL( triggered() ), SLOT( renamePlaylist() ) );
    connect( deletePlaylistAction, SIGNAL( triggered() ), SLOT( deletePlaylist() ) );
    connect( copyPlaylistAction,   SIGNAL( triggered() ), SLOT( copyPlaylistLink() ) );
    connect( addToLocalAction,     SIGNAL( triggered() ), SLOT( addToLocal() ) );
    connect( latchOnAction,        SIGNAL( triggered() ), SLOT( latchOnOrCatchUp() ), Qt::QueuedConnection );
}
开发者ID:ubertaco,项目名称:tomahawk,代码行数:80,代码来源:sourcetreeview.cpp

示例3: QMainWindow

MainWindow::MainWindow(QStringList filesnames, int viewasked, QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    C = new Core();

#if defined(_WIN32) && defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_APP) //Setup UI for winRT
    setMenuBar(new QMenuBar(0));
#else
    setWindowTitle("MediaInfo");
#endif

    settings = new QSettings("MediaArea.net", "MediaInfo");
    defaultSettings();
    applySettings();

    if( (viewasked>=0) && (viewasked<NB_VIEW) )
        view=ViewMode(viewasked);
    else
        view = (ViewMode)settings->value("defaultView",VIEW_EASY).toInt();

#if defined(_WIN32) && defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_APP) //Setup UI for winRT
    addToolBar(Qt::LeftToolBarArea, ui->toolBar);
    ui->toolBar->setFloatable(false);
    ui->toolBar->setMovable(false);
    ui->menuBar->hide();
#endif

    //tests
    ui->actionQuit->setIcon(style()->standardIcon(QStyle::SP_DialogCloseButton));
    ui->actionClose_All->setIcon(style()->standardIcon(QStyle::SP_DialogCloseButton));
    ui->actionOpen->setIcon(QIcon(":/icon/openfile.svg"));
    ui->actionOpen_Folder->setIcon(QIcon(":/icon/opendir.svg"));
    ui->actionAbout->setIcon(QIcon(":/icon/about.svg"));
    ui->actionExport->setIcon(QIcon(":/icon/export.svg"));

    menuView = new QMenu();
   QActionGroup* menuItemGroup = new QActionGroup(this);
   for(int v=VIEW_EASY;v<NB_VIEW;v++) {
       QAction* action = new QAction(nameView((ViewMode)v), menuItemGroup);
       action->setCheckable(true);
       if(view==v)
           action->setChecked(true);
       action->setProperty("view",v);
       ui->menuView->addAction(action);
       menuView->addAction(action);
   }
   connect(menuItemGroup,SIGNAL(triggered(QAction*)),this,SLOT(actionView_toggled(QAction*)));

   buttonView = new QToolButton();
   buttonView->setText("view");
   buttonView->setIcon(QIcon(":/icon/view.svg"));
   connect(buttonView, SIGNAL(clicked()), this, SLOT(buttonViewClicked()));
   ui->toolBar->addWidget(buttonView);

    ui->toolBar->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(ui->toolBar,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(toolBarOptions(QPoint)));
    connect(ui->toolBar,SIGNAL(toolButtonStyleChanged(Qt::ToolButtonStyle)),buttonView,SLOT(setToolButtonStyle(Qt::ToolButtonStyle)));

    timer=NULL;
    progressDialog=NULL;

    refreshDisplay();

    if(filesnames.count()>0) {
        openFiles(filesnames);
    }

    /*
    qDebug() << "0.7 " << "0.7.5 " << isNewer("0.7","0.7.5");
    qDebug() << "0.7.4 " << "0.7.5 " << isNewer("0.7.4","0.7.5");
    qDebug() << "0.7.5 " << "0.7.4 " << isNewer("0.7.5","0.7.4");
    qDebug() << "0.7.4 " << "0.7 " << isNewer("0.7.4","0.7");
    qDebug() << "0.7.5 " << "0.7.5 " << isNewer("0.7.5","0.7.5");
    */

#ifdef NEW_VERSION
    if(settings->value("checkForNewVersion",true).toBool()) {
        checkForNewVersion();
    }
#endif

}
开发者ID:g-maxime,项目名称:MediaInfo,代码行数:82,代码来源:mainwindow.cpp

示例4: AddDevice

//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
void tAutopilotSelectedDeviceMenu::AddDevice( const tN2kName& name, bool selected, bool enabled )
{
    QString nameStr = tGlobal<tNDP2k>::Instance()->DeviceManager().DataSourceStr( name );

    //DbgPrintf( QString("AddDevice nameStr=%1 value=%2").arg( nameStr ).arg( quint64( name.llValue() ) ) );

    if( nameStr == "???" ) // incase the simnet selection is a device we have never seen...
    {
        // Get Simnet Nmea2k DevTag instead
        unsigned char devTag[16] = ""; // DEV_TAG_CHARS
        if( SystemData::bGetDevTag( (unsigned char*)name.ToByteArray().data(), 0, devTag ) )
        {
            nameStr = QString((char *)devTag);
        }
    }

    bool insertDevice = false;
    // Sort names into order of decreasing name
    QList<tAction*> actionList = SubActions();
    int i;
    for( i = 0; i < actionList.size(); ++i )
    {
        quint64 nameInList = quint64( actionList[i]->data().toLongLong() );
        //DbgPrintf( QString("AddDevice: index=%1 nameInList=%2").arg( i ).arg( nameInList ) );
        if ( nameInList > 0 ) //If it's not one of the fixed items at the top or a separator
        {
            if( quint64( name.llValue() ) == nameInList )
            {
                //Already in list - just update
                //DbgPrintf( "Device already in list" );
                QAction* pAction = actionList[i];
                pAction->setText( nameStr );
                if ( pAction->isCheckable() )
                {
                    pAction->setChecked( selected );
                }
                return;
            }
            else if( quint64( name.llValue() ) > nameInList )
            {
                DbgPrintf( "Name greater than nameInList" );
                insertDevice = true;
                break;
            }
        }
    }

    tAction* pAction = new tAction( nameStr, this );
    pAction->setCheckable( true );
    pAction->setChecked( selected );
    pAction->setData( QVariant( name.llValue() ) );
    pAction->setEnabled( enabled );
    if( insertDevice )
    {
        DbgPrintf( QString("Inserting action at index %1").arg( i ) );
        InsertAction( actionList[i], pAction );
    }
    else // Append
    {
        DbgPrintf( QString("Adding action %1").arg( nameStr ) );
        AddAction( pAction );
    }

    m_SelectDeviceActGroup.append( pAction );

    Connect( pAction, SIGNAL( triggered( bool ) ), this, SLOT( SelectDevice( bool ) ) );
}
开发者ID:dulton,项目名称:53_hero,代码行数:70,代码来源:tAutopilotSelectedDeviceMenu.cpp

示例5: createPopupMenu

QMenu* ObjectWidget::createPopupMenu()
{
  QMenu* menu = new QMenu(tr("&Object"));
  QAction* action;
  action = menu->addAction(QIcon(":/icons/page_copy.png"), tr("&Copy"));
  action->setShortcut(QKeySequence(QKeySequence::Copy));
  action->setStatusTip(tr("Copy the current selection's contents or view to the clipboard"));
  connect(action, SIGNAL(triggered()), this, SLOT(copy()));

  menu->addSeparator();
  
  QMenu* subMenu = menu->addMenu(tr("&Drag and Drop"));
  action = subMenu->menuAction();
  action->setIcon(QIcon(":/icons/DragPlane.png"));
  action->setStatusTip(tr("Select the drag and drop dynamics mode and plane along which operations are performed"));
  QActionGroup* actionGroup = new QActionGroup(subMenu);
  QSignalMapper* signalMapper = new QSignalMapper(subMenu);
  connect(signalMapper, SIGNAL(mapped(int)), SLOT(setDragPlane(int)));
  action = subMenu->addAction(tr("X/Y Plane"));
  actionGroup->addAction(action);
  signalMapper->setMapping(action, XY_PLANE);
  action->setShortcut(QKeySequence(Qt::Key_Z));
  action->setCheckable(true);
  connect(action, SIGNAL(triggered()), signalMapper, SLOT(map()));
  action = subMenu->addAction(tr("X/Z Plane"));
  actionGroup->addAction(action);
  signalMapper->setMapping(action, XZ_PLANE);
  action->setShortcut(QKeySequence(Qt::Key_Y));
  action->setCheckable(true);
  connect(action, SIGNAL(triggered()), signalMapper, SLOT(map()));
  action = subMenu->addAction(tr("Y/Z Plane"));
  actionGroup->addAction(action);
  signalMapper->setMapping(action, YZ_PLANE);
  action->setShortcut(QKeySequence(Qt::Key_X));
  action->setCheckable(true);
  connect(action, SIGNAL(triggered()), signalMapper, SLOT(map()));
  qobject_cast<QAction*>(signalMapper->mapping(objectRenderer.getDragPlane()))->setChecked(true);
  subMenu->addSeparator();
  actionGroup = new QActionGroup(subMenu);
  signalMapper = new QSignalMapper(subMenu);
  connect(signalMapper, SIGNAL(mapped(int)), SLOT(setDragMode(int)));
  action = subMenu->addAction(tr("&Keep Dynamics"));
  actionGroup->addAction(action);
  signalMapper->setMapping(action, KEEP_DYNAMICS);
  action->setShortcut(QKeySequence(Qt::Key_8));
  action->setCheckable(true);
  connect(action, SIGNAL(triggered()), signalMapper, SLOT(map()));
  action = subMenu->addAction(tr("&Reset Dynamics"));
  actionGroup->addAction(action);
  signalMapper->setMapping(action, RESET_DYNAMICS);
  action->setShortcut(QKeySequence(Qt::Key_9));
  action->setCheckable(true);
  connect(action, SIGNAL(triggered()), signalMapper, SLOT(map()));
  action = subMenu->addAction(tr("&Apply Dynamics"));
  actionGroup->addAction(action);
  signalMapper->setMapping(action, APPLY_DYNAMICS);
  action->setShortcut(QKeySequence(Qt::Key_0));
  action->setCheckable(true);
  connect(action, SIGNAL(triggered()), signalMapper, SLOT(map()));
  qobject_cast<QAction*>(signalMapper->mapping(objectRenderer.getDragMode()))->setChecked(true);

  menu->addSeparator();

  subMenu = menu->addMenu(tr("&Camera"));
  action = subMenu->menuAction();
  action->setIcon(QIcon(":/icons/camera.png"));
  action->setStatusTip(tr("Select different camera modes for displaying the scene"));
  actionGroup = new QActionGroup(subMenu);
  signalMapper = new QSignalMapper(subMenu);
  connect(signalMapper, SIGNAL(mapped(int)), SLOT(setCameraMode(int)));
  action = subMenu->addAction(tr("&Target Mode"));
  action->setCheckable(true);
  actionGroup->addAction(action);
  signalMapper->setMapping(action, VisualizationParameterSet::TARGETCAM);
  connect(action, SIGNAL(triggered()), signalMapper, SLOT(map()));
  action = subMenu->addAction(tr("&Free Mode"));
  action->setCheckable(true);
  actionGroup->addAction(action);
  signalMapper->setMapping(action, VisualizationParameterSet::FREECAM);
  connect(action, SIGNAL(triggered()), signalMapper, SLOT(map()));
  action = subMenu->addAction(tr("&Presentation Mode"));
  action->setCheckable(true);
  actionGroup->addAction(action);
  signalMapper->setMapping(action, VisualizationParameterSet::PRESENTATION);
  connect(action, SIGNAL(triggered()), signalMapper, SLOT(map()));
  qobject_cast<QAction*>(signalMapper->mapping(objectRenderer.getCameraMode()))->setChecked(true);
  subMenu->addSeparator();
  action = subMenu->addAction(tr("&Reset"));
  action->setShortcut(QKeySequence(Qt::Key_R));
  connect(action, SIGNAL(triggered()), this, SLOT(resetCamera()));
  action = subMenu->addAction(tr("&Toggle"));
  action->setShortcut(QKeySequence(Qt::Key_T));
  connect(action, SIGNAL(triggered()), this, SLOT(toggleCameraMode()));
  action = subMenu->addAction(tr("&Fit"));
  action->setShortcut(QKeySequence(Qt::Key_F));
  connect(action, SIGNAL(triggered()), this, SLOT(fitCamera()));
  subMenu->addSeparator();
  action = subMenu->addAction(tr("&Snap To Root"));
  action->setCheckable(true);
  action->setChecked(objectRenderer.hasSnapToRoot());
//.........这里部分代码省略.........
开发者ID:alon,项目名称:bhuman2009fork,代码行数:101,代码来源:ObjectWidget.cpp

示例6: initActions

/** Initializes the action objects of the GUI */
void BibleTime::initActions() {
    m_actionCollection = new BtActionCollection(this);
    insertKeyboardActions(m_actionCollection);

    // Create the window to signal mapper and connect it up:
    m_windowMapper = new QSignalMapper(this);
    BT_CONNECT(m_windowMapper, SIGNAL(mapped(QWidget *)),
               this,           SLOT(slotSetActiveSubWindow(QWidget *)));

    // File menu actions:
    m_openWorkAction = new BtOpenWorkAction("GUI/mainWindow/openWorkAction/grouping", this);
    BT_CONNECT(m_openWorkAction, SIGNAL(triggered(CSwordModuleInfo *)),
               this, SLOT(createReadDisplayWindow(CSwordModuleInfo *)));

    m_quitAction = &m_actionCollection->action("quit");
    m_quitAction->setMenuRole(QAction::QuitRole);
    BT_CONNECT(m_quitAction, SIGNAL(triggered()),
               this,         SLOT(quit()));


    // View menu actions:
    m_windowFullscreenAction = &m_actionCollection->action("toggleFullscreen");
    m_windowFullscreenAction->setCheckable(true);
    BT_CONNECT(m_windowFullscreenAction, SIGNAL(triggered()),
               this,                     SLOT(toggleFullscreen()));

    // Special case these actions, overwrite those already in collection
    m_showBookshelfAction = m_bookshelfDock->toggleViewAction();
    m_showBookshelfAction->setIcon(CResMgr::mainMenu::view::showBookshelf::icon());
    m_showBookshelfAction->setToolTip(tr("Toggle visibility of the bookshelf window"));
    m_actionCollection->removeAction("showBookshelf");
    m_actionCollection->addAction("showBookshelf", m_showBookshelfAction);
    m_showBookmarksAction = m_bookmarksDock->toggleViewAction();
    m_showBookmarksAction->setIcon(CResMgr::mainMenu::view::showBookmarks::icon());
    m_showBookmarksAction->setToolTip(tr("Toggle visibility of the bookmarks window"));
    m_actionCollection->removeAction("showBookmarks");
    m_actionCollection->addAction("showBookmarks", m_showBookmarksAction);
    m_showMagAction = m_magDock->toggleViewAction();
    m_showMagAction->setIcon(CResMgr::mainMenu::view::showMag::icon());
    m_showMagAction->setToolTip(tr("Toggle visibility of the mag window"));
    m_actionCollection->removeAction("showMag");
    m_actionCollection->addAction("showMag", m_showMagAction);

    m_showTextAreaHeadersAction =
            &m_actionCollection->action("showParallelTextHeaders");
    m_showTextAreaHeadersAction->setCheckable(true);
    m_showTextAreaHeadersAction->setChecked(btConfig().sessionValue<bool>("GUI/showTextWindowHeaders", true));
    BT_CONNECT(m_showTextAreaHeadersAction, SIGNAL(toggled(bool)),
               this,                        SLOT(slotToggleTextWindowHeader()));

    m_showMainWindowToolbarAction = &m_actionCollection->action("showToolbar");
    m_showMainWindowToolbarAction->setCheckable(true);
    m_showMainWindowToolbarAction->setChecked(btConfig().sessionValue<bool>("GUI/showMainToolbar", true));
    BT_CONNECT(m_showMainWindowToolbarAction, SIGNAL(triggered()),
               this, SLOT(slotToggleMainToolbar()));

    m_showTextWindowNavigationAction =
            &m_actionCollection->action("showNavigation");
    m_showTextWindowNavigationAction->setCheckable(true);
    m_showTextWindowNavigationAction->setChecked(btConfig().sessionValue<bool>("GUI/showTextWindowNavigator", true));
    BT_CONNECT(m_showTextWindowNavigationAction, SIGNAL(toggled(bool)),
               this, SLOT(slotToggleNavigatorToolbar()));

    m_showTextWindowModuleChooserAction =
            &m_actionCollection->action("showWorks");
    m_showTextWindowModuleChooserAction->setCheckable(true);
    m_showTextWindowModuleChooserAction->setChecked(btConfig().sessionValue<bool>("GUI/showTextWindowModuleSelectorButtons", true));
    BT_CONNECT(m_showTextWindowModuleChooserAction, SIGNAL(toggled(bool)),
               this, SLOT(slotToggleWorksToolbar()));

    m_showTextWindowToolButtonsAction =
            &m_actionCollection->action("showTools");
    m_showTextWindowToolButtonsAction->setCheckable(true);
    m_showTextWindowToolButtonsAction->setChecked(btConfig().sessionValue<bool>("GUI/showTextWindowToolButtons", true));
    BT_CONNECT(m_showTextWindowToolButtonsAction, SIGNAL(toggled(bool)),
               this, SLOT(slotToggleToolsToolbar()));

    m_showFormatToolbarAction = &m_actionCollection->action("showFormat");
    m_showFormatToolbarAction->setCheckable(true);
    m_showFormatToolbarAction->setChecked(btConfig().sessionValue<bool>("GUI/showFormatToolbarButtons", true));
    BT_CONNECT(m_showFormatToolbarAction, SIGNAL(toggled(bool)),
               this,                      SLOT(slotToggleFormatToolbar()));

    m_toolbarsInEachWindow =
            &m_actionCollection->action("showToolbarsInTextWindows");
    m_toolbarsInEachWindow->setCheckable(true);
    m_toolbarsInEachWindow->setChecked(btConfig().sessionValue<bool>("GUI/showToolbarsInEachWindow", true));
    BT_CONNECT(m_toolbarsInEachWindow, SIGNAL(toggled(bool)),
               this,                   SLOT(slotToggleToolBarsInEachWindow()));

    // Search menu actions:
    m_searchOpenWorksAction = &m_actionCollection->action("searchOpenWorks");
    BT_CONNECT(m_searchOpenWorksAction, SIGNAL(triggered()),
               this,                    SLOT(slotSearchModules()));

    m_searchStandardBibleAction = &m_actionCollection->action("searchStdBible");
    BT_CONNECT(m_searchStandardBibleAction, SIGNAL(triggered()),
               this,                        SLOT(slotSearchDefaultBible()));

//.........这里部分代码省略.........
开发者ID:greg-hellings,项目名称:bibletime,代码行数:101,代码来源:bibletime_init.cpp

示例7: setupToolBar

////////////////////////////////////////////////////////////////////////////////
/// CChanceTreeView::setupToolBar
///
/// @description  This function initializes the toolbar that is used for the
///               tree view.
/// @pre          None
/// @post         The tree view toolbar is initialized.
///
/// @limitations  None
///
////////////////////////////////////////////////////////////////////////////////
void CChanceTreeView::setupToolBar()
{
    QAction *tempAction;
    QLabel *tempLabel;
    QToolButton *tempButton;
    // Create toolbar.
    m_toolBar = new QToolBar( "Puzzle View", this );
    
    tempAction = m_toolBar->addAction( QIcon(":/toggleminmaxheuristics.png"),
                                       "Toggle min/max heuristic values" );
    tempAction->setCheckable( true );
    tempAction->setChecked( true );
    connect( tempAction, SIGNAL(toggled(bool)), m_graphView,
             SLOT(toggleMinMaxHeuristics(bool)) );
    
    tempAction = m_toolBar->addAction( QIcon(":/togglechanceheuristics.png"),
                                       "Toggle chance heuristic values" );
    tempAction->setCheckable( true );
    tempAction->setChecked( true );
    connect( tempAction, SIGNAL(toggled(bool)), m_graphView,
             SLOT(toggleChanceHeuristics(bool)) );

    // "Reorient View" button
    tempAction = m_toolBar->addAction( QIcon(":/orient.png"), "Reorient view" );
    connect( tempAction, SIGNAL(activated()), this, SLOT(switchOrientation()) );

    // "Show Graph" toggle button
    tempAction = m_toolBar->addAction( QIcon(":/graph.png"), "Show Graph" );
    tempAction->setCheckable( true );
    tempAction->setChecked( true );
    connect( tempAction, SIGNAL(toggled(bool)), m_graphView,
             SLOT(setShown(bool)) );

    // "Show Trace" toggle button
    tempAction = m_toolBar->addAction(QIcon(":/trace.png"), "Show Trace" );
    tempAction->setCheckable( true );
    tempAction->setChecked( true );
    connect( tempAction, SIGNAL(toggled(bool)), m_traceView,
             SLOT(setShown(bool)) );

    m_toolBar->addSeparator();

    // "Quick Edit Mode" toggle button
    m_quickEditAction = m_toolBar->addAction(QIcon(":/quickedit.png"),
                                      "Toggle Quick Edit Mode" );
    m_quickEditAction->setCheckable( true );
    m_quickEditAction->setChecked( false );
    connect( m_quickEditAction, SIGNAL(toggled(bool)), m_graphView,
             SLOT(setQuickEdit(bool)) );

    // "Generate Tree" button
    tempAction = m_toolBar->addAction(QIcon(":/graph.png"), "Generate Tree" );
    connect( tempAction, SIGNAL(activated()), m_graphView, SLOT(generateTree()) );

    // "Auto Name" button
    tempAction = m_toolBar->addAction(QIcon(":/autoname.png"), "Auto Name" );
    connect( tempAction, SIGNAL(activated()), m_graphView, SLOT(autoName()) );

    // "Auto Number" button
    tempAction = m_toolBar->addAction(QIcon(":/autonumber.png"), "Auto Number" );
    connect( tempAction, SIGNAL(activated()), m_graphView, SLOT(autoNumber()) );

    // "Auto Layout" button
    tempAction = m_toolBar->addAction(QIcon(":/autolayout.png"), "Auto Layout");
    connect( tempAction, SIGNAL(activated()), m_graphView, SLOT(autoLayout()) );

    m_toolBar->addSeparator();
    

    
    m_toolBar->addSeparator();

    // "AI Config Menu" button
    m_toolBar->addWidget(m_traceView->getAIConfigButton());

    // AI Label
    tempLabel = m_traceView->getAILabel();
    m_toolBar->addWidget( tempLabel );

    // Depth spinbox
    tempLabel = new QLabel( m_toolBar );
    tempLabel->setTextFormat(Qt::AutoText);
    tempLabel->setText( "  Depth" );
    m_toolBar->addWidget( tempLabel );
    m_toolBar->addWidget( m_traceView->getDepthSelector() );

    // QS Depth spinbox
    tempLabel = new QLabel( m_toolBar );
    tempLabel->setText( "  QS Depth" );
//.........这里部分代码省略.........
开发者ID:raymyers,项目名称:gnat,代码行数:101,代码来源:CChanceTreeView.cpp

示例8: QWidget

Reviews::Reviews( QWidget * parent, Okular::Document * document )
    : QWidget( parent ), m_document( document )
{
    // create widgets and layout them vertically
    QVBoxLayout * vLayout = new QVBoxLayout( this );
    vLayout->setMargin( 0 );
    vLayout->setSpacing( 6 );

    m_view = new TreeView( m_document, this );
    m_view->setAlternatingRowColors( true );
    m_view->setSelectionMode( QAbstractItemView::ExtendedSelection );
    m_view->header()->hide();

    QToolBar *toolBar = new QToolBar( this );
    toolBar->setObjectName( QLatin1String( "reviewOptsBar" ) );
    QSizePolicy sp = toolBar->sizePolicy();
    sp.setVerticalPolicy( QSizePolicy::Minimum );
    toolBar->setSizePolicy( sp );

    m_model = new AnnotationModel( m_document, m_view );

    m_filterProxy = new PageFilterProxyModel( m_view );
    m_groupProxy = new PageGroupProxyModel( m_view );
    m_authorProxy  = new AuthorGroupProxyModel( m_view );

    m_filterProxy->setSourceModel( m_model );
    m_groupProxy->setSourceModel( m_filterProxy );
    m_authorProxy->setSourceModel( m_groupProxy );


    m_view->setModel( m_authorProxy );

    m_searchLine = new KTreeViewSearchLine( this, m_view );
    m_searchLine->setCaseSensitivity( Okular::Settings::self()->reviewsSearchCaseSensitive() ? Qt::CaseSensitive : Qt::CaseInsensitive );
    m_searchLine->setRegularExpression( Okular::Settings::self()->reviewsSearchRegularExpression() );
    connect( m_searchLine, SIGNAL(searchOptionsChanged()), this, SLOT(saveSearchOptions()) );
    vLayout->addWidget( m_searchLine );
    vLayout->addWidget( m_view );
    vLayout->addWidget( toolBar );

    toolBar->setIconSize( QSize( 16, 16 ) );
    toolBar->setMovable( false );
    // - add Page button
    QAction * groupByPageAction = toolBar->addAction( KIcon( "text-x-generic" ), i18n( "Group by Page Hello World!" ) );
    groupByPageAction->setCheckable( true );
    connect( groupByPageAction, SIGNAL(toggled(bool)), this, SLOT(slotPageEnabled(bool)) );
    groupByPageAction->setChecked( Okular::Settings::groupByPage() );
    // - add Author button
    QAction * groupByAuthorAction = toolBar->addAction( KIcon( "user-identity" ), i18n( "Group by Author Hello World!" ) );
    groupByAuthorAction->setCheckable( true );
    connect( groupByAuthorAction, SIGNAL(toggled(bool)), this, SLOT(slotAuthorEnabled(bool)) );
    groupByAuthorAction->setChecked( Okular::Settings::groupByAuthor() );

    // - add separator
    toolBar->addSeparator();
    // - add Current Page Only button
    QAction * curPageOnlyAction = toolBar->addAction( KIcon( "arrow-down" ), i18n( "Show reviews for current page only" ) );
    curPageOnlyAction->setCheckable( true );
    connect( curPageOnlyAction, SIGNAL(toggled(bool)), this, SLOT(slotCurrentPageOnly(bool)) );
    curPageOnlyAction->setChecked( Okular::Settings::currentPageOnly() );

    connect( m_view, SIGNAL(activated(QModelIndex)),
             this, SLOT(activated(QModelIndex)) );

    m_view->setContextMenuPolicy( Qt::CustomContextMenu );
    connect( m_view, SIGNAL(customContextMenuRequested(QPoint)),
             this, SLOT(contextMenuRequested(QPoint)) );

}
开发者ID:peeter-t2,项目名称:Scribble,代码行数:69,代码来源:side_reviews.cpp

示例9: iconSize

GeometryWidget::GeometryWidget(EffectMetaInfo *info, int clipPos, bool showRotation, bool useOffset, QWidget* parent):
    QWidget(parent),
    m_monitor(info->monitor),
    m_timePos(new TimecodeDisplay(info->monitor->timecode())),
    m_clipPos(clipPos),
    m_inPoint(0),
    m_outPoint(1),
    m_previous(NULL),
    m_geometry(NULL),
    m_frameSize(info->frameSize),
    m_fixedGeom(false),
    m_singleKeyframe(false),
    m_useOffset(useOffset)
{
    m_ui.setupUi(this);
    setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Maximum);
    connect(m_monitor, &Monitor::effectChanged, this, &GeometryWidget::slotUpdateGeometryRect);
    connect(m_monitor, &Monitor::effectPointsChanged, this, &GeometryWidget::slotUpdateCenters, Qt::UniqueConnection);
    /*
        Setup of timeline and keyframe controls
    */

    ((QGridLayout *)(m_ui.widgetTimeWrapper->layout()))->addWidget(m_timePos, 1, 5);

    QVBoxLayout *layout = new QVBoxLayout(m_ui.frameTimeline);
    m_timeline = new KeyframeHelper(m_ui.frameTimeline);
    layout->addWidget(m_timeline);
    layout->setContentsMargins(0, 0, 0, 0);

    int size = style()->pixelMetric(QStyle::PM_SmallIconSize);
    QSize iconSize(size, size);

    m_ui.buttonPrevious->setIcon(KoIconUtils::themedIcon(QStringLiteral("media-skip-backward")));
    m_ui.buttonPrevious->setToolTip(i18n("Go to previous keyframe"));
    m_ui.buttonPrevious->setIconSize(iconSize);
    m_ui.buttonNext->setIcon(KoIconUtils::themedIcon(QStringLiteral("media-skip-forward")));
    m_ui.buttonNext->setToolTip(i18n("Go to next keyframe"));
    m_ui.buttonNext->setIconSize(iconSize);
    m_ui.buttonAddDelete->setIcon(KoIconUtils::themedIcon(QStringLiteral("list-add")));
    m_ui.buttonAddDelete->setToolTip(i18n("Add keyframe"));
    m_ui.buttonAddDelete->setIconSize(iconSize);

    connect(m_timeline, SIGNAL(requestSeek(int)), this, SLOT(slotRequestSeek(int)));
    connect(m_timeline, SIGNAL(keyframeMoved(int)),   this, SLOT(slotKeyframeMoved(int)));
    connect(m_timeline, SIGNAL(addKeyframe(int)),     this, SLOT(slotAddKeyframe(int)));
    connect(m_timeline, SIGNAL(removeKeyframe(int)),  this, SLOT(slotDeleteKeyframe(int)));
    connect(m_timePos, SIGNAL(timeCodeEditingFinished()), this, SLOT(slotPositionChanged()));
    connect(m_ui.buttonPrevious,  SIGNAL(clicked()), this, SLOT(slotPreviousKeyframe()));
    connect(m_ui.buttonNext,      SIGNAL(clicked()), this, SLOT(slotNextKeyframe()));
    connect(m_ui.buttonAddDelete, SIGNAL(clicked()), this, SLOT(slotAddDeleteKeyframe()));

    m_spinX = new DragValue(i18nc("x axis position", "X"), 0, 0, -99000, 99000, -1, QString(), false, this);
    m_ui.horizontalLayout->addWidget(m_spinX, 0, 0);

    m_spinY = new DragValue(i18nc("y axis position", "Y"), 0, 0, -99000, 99000, -1, QString(), false, this);
    m_ui.horizontalLayout->addWidget(m_spinY, 0, 1);

    m_spinWidth = new DragValue(i18nc("Frame width", "W"), m_monitor->render->frameRenderWidth(), 0, 1, 99000, -1, QString(), false, this);
    m_ui.horizontalLayout->addWidget(m_spinWidth, 0, 2);

    m_spinHeight = new DragValue(i18nc("Frame height", "H"), m_monitor->render->renderHeight(), 0, 1, 99000, -1, QString(), false, this);
    m_ui.horizontalLayout->addWidget(m_spinHeight, 0, 3);

    m_ui.horizontalLayout->setColumnStretch(4, 10);

    QMenu *menu = new QMenu(this);
    QAction *originalSize = new QAction(KoIconUtils::themedIcon(QStringLiteral("zoom-original")), i18n("Adjust to original size"), this);
    connect(originalSize, SIGNAL(triggered()), this, SLOT(slotAdjustToSource()));
    QAction *adjustSize = new QAction(KoIconUtils::themedIcon(QStringLiteral("zoom-fit-best")), i18n("Adjust and center in frame"), this);
    connect(adjustSize, SIGNAL(triggered()), this, SLOT(slotAdjustToFrameSize()));
    QAction *fitToWidth = new QAction(KoIconUtils::themedIcon(QStringLiteral("zoom-fit-width")), i18n("Fit to width"), this);
    connect(fitToWidth, SIGNAL(triggered()), this, SLOT(slotFitToWidth()));
    QAction *fitToHeight = new QAction(KoIconUtils::themedIcon(QStringLiteral("zoom-fit-height")), i18n("Fit to height"), this);
    connect(fitToHeight, SIGNAL(triggered()), this, SLOT(slotFitToHeight()));

    QAction *importKeyframes = new QAction(i18n("Import keyframes from clip"), this);
    connect(importKeyframes, SIGNAL(triggered()), this, SIGNAL(importClipKeyframes()));
    menu->addAction(importKeyframes);
    QAction *resetKeyframes = new QAction(i18n("Reset all keyframes"), this);
    connect(resetKeyframes, SIGNAL(triggered()), this, SLOT(slotResetKeyframes()));
    menu->addAction(resetKeyframes);

    QAction *resetNextKeyframes = new QAction(i18n("Reset keyframes after cursor"), this);
    connect(resetNextKeyframes, SIGNAL(triggered()), this, SLOT(slotResetNextKeyframes()));
    menu->addAction(resetNextKeyframes);
    QAction *resetPreviousKeyframes = new QAction(i18n("Reset keyframes before cursor"), this);
    connect(resetPreviousKeyframes, SIGNAL(triggered()), this, SLOT(slotResetPreviousKeyframes()));
    menu->addAction(resetPreviousKeyframes);
    menu->addSeparator();

    QAction *syncTimeline = new QAction(KoIconUtils::themedIcon(QStringLiteral("edit-link")), i18n("Synchronize with timeline cursor"), this);
    syncTimeline->setCheckable(true);
    syncTimeline->setChecked(KdenliveSettings::transitionfollowcursor());
    connect(syncTimeline, SIGNAL(toggled(bool)), this, SLOT(slotSetSynchronize(bool)));
    menu->addAction(syncTimeline);

    QAction *alignleft = new QAction(KoIconUtils::themedIcon(QStringLiteral("kdenlive-align-left")), i18n("Align left"), this);
    connect(alignleft, SIGNAL(triggered()), this, SLOT(slotMoveLeft()));
    QAction *alignhcenter = new QAction(KoIconUtils::themedIcon(QStringLiteral("kdenlive-align-hor")), i18n("Center horizontally"), this);
    connect(alignhcenter, SIGNAL(triggered()), this, SLOT(slotCenterH()));
//.........这里部分代码省略.........
开发者ID:alstef,项目名称:kdenlive,代码行数:101,代码来源:geometrywidget.cpp

示例10: tableContextMenu

void PlotDataFitFunctionWidget::tableContextMenu(const QPoint& pos) {

    PlotDataFitFunction* plotDataFitFunction = dynamic_cast<PlotDataFitFunction*>(processor_);
    const std::vector<Property*> properties = plotDataFitFunction->getProperties();
    std::vector<bool> boolValues;
    for (size_t i = 0; i < properties.size(); ++i) {
        if (dynamic_cast<BoolProperty*>(properties[i])) {
            boolValues.push_back(static_cast<BoolProperty*>(properties[i])->get());
        }
    }
    QModelIndex index = table_->indexAt(pos);
    contextMenuTable_->clear();
    fittingFunctionMenu_->clear();
    multiRegessionMenu_->clear();
    splineFunctionMenu_->clear();
    PlotData* data = const_cast<PlotData*>(plotDataFitFunction->getPlotData());
    QAction* newAct;
    QList<QVariant>* qlist = new QList<QVariant>();
    std::stringstream s;

    bool numberColumn = (data->getColumnType(index.column()) == PlotBase::NUMBER);

    plot_t minX = 1;
    //plot_t maxX = 1;
    plot_t minY = 1;
    plot_t maxY = 1;
    if (numberColumn) {
        AggregationFunctionMin* aggmin = new AggregationFunctionMin();
        AggregationFunctionMax* aggmax = new AggregationFunctionMax();
        minY = data->aggregate(index.column(),aggmin);
        maxY = data->aggregate(index.column(),aggmax);
        minX = data->aggregate(0,aggmin);
        //maxX = data->aggregate(0,aggmax);
        delete aggmin;
        delete aggmax;
    }

    s.str("");
    s.clear();
    s << "Ignore False Values";
    newAct = new QAction(QString::fromStdString(s.str()),this);
    newAct->setCheckable(true);
    newAct->setChecked(boolValues[0]);
    contextMenuTable_->addAction(newAct);
    QObject::connect(newAct,SIGNAL(triggered()),this,SLOT(ignoreFalseValues()));
    qlist->clear();

    s.str("");
    s.clear();
    s << "Linear Regression";
    newAct = new QAction(QString::fromStdString(s.str()),this);
    qlist->push_back(FunctionLibrary::LINEAR);
    qlist->push_back(index.column());
    newAct->setData(QVariant(*qlist));
    fittingFunctionMenu_->addAction(newAct);
    QObject::connect(newAct,SIGNAL(triggered()),this,SLOT(addFunction()));
    qlist->clear();

    s.str("");
    s.clear();
    s << "Square Regression";
    newAct = new QAction(QString::fromStdString(s.str()),this);
    qlist->push_back(FunctionLibrary::SQUARE);
    qlist->push_back(index.column());
    newAct->setData(QVariant(*qlist));
    fittingFunctionMenu_->addAction(newAct);
    QObject::connect(newAct,SIGNAL(triggered()),this,SLOT(addFunction()));
    qlist->clear();

    s.str("");
    s.clear();
    s << "Cubic Regression";
    newAct = new QAction(QString::fromStdString(s.str()),this);
    qlist->push_back(FunctionLibrary::CUBIC);
    qlist->push_back(index.column());
    newAct->setData(QVariant(*qlist));
    fittingFunctionMenu_->addAction(newAct);
    QObject::connect(newAct,SIGNAL(triggered()),this,SLOT(addFunction()));
    qlist->clear();

    for (int i = 4; i < 11; ++i) {
        s.str("");
        s.clear();
        s << i << "-Dimension Regression";
        newAct = new QAction(QString::fromStdString(s.str()),this);
        qlist->push_back(FunctionLibrary::POLYNOMIAL);
        qlist->push_back(index.column());
        qlist->push_back(i);
        newAct->setData(QVariant(*qlist));
        multiRegessionMenu_->addAction(newAct);
        QObject::connect(newAct,SIGNAL(triggered()),this,SLOT(addFunction()));
        qlist->clear();
    }

    fittingFunctionMenu_->addMenu(multiRegessionMenu_);

    s.str("");
    s.clear();
    s << "Constant-Spline Regression";
    newAct = new QAction(QString::fromStdString(s.str()),this);
//.........这里部分代码省略.........
开发者ID:molsimmsu,项目名称:3mview,代码行数:101,代码来源:plotdatafitfunctionwidget.cpp

示例11: QFrame

MemoryWindow::MemoryWindow(running_machine* machine, QWidget* parent) :
	WindowQt(machine, NULL)
{
	setWindowTitle("Debug: Memory View");

	if (parent != NULL)
	{
		QPoint parentPos = parent->pos();
		setGeometry(parentPos.x()+100, parentPos.y()+100, 800, 400);
	}

	//
	// The main frame and its input and log widgets
	//
	QFrame* mainWindowFrame = new QFrame(this);

	// The top frame & groupbox that contains the input widgets
	QFrame* topSubFrame = new QFrame(mainWindowFrame);

	// The input edit
	m_inputEdit = new QLineEdit(topSubFrame);
	connect(m_inputEdit, SIGNAL(returnPressed()), this, SLOT(expressionSubmitted()));

	// The memory space combo box
	m_memoryComboBox = new QComboBox(topSubFrame);
	m_memoryComboBox->setObjectName("memoryregion");
	m_memoryComboBox->setMinimumWidth(300);
	connect(m_memoryComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(memoryRegionChanged(int)));

	// The main memory window
	m_memTable = new DebuggerMemView(DVT_MEMORY, m_machine, this);

	// Layout
	QHBoxLayout* subLayout = new QHBoxLayout(topSubFrame);
	subLayout->addWidget(m_inputEdit);
	subLayout->addWidget(m_memoryComboBox);
	subLayout->setSpacing(3);
	subLayout->setContentsMargins(2,2,2,2);

	QVBoxLayout* vLayout = new QVBoxLayout(mainWindowFrame);
	vLayout->setSpacing(3);
	vLayout->setContentsMargins(2,2,2,2);
	vLayout->addWidget(topSubFrame);
	vLayout->addWidget(m_memTable);

	setCentralWidget(mainWindowFrame);

	//
	// Menu bars
	//
	// Create a byte-chunk group
	QActionGroup* chunkGroup = new QActionGroup(this);
	chunkGroup->setObjectName("chunkgroup");
	QAction* chunkActOne  = new QAction("1-byte chunks", this);
	chunkActOne->setObjectName("chunkActOne");
	QAction* chunkActTwo  = new QAction("2-byte chunks", this);
	chunkActTwo->setObjectName("chunkActTwo");
	QAction* chunkActFour = new QAction("4-byte chunks", this);
	chunkActFour->setObjectName("chunkActFour");
	chunkActOne->setCheckable(true);
	chunkActTwo->setCheckable(true);
	chunkActFour->setCheckable(true);
	chunkActOne->setActionGroup(chunkGroup);
	chunkActTwo->setActionGroup(chunkGroup);
	chunkActFour->setActionGroup(chunkGroup);
	chunkActOne->setShortcut(QKeySequence("Ctrl+1"));
	chunkActTwo->setShortcut(QKeySequence("Ctrl+2"));
	chunkActFour->setShortcut(QKeySequence("Ctrl+4"));
	chunkActOne->setChecked(true);
	connect(chunkGroup, SIGNAL(triggered(QAction*)), this, SLOT(chunkChanged(QAction*)));

	// Create a address display group
	QActionGroup* addressGroup = new QActionGroup(this);
	addressGroup->setObjectName("addressgroup");
	QAction* addressActLogical = new QAction("Logical Addresses", this);
	QAction* addressActPhysical = new QAction("Physical Addresses", this);
	addressActLogical->setCheckable(true);
	addressActPhysical->setCheckable(true);
	addressActLogical->setActionGroup(addressGroup);
	addressActPhysical->setActionGroup(addressGroup);
	addressActLogical->setShortcut(QKeySequence("Ctrl+G"));
	addressActPhysical->setShortcut(QKeySequence("Ctrl+Y"));
	addressActLogical->setChecked(true);
	connect(addressGroup, SIGNAL(triggered(QAction*)), this, SLOT(addressChanged(QAction*)));

	// Create a reverse view radio
	QAction* reverseAct = new QAction("Reverse View", this);
	reverseAct->setObjectName("reverse");
	reverseAct->setCheckable(true);
	reverseAct->setShortcut(QKeySequence("Ctrl+R"));
	connect(reverseAct, SIGNAL(toggled(bool)), this, SLOT(reverseChanged(bool)));

	// Create increase and decrease bytes-per-line actions
	QAction* increaseBplAct = new QAction("Increase Bytes Per Line", this);
	QAction* decreaseBplAct = new QAction("Decrease Bytes Per Line", this);
	increaseBplAct->setShortcut(QKeySequence("Ctrl+P"));
	decreaseBplAct->setShortcut(QKeySequence("Ctrl+O"));
	connect(increaseBplAct, SIGNAL(triggered(bool)), this, SLOT(increaseBytesPerLine(bool)));
	connect(decreaseBplAct, SIGNAL(triggered(bool)), this, SLOT(decreaseBytesPerLine(bool)));

//.........这里部分代码省略.........
开发者ID:mikiemike1,项目名称:mame,代码行数:101,代码来源:debugqtmemorywindow.c

示例12: SIGNAL

HaveClip::HaveClip(QObject *parent) :
	QObject(parent)
{
	Settings *s = Settings::create(this);

	connect(s, SIGNAL(firstStart()), this, SLOT(onFirstStart()));

	s->init();

	manager = new ClipboardManager(this);

	connect(manager->history(), SIGNAL(historyChanged()), this, SLOT(updateHistory()));
	connect(manager->connectionManager(), SIGNAL(untrustedCertificateError(Node,QList<QSslError>)), this, SLOT(determineCertificateTrust(Node,QList<QSslError>)));
	connect(manager->connectionManager(), SIGNAL(sslFatalError(QList<QSslError>)), this, SLOT(sslFatalError(QList<QSslError>)));
	connect(manager->connectionManager(), SIGNAL(verificationRequested(Node)), this, SLOT(verificationRequest(Node)));

	historySignalMapper = new QSignalMapper(this);

	connect(historySignalMapper, SIGNAL(mapped(QObject*)), this, SLOT(historyActionClicked(QObject*)));

	// Tray
#ifdef Q_OS_MAC
	trayIcon = new QSystemTrayIcon(QIcon(":/gfx/HaveClip_mac_tray.png"), this);
#else
	trayIcon = new QSystemTrayIcon(QIcon(":/gfx/HaveClip_256.png"), this);
#endif

	trayIcon->setToolTip(tr("HaveClip"));

#ifndef Q_OS_MAC
	connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayIconActivated(QSystemTrayIcon::ActivationReason)));
#endif

	historyMenu = new QMenu(tr("History"));
	historySeparator = historyMenu->addSeparator();

	menu = new QMenu;

#if defined Q_OS_MAC
	menu->addMenu(historyMenu);
	menu->addSeparator();
#endif

	QAction *a = menu->addAction(tr("&Enable clipboard synchronization"));
	a->setCheckable(true);
	a->setChecked(manager->isSyncEnabled());
	connect(a, SIGNAL(toggled(bool)), this, SLOT(toggleSharedClipboard(bool)));

	clipSndAction = menu->addAction(tr("Enable clipboard se&nding"));
	clipSndAction->setCheckable(true);
	clipSndAction->setChecked(manager->isSendingEnabled());
	clipSndAction->setEnabled(manager->isSyncEnabled());
	connect(clipSndAction, SIGNAL(toggled(bool)), this, SLOT(toggleSend(bool)));

	clipRecvAction = menu->addAction(tr("Enable clipboard &receiving"));
	clipRecvAction->setCheckable(true);
	clipRecvAction->setChecked(manager->isReceivingEnabled());
	clipRecvAction->setEnabled(manager->isSyncEnabled());
	connect(clipRecvAction, SIGNAL(toggled(bool)), this, SLOT(toggleReceive(bool)));

	menu->addSeparator();

	menu->addAction(tr("Synchronize clipboard"), this, SLOT(synchronizeClipboard()));

	menuSeparator = menu->addSeparator();

	menu->addAction(tr("&Settings"), this, SLOT(showSettings()));
	menu->addAction(tr("&About..."), this, SLOT(showAbout()));
	menu->addAction(tr("&Quit"), qApp, SLOT(quit()));

	trayIcon->setContextMenu(menu);
	trayIcon->show();

	qApp->setQuitOnLastWindowClosed(false);
	qApp->setWindowIcon(QIcon(":/gfx/HaveClip_256.png"));

	manager->start();
}
开发者ID:aither64,项目名称:haveclip-desktop,代码行数:78,代码来源:HaveClip.cpp

示例13: setup


//.........这里部分代码省略.........
    currentAction = new QAction(tr("Rename Code File"), this);
    currentAction->setStatusTip(tr("Rename the current program"));
    connect(currentAction, SIGNAL(triggered()), this, SLOT(rename()));
    m_fileMenu->addAction(currentAction);

    currentAction = new QAction(tr("Duplicate tab"), this);
    currentAction->setStatusTip(tr("Copies the current program into a new tab"));
    connect(currentAction, SIGNAL(triggered()), this, SLOT(duplicateTab()));
    m_fileMenu->addAction(currentAction);

    m_fileMenu->addSeparator();

    currentAction = new QAction(tr("Remove tab"), this);
    currentAction->setShortcut(tr("Ctrl+W"));
    currentAction->setStatusTip(tr("Remove the current program from the sketch"));
    connect(currentAction, SIGNAL(triggered()), this, SLOT(closeCurrentTab()));
    m_fileMenu->addAction(currentAction);

    m_fileMenu->addSeparator();

    m_printAction = new QAction(tr("&Print..."), this);
    m_printAction->setShortcut(tr("Ctrl+P"));
    m_printAction->setStatusTip(tr("Print the current program"));
    connect(m_printAction, SIGNAL(triggered()), this, SLOT(print()));
    m_fileMenu->addAction(m_printAction);

    m_fileMenu->addSeparator();

    currentAction = new QAction(tr("&Quit"), this);
    currentAction->setShortcut(tr("Ctrl+Q"));
    currentAction->setStatusTip(tr("Quit the application"));
    currentAction->setMenuRole(QAction::QuitRole);
    connect(currentAction, SIGNAL(triggered()), qApp, SLOT(closeAllWindows2()));
    m_fileMenu->addAction(currentAction);

    m_editMenu = menubar->addMenu(tr("&Edit"));

    m_undoAction = new QAction(tr("Undo"), this);
    m_undoAction->setShortcuts(QKeySequence::Undo);
    m_undoAction->setEnabled(false);
    connect(m_undoAction, SIGNAL(triggered()), this, SLOT(undo()));
    m_editMenu->addAction(m_undoAction);

    m_redoAction = new QAction(tr("Redo"), this);
    m_redoAction->setShortcuts(QKeySequence::Redo);
    m_redoAction->setEnabled(false);
    connect(m_redoAction, SIGNAL(triggered()), this, SLOT(redo()));
    m_editMenu->addAction(m_redoAction);

    m_editMenu->addSeparator();

    m_cutAction = new QAction(tr("&Cut"), this);
    m_cutAction->setShortcut(tr("Ctrl+X"));
    m_cutAction->setStatusTip(tr("Cut selection"));
    m_cutAction->setEnabled(false);
    connect(m_cutAction, SIGNAL(triggered()), this, SLOT(cut()));
    m_editMenu->addAction(m_cutAction);

    m_copyAction = new QAction(tr("&Copy"), this);
    m_copyAction->setShortcut(tr("Ctrl+C"));
    m_copyAction->setStatusTip(tr("Copy selection"));
    m_copyAction->setEnabled(false);
    connect(m_copyAction, SIGNAL(triggered()), this, SLOT(copy()));
    m_editMenu->addAction(m_copyAction);

    currentAction = new QAction(tr("&Paste"), this);
    currentAction->setShortcut(tr("Ctrl+V"));
    currentAction->setStatusTip(tr("Paste clipboard contents"));
    // TODO: Check clipboard status and disable appropriately here
    connect(currentAction, SIGNAL(triggered()), this, SLOT(paste()));
    m_editMenu->addAction(currentAction);

    m_editMenu->addSeparator();

    currentAction = new QAction(tr("&Select All"), this);
    currentAction->setShortcut(tr("Ctrl+A"));
    currentAction->setStatusTip(tr("Select all text"));
    connect(currentAction, SIGNAL(triggered()), this, SLOT(selectAll()));
    m_editMenu->addAction(currentAction);

    m_programMenu = menubar->addMenu(tr("&Code"));

    QMenu *languageMenu = new QMenu(tr("Select language"), this);
    m_programMenu->addMenu(languageMenu);

	QString currentLanguage = settings.value("programwindow/language", "").toString();
	QStringList languages = getAvailableLanguages();
    QActionGroup *languageActionGroup = new QActionGroup(this);
    foreach (QString language, languages) {
        currentAction = new QAction(language, this);
        currentAction->setCheckable(true);
        m_languageActions.insert(language, currentAction);
        languageActionGroup->addAction(currentAction);
        languageMenu->addAction(currentAction);
		if (!currentLanguage.isEmpty()) {
			if (language.compare(currentLanguage) == 0) {
				currentAction->setChecked(true);
			}
		}
    }
开发者ID:bacchante95,项目名称:fritzing,代码行数:101,代码来源:programwindow.cpp

示例14: contextMenu

void ItemDoor::contextMenu(QGraphicsSceneMouseEvent *mouseEvent)
{
    m_scene->m_contextMenuIsOpened = true; //bug protector

    //Remove selection from non-bgo items
    if(!this->isSelected())
    {
        m_scene->clearSelection();
        this->setSelected(true);
    }

    this->setSelected(1);
    QMenu ItemMenu;

    QAction *openLvl = ItemMenu.addAction(tr("Open target level: %1").arg(m_data.lname).replace("&", "&&&"));
    openLvl->setVisible((!m_data.lname.isEmpty()) && (QFile(m_scene->m_data->meta.path + "/" + m_data.lname).exists()));
    openLvl->deleteLater();

    /*************Layers*******************/
    QMenu *LayerName =     ItemMenu.addMenu(tr("Layer: ") + QString("[%1]").arg(m_data.layer).replace("&", "&&&"));
    QAction *setLayer;
    QList<QAction *> layerItems;

    QAction *newLayer =    LayerName->addAction(tr("Add to new layer..."));
    LayerName->addSeparator()->deleteLater();;
    for(LevelLayer &layer : m_scene->m_data->layers)
    {
        //Skip system layers
        if((layer.name == "Destroyed Blocks") || (layer.name == "Spawned NPCs")) continue;

        setLayer = LayerName->addAction(layer.name.replace("&", "&&&") + ((layer.hidden) ? "" + tr("[hidden]") : ""));
        setLayer->setData(layer.name);
        setLayer->setCheckable(true);
        setLayer->setEnabled(true);
        setLayer->setChecked(layer.name == m_data.layer);
        layerItems.push_back(setLayer);
    }
    ItemMenu.addSeparator();
    /*************Layers*end***************/

    QAction *jumpTo = NULL;
    if(this->data(ITEM_TYPE).toString() == "Door_enter")
    {
        jumpTo =                ItemMenu.addAction(tr("Jump to exit"));
        jumpTo->setVisible((m_data.isSetIn) && (m_data.isSetOut));
    }
    else if(this->data(ITEM_TYPE).toString() == "Door_exit")
    {
        jumpTo =                ItemMenu.addAction(tr("Jump to entrance"));
        jumpTo->setVisible((m_data.isSetIn) && (m_data.isSetOut));
    }
    ItemMenu.addSeparator();
    QAction *NoTransport =     ItemMenu.addAction(tr("No Vehicles"));
    NoTransport->setCheckable(true);
    NoTransport->setChecked(m_data.novehicles);

    QAction *AllowNPC =        ItemMenu.addAction(tr("Allow NPC"));
    AllowNPC->setCheckable(true);
    AllowNPC->setChecked(m_data.allownpc);

    QAction *Locked =          ItemMenu.addAction(tr("Locked"));
    Locked->setCheckable(true);
    Locked->setChecked(m_data.locked);
    QAction *BombNeed =        ItemMenu.addAction(tr("Need a bomb"));
    BombNeed->setCheckable(true);
    BombNeed->setChecked(m_data.need_a_bomb);
    QAction *SpecialStReq =    ItemMenu.addAction(tr("Required special state"));
    SpecialStReq->setCheckable(true);
    SpecialStReq->setChecked(m_data.special_state_required);

    /*************Copy Preferences*******************/
    ItemMenu.addSeparator();
    QMenu *copyPreferences =   ItemMenu.addMenu(tr("Copy preferences"));
    QAction *copyPosXY =        copyPreferences->addAction(tr("Position: X, Y"));
    QAction *copyPosXYWH =      copyPreferences->addAction(tr("Position: X, Y, Width, Height"));
    QAction *copyPosLTRB =      copyPreferences->addAction(tr("Position: Left, Top, Right, Bottom"));
    /*************Copy Preferences*end***************/

    ItemMenu.addSeparator();
    QAction *remove =           ItemMenu.addAction(tr("Remove"));

    ItemMenu.addSeparator();
    QAction *props =            ItemMenu.addAction(tr("Properties..."));

    /*****************Waiting for answer************************/
    QAction *selected = ItemMenu.exec(mouseEvent->screenPos());
    /***********************************************************/

    if(!selected)
        return;

    if(selected == openLvl)
        m_scene->m_mw->OpenFile(m_scene->m_data->meta.path + "/" + m_data.lname);
    else if(selected == jumpTo)
    {
        //scene->doCopy = true ;
        if(this->data(ITEM_TYPE).toString() == "Door_enter")
        {
            if(m_data.isSetOut)
                m_scene->m_mw->activeLvlEditWin()->goTo(m_data.ox, m_data.oy, true, QPoint(0, 0), true);
//.........这里部分代码省略.........
开发者ID:jpmac26,项目名称:PGE-Project,代码行数:101,代码来源:item_door.cpp

示例15: optionChanged

void SidebarWidget::optionChanged(const QString &option, const QVariant &value)
{
	if (option == QLatin1String("Sidebar/CurrentPanel"))
	{
		selectPanel(value.toString());
	}
	else if (option == QLatin1String("Sidebar/Panels"))
	{
		qDeleteAll(m_buttons.begin(), m_buttons.end());

		m_buttons.clear();

		QMenu *menu = new QMenu(m_ui->panelsButton);
		const QStringList chosenPanels = value.toStringList();
		QStringList allPanels;
		allPanels << QLatin1String("bookmarks") << QLatin1String("cache") << QLatin1String("cookies") << QLatin1String("config") << QLatin1String("history") << QLatin1String("notes") << QLatin1String("transfers");

		for (int i = 0; i < allPanels.count(); ++i)
		{
			QAction *action = new QAction(menu);
			action->setCheckable(true);
			action->setChecked(chosenPanels.contains(allPanels[i]));
			action->setData(allPanels[i]);
			action->setText(getPanelTitle(allPanels[i]));

			connect(action, SIGNAL(toggled(bool)), this, SLOT(choosePanel(bool)));

			menu->addAction(action);
		}

		menu->addSeparator();

		for (int i = 0; i < chosenPanels.count(); ++i)
		{
			QToolButton *button = new QToolButton(this);
			button->setDefaultAction(new QAction(button));
			button->setToolTip(getPanelTitle(chosenPanels.at(i)));
			button->setCheckable(true);
			button->setAutoRaise(true);
			button->defaultAction()->setData(chosenPanels.at(i));

			if (chosenPanels.at(i) == QLatin1String("bookmarks"))
			{
				button->setIcon(ThemesManager::getIcon(QLatin1String("bookmarks")));
			}
			else if (chosenPanels.at(i) == QLatin1String("cache"))
			{
				button->setIcon(ThemesManager::getIcon(QLatin1String("cache")));
			}
			else if (chosenPanels.at(i) == QLatin1String("config"))
			{
				button->setIcon(ThemesManager::getIcon(QLatin1String("configuration")));
			}
			else if (chosenPanels.at(i) == QLatin1String("cookies"))
			{
				button->setIcon(ThemesManager::getIcon(QLatin1String("cookies")));
			}
			else if (chosenPanels.at(i) == QLatin1String("history"))
			{
				button->setIcon(ThemesManager::getIcon(QLatin1String("view-history")));
			}
			else if (chosenPanels.at(i) == QLatin1String("notes"))
			{
				button->setIcon(ThemesManager::getIcon(QLatin1String("notes")));
			}
			else if (chosenPanels.at(i) == QLatin1String("transfers"))
			{
				button->setIcon(ThemesManager::getIcon(QLatin1String("transfers")));
			}
			else if (chosenPanels.at(i).startsWith(QLatin1String("web:")))
			{
				button->setIcon(ThemesManager::getIcon(QLatin1String("text-html")));

				QAction *action = new QAction(menu);
				action->setCheckable(true);
				action->setChecked(true);
				action->setData(chosenPanels.at(i));
				action->setText(getPanelTitle(chosenPanels.at(i)));

				connect(action, SIGNAL(toggled(bool)), this, SLOT(choosePanel(bool)));

				menu->addAction(action);
			}
			else
			{
开发者ID:davidyang5405,项目名称:otter-browser,代码行数:85,代码来源:SidebarWidget.cpp


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