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


C++ Progress::attach方法代码示例

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


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

示例1: setCurrentDataset

void PreviewWidget::setCurrentDataset(ImportDescriptor* pDataset)
{
   ImportDescriptor* pActiveDataset = getCurrentDataset();
   if (pDataset == pActiveDataset)
   {
      return;
   }

   // Do nothing if the new current data set is not a data set in the current file
   if (pDataset != NULL)
   {
      QMap<QString, vector<ImportDescriptor*> >::const_iterator iter = mDatasets.find(mCurrentFile);
      if (iter != mDatasets.end())
      {
         vector<ImportDescriptor*> fileDatasets = iter.value();
         if (std::find(fileDatasets.begin(), fileDatasets.end(), pDataset) == fileDatasets.end())
         {
            return;
         }
      }
   }

   mpCurrentDataset = pDataset;

   // Delete the current preview
   destroyPreview();

   // Activate the label indicating that no data set preview is available
   mpDatasetStack->setCurrentIndex(0);

   // Check for no active data set
   if (mpCurrentDataset == NULL)
   {
      emit currentDatasetChanged(mpCurrentDataset);
      return;
   }

   // Only show the preview if the widget is visible or if the data set is imported
   if ((isVisible() == false) || (mpCurrentDataset->isImported() == false))
   {
      if (pActiveDataset != NULL)
      {
         emit currentDatasetChanged(NULL);
      }

      return;
   }

   if (mpImporter != NULL)
   {
      Service<PlugInManagerServices> pManager;

      Progress* pProgress = pManager->getProgress(dynamic_cast<PlugIn*>(mpImporter));
      if (pProgress != NULL)
      {
         pProgress->attach(SIGNAL_NAME(Subject, Modified), Slot(this, &PreviewWidget::progressUpdated));
         pProgress->updateProgress("Getting preview...", 0, NORMAL);
      }

      // Activate the progress bar
      mpDatasetStack->setCurrentIndex(1);

      // Update the data set label
      QMap<QString, vector<ImportDescriptor*> >::const_iterator iter = mDatasets.find(mCurrentFile);
      VERIFYNRV(iter != mDatasets.end());

      vector<ImportDescriptor*> fileDatasets = iter.value();

      unsigned int iIndex = 0;
      unsigned int numDatasets = fileDatasets.size();
      for (iIndex = 0; iIndex < numDatasets; ++iIndex)
      {
         ImportDescriptor* pCurrentDataset = fileDatasets[iIndex];
         if (pCurrentDataset == pDataset)
         {
            break;
         }
      }

      VERIFYNRV(iIndex < numDatasets);

      const DataDescriptor* pDescriptor = mpCurrentDataset->getDataDescriptor();
      VERIFYNRV(pDescriptor != NULL);

      mpDatasetLabel->setText("<b>Data Set (" + QString::number(iIndex + 1) + " of " +
         QString::number(numDatasets) + "):</b>  " + QString::fromStdString(pDescriptor->getName()));

      // Process events to erase the no preview available page
      qApp->processEvents();

      // Get the preview from the importer
      mpImporterWidget = mpImporter->getPreview(pDescriptor, pProgress);
      if (mpImporterWidget != NULL)
      {
         // Display the preview widget
         SpatialDataView* pView = dynamic_cast<SpatialDataView*>(mpImporterWidget);
         if (pView != NULL)
         {
            ChippingWidget* pChippingWidget = new ChippingWidget(pView,
               dynamic_cast<const RasterDataDescriptor*>(pDescriptor), mpPreview);
//.........这里部分代码省略.........
开发者ID:Siddharthk,项目名称:opticks,代码行数:101,代码来源:PreviewWidget.cpp


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