Example #1
0
void MainWindow::makeAction()
{
    m_newAct = new QAction( tr("&New"), this);//QIcon(":/pixmaps/filenew.xpm"),
    m_newAct->setShortcut(tr("Ctrl+N"));
    m_newAct->setStatusTip(tr("Create a new file"));
    connect(m_newAct, SIGNAL(triggered()), this, SLOT(newMindMap()));

    m_openAct = new QAction(tr("&Open..."), this);
    m_openAct->setShortcut(tr("Ctrl+O"));
    m_openAct->setStatusTip(tr("Open an existing file"));
    connect(m_openAct, SIGNAL(triggered()), this, SLOT(openMindMap()));

    m_saveAct = new QAction(tr("&Save"), this);
    m_saveAct->setShortcut(tr("Ctrl+S"));
    m_saveAct->setStatusTip(tr("Save the document to disk"));
    connect(m_saveAct, SIGNAL(triggered()), this, SLOT(saveMindMap()));

    m_saveAsAct = new QAction(tr("Save &As..."), this);
    m_saveAsAct->setStatusTip(tr("Save the document under a new name"));
    connect(m_saveAsAct, SIGNAL(triggered()), this, SLOT(saveAsMindMap()));



    m_scenePropertiesAct = new QAction(tr("Scene Properties"),this);
    //connet(m_scenePropertiesAct);

    m_exitAct = new QAction(tr("E&xit"), this);
    m_exitAct->setShortcut(tr("Ctrl+Q"));
    m_exitAct->setStatusTip(tr("Exit the application"));
    connect(m_exitAct, SIGNAL(triggered()), this, SLOT(close()));

    m_svgExportAct= new QAction(tr("Svg"), this);
    m_svgExportAct->setStatusTip(tr("Export the map as SVG file"));
    connect(m_svgExportAct, SIGNAL(triggered()), this, SLOT(exportMap()));

    m_pngExportAct= new QAction(tr("Image"), this);
    m_pngExportAct->setStatusTip(tr("Export the map as Image file"));
    connect(m_pngExportAct, SIGNAL(triggered()), this, SLOT(exportMap()));

    m_zoomInAct = new QAction(tr("Zoom In"),this);
    m_zoomInAct->setShortcut(tr("Ctrl++"));
    m_zoomInAct->setStatusTip(tr("Zoom in the map"));
    connect(m_zoomInAct,SIGNAL(triggered()),m_mindmapView,SLOT(zoomIn()));


    m_zoomOutAct = new QAction(tr("Zoom Out"),this);
    m_zoomOutAct->setStatusTip(tr("Zoom out of the map"));
    m_zoomOutAct->setShortcut(tr("Ctrl+-"));
    connect(m_zoomOutAct,SIGNAL(triggered()),m_mindmapView,SLOT(zoomOut()));

    m_detailView = new QAction(tr("Show/Hide Detail view"),this);

    m_toolbarView = new QAction(tr("Show/Hide Toolbar"),this);

    m_keepDetailsVisible = new QAction(tr("Always show detail view"),this);
    m_keepDetailsVisible->setCheckable(true);
    m_keepDetailsVisible->setChecked(true);
    m_toolbarView->setCheckable(true);
    //connect(m_toolbarView,SIGNAL(toggled(bool)),m_dock,SLOT(setVisible(bool)));
}
Example #2
0
void MindMapWindow::createActions()
{
    // create mind map action
    _createMindMapAction = new QAction(tr("Create a new mind map"), this);
    _createMindMapAction->setIcon(QIcon("Resources\\new.png"));
    _createMindMapAction->setStatusTip(tr("create a new mind map"));
    connect(_createMindMapAction, SIGNAL(triggered()), this, SLOT(createMindMap()));
    // open mind map action
    _openMindMapAction = new QAction(tr("Open a new mind map"), this);
    _openMindMapAction->setIcon(QIcon("Resources\\open.png"));
    _openMindMapAction->setStatusTip(tr("open a new mind map"));
    connect(_openMindMapAction, SIGNAL(triggered()), this, SLOT(openMindMap()));
    // save mind map action
    _saveMindMapAction = new QAction(tr("Save a new mind map"), this);
    _saveMindMapAction->setIcon(QIcon("Resources\\save.png"));
    _saveMindMapAction->setStatusTip(tr("save a new mind map"));
    connect(_saveMindMapAction, SIGNAL(triggered()), this, SLOT(saveMindMap()));
    // exit action
    _exitAction = new QAction(tr("Exit"), this);
    _exitAction->setIcon(QIcon("Resources\\delete.png"));
    _exitAction->setStatusTip(tr("Exit"));
    connect(_exitAction, SIGNAL(triggered()), this, SLOT(exit()));
    // edit node action
    _editNodeAction = new QAction(tr("& Edit"), this);
    _editNodeAction->setIcon(QIcon("Resources\\edit.png"));
    _editNodeAction->setStatusTip(tr("Edit a node"));
    connect(_editNodeAction, SIGNAL(triggered()), this, SLOT(editNode()));
    // delete node action
    _deleteNodeAction = new QAction(tr("& Delete"), this);
    _deleteNodeAction->setIcon(QIcon("Resources\\delete.png"));
    _deleteNodeAction->setStatusTip(tr("Delete a node"));
    connect(_deleteNodeAction, SIGNAL(triggered()), this, SLOT(deleteNode()));
    // insert child action
    _insertChildAction = new QAction(tr("Insert a& Child"), this);
    _insertChildAction->setIcon(QIcon("Resources\\insertChild.png"));
    _insertChildAction->setStatusTip(tr("Insert a child"));
    connect(_insertChildAction, SIGNAL(triggered()), this, SLOT(insertChild()));
    // insert sibling action
    _insertSiblingAction = new QAction(tr("Insert a& Sibling"), this);
    _insertSiblingAction->setIcon(QIcon("Resources\\insertSibling.png"));
    _insertSiblingAction->setStatusTip(tr("Insert a sibling"));
    connect(_insertSiblingAction, SIGNAL(triggered()), this, SLOT(insertSibling()));
    // insert parent action
    _insertParentAction = new QAction(tr("Insert a& Parent"), this);
    _insertParentAction->setIcon(QIcon("Resources\\insertParent.png"));
    _insertParentAction->setStatusTip(tr("Insert a parent"));
    connect(_insertParentAction, SIGNAL(triggered()), this, SLOT(insertParent()));
    // cut action
    _cutAction = new QAction(tr("Cut"), this);
    _cutAction->setIcon(QIcon("Resources\\cut.png"));
    _cutAction->setStatusTip(tr("Cut"));
    connect(_cutAction, SIGNAL(triggered()), this, SLOT(cut()));
    // copy action
    _copyAction = new QAction(tr("Copy"), this);
    _copyAction->setIcon(QIcon("Resources\\copy.png"));
    _copyAction->setStatusTip(tr("Copy"));
    connect(_copyAction, SIGNAL(triggered()), this, SLOT(copy()));
    // paste action
    _pasteAction = new QAction(tr("Paste"), this);
    _pasteAction->setIcon(QIcon("Resources\\paste.png"));
    _pasteAction->setStatusTip(tr("Paste"));
    connect(_pasteAction, SIGNAL(triggered()), this, SLOT(paste()));
    // about action
    _aboutAction = new QAction("About", this);
    connect(_aboutAction, SIGNAL(triggered()), this, SLOT(about()));
    // undo action
    _undoAction = new QAction(tr("Undo"), this);
    _undoAction->setIcon(QIcon("Resources\\undo.png"));
    _undoAction->setStatusTip(tr("Undo"));
    connect(_undoAction, SIGNAL(triggered()), this, SLOT(undo()));
    // redo action
    _redoAction = new QAction(tr("Redo"), this);
    _redoAction->setIcon(QIcon("Resources\\redo.png"));
    _redoAction->setStatusTip(tr("Redo"));
    connect(_redoAction, SIGNAL(triggered()), this, SLOT(redo()));
    // add rectangle action
    _rectangleStyleAction = new QAction(tr("Rectangle Style"), this);
    _rectangleStyleAction->setIcon(QIcon("Resources\\rectangle.png"));
    _rectangleStyleAction->setStatusTip(tr("Rectangle Style"));
    connect(_rectangleStyleAction, SIGNAL(triggered()), this, SLOT(addRectangleStyle()));
    // add triangle action
    _triangleStyleAction = new QAction(tr("Triangle Style"), this);
    _triangleStyleAction->setIcon(QIcon("Resources\\triangle.png"));
    _triangleStyleAction->setStatusTip(tr("Triangle Style"));
    connect(_triangleStyleAction, SIGNAL(triggered()), this, SLOT(addTriangleStyle()));
    // add ellipse action
    _ellipseStyleAction = new QAction(tr("Ellipse Style"), this);
    _ellipseStyleAction->setIcon(QIcon("Resources\\ellipse.png"));
    _ellipseStyleAction->setStatusTip(tr("Ellipse Style"));
    connect(_ellipseStyleAction, SIGNAL(triggered()), this, SLOT(addEllipseStyle()));
    // toggle collapse action
    _toggleCollapseAction = new QAction(tr("Toggle Collapse"), this);
    _toggleCollapseAction->setIcon(QIcon("Resources\\collapse.png"));
    _toggleCollapseAction->setStatusTip(tr("Toggle Collapse"));
    connect(_toggleCollapseAction, SIGNAL(triggered()), this, SLOT(toggleCollapse()));
}