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


C++ TaskInfo::show方法代码示例

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


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

示例1: showTaskContextMenu

void MainWindow::showTaskContextMenu(const QPoint &pos) {
    QPoint globalPos = independentTasksTree->mapToGlobal(pos);
    QMenu* menu = new QMenu(this);
    Task* t;
    QString selectedTask = independentTasksTree->indexAt(pos).data(Qt::DisplayRole).toString();
    try {
        t = &(NonPreemptiveFactory::getInstance().getTask(selectedTask));
        if (t->getTaskType()==COMPOSITE) menu->addAction("add subtasks");
        else {
            menu->addAction("schedule programmation");
        }
        menu->addAction("edit constraints");
        menu->addAction("infos");
        menu->addAction("remove");
    }
    catch (CalendarException e) {return;}
    QAction* selectedItem = menu->exec(globalPos);

    if (selectedItem && selectedItem->text()=="add subtasks") {
        AddTaskToCompositeTaskForm* form = new AddTaskToCompositeTaskForm(dynamic_cast<CompositeTask*>(t),this);
        form->show();
    }
    if (selectedItem && selectedItem->text()=="remove") {
        NonPreemptiveFactory::getInstance().removeTask(t);
        refreshProjectsModel();
        refreshIndependentTasksModel();
    }
    if (selectedItem && selectedItem->text()=="infos") {
        TaskInfo* taskinfo = new TaskInfo(t,this);
        taskinfo->show();
    }
    if (selectedItem && selectedItem->text()=="edit constraints") {
        EditAssociationConstraint* editc = new EditAssociationConstraint(t,this);
        editc->show();
    }
}
开发者ID:m-baaziz,项目名称:Project-Calendar,代码行数:36,代码来源:GUI-Architecture.cpp

示例2: showProjectContextMenu

void MainWindow::showProjectContextMenu(const QPoint &pos) {
    QPoint globalPos = projectsTree->mapToGlobal(pos);
    QMenu* menu = new QMenu(this);
    Project* proj;
    Task* t;
    QString selectedProject = projectsTree->indexAt(pos).data(Qt::DisplayRole).toString();
    if (!(projectsTreeView->isHidden()))
        selectedProject = projectsTreeView->indexAt(pos).data(Qt::DisplayRole).toString();
    try {
        proj = &(ProjectFactory::getInstance().getProject(selectedProject));
        menu->addAction("add tasks");
        menu->addAction("infos");
        menu->addAction("show tree");
        menu->addAction("remove");

        QAction* selectedItem = menu->exec(globalPos);
        if (selectedItem && selectedItem->text()=="add tasks") {
            AddTaskToProjectForm* form = new AddTaskToProjectForm(proj,this);
            form->show();
        }
        if (selectedItem && selectedItem->text()=="remove") {
            ProjectFactory::getInstance().removeProject(proj);
            refreshProjectsModel();
            refreshIndependentTasksModel();
        }
        if (selectedItem && selectedItem->text()=="infos") {
            ProjectInfo* projectinfo = new ProjectInfo(proj,this);
            projectinfo->show();
        }
        if (selectedItem && selectedItem->text()=="show tree") {
            treeScene->clear();
            if (projectsTreeView->isHidden()) {
                itemTypeSelector->setCurrentIndex(2);
                drawProjectTree(projectsTreeView->indexAt(pos));  // called from the projectsTreeView
            }
            else {
                drawProjectTree(projectsTreeView->indexAt(pos));    // called from the projectsTree
            }
            calendarTable->hide();
            treeView->show();
        }
    }
    catch (CalendarException e) {


        QString selectedTask = projectsTree->indexAt(pos).data(Qt::DisplayRole).toString();
        if (!(projectsTreeView->isHidden()))
            selectedTask = projectsTreeView->indexAt(pos).data(Qt::DisplayRole).toString();
    try {
        t = &(NonPreemptiveFactory::getInstance().getTask(selectedTask));
        if (t->getTaskType()==COMPOSITE) menu->addAction("add subtasks");
        else {
            UnitaryTask* ut = &(NonPreemptiveFactory::getInstance().getTypedTask(selectedTask));
            menu->addAction("schedule programmation");
        }
        menu->addAction("edit constraints");
        menu->addAction("infos");
        menu->addAction("remove");

        QAction* selectedItem = menu->exec(globalPos);
        if (selectedItem && selectedItem->text()=="add subtasks") {
            AddTaskToCompositeTaskForm* form = new AddTaskToCompositeTaskForm(dynamic_cast<CompositeTask*>(t),this);
            form->show();
        }
        if (selectedItem && selectedItem->text()=="remove") {
            NonPreemptiveFactory::getInstance().removeTask(t);
            refreshProjectsModel();
            refreshIndependentTasksModel();
        }
        if (selectedItem && selectedItem->text()=="infos") {
            TaskInfo* taskinfo = new TaskInfo(t,this);
            taskinfo->show();
        }
        if (selectedItem && selectedItem->text()=="edit constraints") {
            EditAssociationConstraint* editc = new EditAssociationConstraint(t,this);
            editc->show();
        }
    }
    catch (CalendarException e) {return;}
    }

}
开发者ID:m-baaziz,项目名称:Project-Calendar,代码行数:82,代码来源:GUI-Architecture.cpp


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