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


C++ DockWindow::getWidget方法代码示例

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


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

示例1: updateContextMenu

void PlotSetImp::updateContextMenu(Subject& subject, const string& signal, const boost::any& value)
{
   ContextMenu* pMenu = boost::any_cast<ContextMenu*>(value);
   if (pMenu == NULL)
   {
      return;
   }

   QObject* pParent = pMenu->getActionParent();
   vector<SessionItem*> items = pMenu->getSessionItems();

   if (items.empty() == true)
   {
      return;
   }

   bool bAddSeparator = false;
   bool bAddActivate = false;
   bool bAddDelete = false;
   string afterId;

   vector<DockWindow*> windowItems = pMenu->getSessionItems<DockWindow>();
   if (windowItems.size() == 1)
   {
      DockWindow* pDockWindow = windowItems.front();
      if (pDockWindow != NULL)
      {
         PlotSetGroup* pPlotSetGroup = dynamic_cast<PlotSetGroup*>(pDockWindow->getWidget());
         if (pPlotSetGroup != NULL)
         {
            if (dynamic_cast<PlotSetImp*>(pPlotSetGroup->getCurrentPlotSet()) == this)
            {
               bAddSeparator = true;
               bAddDelete = true;
            }
         }
      }
   }
   else if (dynamic_cast<SessionExplorer*>(&subject) != NULL)
   {
      // Make sure all of the selected session items for the menu are plot widgets
      vector<PlotWidget*> plots = pMenu->getSessionItems<PlotWidget>();
      if (plots.size() != items.size())
      {
         return;
      }

      // Make sure all selected plot widget items are contained in this plot set
      vector<PlotWidget*>::iterator iter;
      for (iter = plots.begin(); iter != plots.end(); ++iter)
      {
         PlotWidget* pPlot = *iter;
         if (pPlot != NULL)
         {
            if (containsPlot(pPlot) == false)
            {
               return;
            }
         }
      }

      // Check for only one selected plot widget item
      if (plots.size() == 1)
      {
         bAddSeparator = true;

         // Add an activate action if the selected plot widget is not currently active
         PlotWidget* pPlot = plots.front();
         if (pPlot != NULL)
         {
            if (pPlot != getCurrentPlot())
            {
               bAddActivate = true;
            }
         }
      }

      bAddDelete = true;
      afterId = APP_PLOTWIDGET_PRINT_ACTION;
   }

   // Separator
   if (bAddSeparator == true)
   {
      QAction* pSeparatorAction = new QAction(pParent);
      pSeparatorAction->setSeparator(true);
      pMenu->addActionAfter(pSeparatorAction, APP_PLOTSET_SEPARATOR_ACTION, afterId);

      if (afterId.empty() == false)
      {
         afterId = APP_PLOTSET_SEPARATOR_ACTION;
      }
   }

   // Activate
   if (bAddActivate == true)
   {
      QAction* pActivateAction = new QAction("&Activate", pParent);
      pActivateAction->setAutoRepeat(false);
      pActivateAction->setStatusTip("Activates the selected plot in the plot set");
//.........这里部分代码省略.........
开发者ID:Tom-VdE,项目名称:opticks,代码行数:101,代码来源:PlotSetImp.cpp


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