Beispiel #1
0
QMenu* GuiTools::createProblemPopupMenu(ProjectBase* project, QWidget* mainWindow, const QPoint & iPoint,Problem* selectedProblem,int numProblem)
{
    QMenu *menu = new QMenu();

    //Open folder
    //Open folder
    QAction *openFolderAct = new QAction("Open folder",menu);
    connect(openFolderAct,SIGNAL(triggered()),selectedProblem,SLOT(openFolder()));
    QIcon icon;
    icon.addPixmap(QPixmap(QString::fromUtf8(":/icons/folder")), QIcon::Normal, QIcon::Off);
    openFolderAct->setIcon(icon);
    //openFolderAct->setIconSize(QSize(20, 20));
    menu->addAction(openFolderAct);

    //Rename problem
    QAction *renameAct = new QAction("Rename problem...",menu);
    renameAct->setData(numProblem);
    connect(renameAct,SIGNAL(triggered()),mainWindow,SLOT(renameProblem()));
    menu->addAction(renameAct);

    //Remove problem
    QAction *removeAct = new QAction("Remove problem",menu);
    removeAct->setData(numProblem);
    connect(removeAct,SIGNAL(triggered()),mainWindow,SLOT(removeProblem()));
    QIcon iconRem;
    iconRem.addPixmap(QPixmap(QString::fromUtf8(":/icons/Remove")), QIcon::Normal, QIcon::Off);
    removeAct->setIcon(iconRem);
    menu->addAction(removeAct);

    return menu;
}
Beispiel #2
0
void ProjectBase::renameCase(OMCase* curCase,QString newName)
{
    Problem* problem;
    Result* result;
    problem = dynamic_cast<Problem*>(curCase);
    if(problem)
        renameProblem(problem,newName);
    else
    {
        result = dynamic_cast<Result*>(curCase);
        if(result)
            renameResult(result,newName);
    }
}