mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 01:50:06 +00:00 
			
		
		
		
	"this" must be explicit in lambda capture
This commit is contained in:
		
							parent
							
								
									31db9a4315
								
							
						
					
					
						commit
						a3afd71f03
					
				
					 19 changed files with 132 additions and 129 deletions
				
			
		|  | @ -74,7 +74,7 @@ void AlertDialogImpl::ConnectSignals() | |||
|       textEventManager_.get(), | ||||
|       &manager::TextEventManager::AlertUpdated, | ||||
|       this, | ||||
|       [=](const types::TextEventKey& key) | ||||
|       [this](const types::TextEventKey& key) | ||||
|       { | ||||
|          if (key == key_) | ||||
|          { | ||||
|  | @ -85,7 +85,7 @@ void AlertDialogImpl::ConnectSignals() | |||
|    connect(goButton_, | ||||
|            &QPushButton::clicked, | ||||
|            this, | ||||
|            [=]() | ||||
|            [this]() | ||||
|            { | ||||
|               emit self_->MoveMap(centroid_.latitude_, centroid_.longitude_); | ||||
|               self_->close(); | ||||
|  |  | |||
|  | @ -127,48 +127,48 @@ void AlertDockWidgetImpl::ConnectSignals() | |||
|            alertModel_.get(), | ||||
|            &model::AlertModel::HandleAlert, | ||||
|            Qt::QueuedConnection); | ||||
|    connect(self_->ui->alertView->selectionModel(), | ||||
|            &QItemSelectionModel::selectionChanged, | ||||
|            this, | ||||
|            [=](const QItemSelection& selected, const QItemSelection& deselected) | ||||
|            { | ||||
|               if (selected.size() == 0 && deselected.size() == 0) | ||||
|               { | ||||
|                  // Items which stay selected but change their index are not
 | ||||
|                  // included in selected and deselected. Thus, this signal might
 | ||||
|                  // be emitted with both selected and deselected empty, if only
 | ||||
|                  // the indices of selected items change.
 | ||||
|                  return; | ||||
|               } | ||||
|    connect( | ||||
|       self_->ui->alertView->selectionModel(), | ||||
|       &QItemSelectionModel::selectionChanged, | ||||
|       this, | ||||
|       [this](const QItemSelection& selected, const QItemSelection& deselected) | ||||
|       { | ||||
|          if (selected.size() == 0 && deselected.size() == 0) | ||||
|          { | ||||
|             // Items which stay selected but change their index are not
 | ||||
|             // included in selected and deselected. Thus, this signal might
 | ||||
|             // be emitted with both selected and deselected empty, if only
 | ||||
|             // the indices of selected items change.
 | ||||
|             return; | ||||
|          } | ||||
| 
 | ||||
|               bool itemSelected       = selected.size() > 0; | ||||
|               bool itemHasCoordinates = false; | ||||
|          bool itemSelected       = selected.size() > 0; | ||||
|          bool itemHasCoordinates = false; | ||||
| 
 | ||||
|               if (itemSelected) | ||||
|               { | ||||
|                  QModelIndex selectedIndex = | ||||
|                     proxyModel_->mapToSource(selected[0].indexes()[0]); | ||||
|                  selectedAlertKey_ = alertModel_->key(selectedIndex); | ||||
|                  selectedAlertCentroid_ = | ||||
|                     alertModel_->centroid(selectedAlertKey_); | ||||
|                  itemHasCoordinates = | ||||
|                     selectedAlertCentroid_ != common::Coordinate {}; | ||||
|               } | ||||
|               else | ||||
|               { | ||||
|                  selectedAlertKey_      = {}; | ||||
|                  selectedAlertCentroid_ = {}; | ||||
|               } | ||||
|          if (itemSelected) | ||||
|          { | ||||
|             QModelIndex selectedIndex = | ||||
|                proxyModel_->mapToSource(selected[0].indexes()[0]); | ||||
|             selectedAlertKey_      = alertModel_->key(selectedIndex); | ||||
|             selectedAlertCentroid_ = alertModel_->centroid(selectedAlertKey_); | ||||
|             itemHasCoordinates = | ||||
|                selectedAlertCentroid_ != common::Coordinate {}; | ||||
|          } | ||||
|          else | ||||
|          { | ||||
|             selectedAlertKey_      = {}; | ||||
|             selectedAlertCentroid_ = {}; | ||||
|          } | ||||
| 
 | ||||
|               self_->ui->alertViewButton->setEnabled(itemSelected); | ||||
|               self_->ui->alertGoButton->setEnabled(itemHasCoordinates); | ||||
|          self_->ui->alertViewButton->setEnabled(itemSelected); | ||||
|          self_->ui->alertGoButton->setEnabled(itemHasCoordinates); | ||||
| 
 | ||||
|               logger_->debug("Selected: {}", selectedAlertKey_.ToString()); | ||||
|            }); | ||||
|          logger_->debug("Selected: {}", selectedAlertKey_.ToString()); | ||||
|       }); | ||||
|    connect(self_->ui->alertViewButton, | ||||
|            &QPushButton::clicked, | ||||
|            this, | ||||
|            [=]() | ||||
|            [this]() | ||||
|            { | ||||
|               // View alert
 | ||||
|               alertDialog_->SelectAlert(selectedAlertKey_); | ||||
|  | @ -177,7 +177,7 @@ void AlertDockWidgetImpl::ConnectSignals() | |||
|    connect(self_->ui->alertGoButton, | ||||
|            &QPushButton::clicked, | ||||
|            this, | ||||
|            [=]() | ||||
|            [this]() | ||||
|            { | ||||
|               emit self_->MoveMap(selectedAlertCentroid_.latitude_, | ||||
|                                   selectedAlertCentroid_.longitude_); | ||||
|  |  | |||
|  | @ -45,7 +45,7 @@ ImGuiDebugDialog::ImGuiDebugDialog(QWidget* parent) : | |||
|    connect( | ||||
|       ui->contextComboBox, | ||||
|       &QComboBox::currentIndexChanged, | ||||
|       [=](int row) | ||||
|       [this](int row) | ||||
|       { | ||||
|          auto& contextModel = model::ImGuiContextModel::Instance(); | ||||
|          auto  index        = contextModel.index(row, 0); | ||||
|  |  | |||
|  | @ -39,7 +39,7 @@ public: | |||
|          QObject::connect(toolButton, | ||||
|                           &QToolButton::clicked, | ||||
|                           this, | ||||
|                           [=]() { SelectProduct(product); }); | ||||
|                           [=, this]() { SelectProduct(product); }); | ||||
|       } | ||||
|    } | ||||
|    ~Level2ProductsWidgetImpl() = default; | ||||
|  |  | |||
|  | @ -179,7 +179,7 @@ void Level2SettingsWidget::UpdateSettings(map::MapWidget* activeMap) | |||
|          connect(toolButton, | ||||
|                  &QToolButton::clicked, | ||||
|                  this, | ||||
|                  [=]() { p->SelectElevation(elevationCut); }); | ||||
|                  [=, this]() { p->SelectElevation(elevationCut); }); | ||||
|       } | ||||
| 
 | ||||
|       p->elevationCuts_           = elevationCuts; | ||||
|  |  | |||
|  | @ -48,7 +48,7 @@ public: | |||
|          QObject::connect(toolButton, | ||||
|                           &QToolButton::clicked, | ||||
|                           this, | ||||
|                           [=]() { SelectProductCategory(category); }); | ||||
|                           [=, this]() { SelectProductCategory(category); }); | ||||
| 
 | ||||
|          QMenu* categoryMenu = new QMenu(); | ||||
|          toolButton->setMenu(categoryMenu); | ||||
|  | @ -79,7 +79,7 @@ public: | |||
|                   action, | ||||
|                   &QAction::triggered, | ||||
|                   this, | ||||
|                   [=]() | ||||
|                   [=, this]() | ||||
|                   { | ||||
|                      std::shared_lock lock {awipsProductMutex_}; | ||||
|                      std::string awipsProductName {awipsProductMap_.at(action)}; | ||||
|  |  | |||
|  | @ -72,47 +72,47 @@ RadarSiteDialog::RadarSiteDialog(QWidget* parent) : | |||
|    connect(ui->radarSiteView, | ||||
|            &QTreeView::doubleClicked, | ||||
|            this, | ||||
|            [=]() { emit accept(); }); | ||||
|    connect(ui->radarSiteView->selectionModel(), | ||||
|            &QItemSelectionModel::selectionChanged, | ||||
|            this, | ||||
|            [=](const QItemSelection& selected, const QItemSelection& deselected) | ||||
|            { | ||||
|               if (selected.size() == 0 && deselected.size() == 0) | ||||
|               { | ||||
|                  // Items which stay selected but change their index are not
 | ||||
|                  // included in selected and deselected. Thus, this signal might
 | ||||
|                  // be emitted with both selected and deselected empty, if only
 | ||||
|                  // the indices of selected items change.
 | ||||
|                  return; | ||||
|               } | ||||
|            [this]() { emit accept(); }); | ||||
|    connect( | ||||
|       ui->radarSiteView->selectionModel(), | ||||
|       &QItemSelectionModel::selectionChanged, | ||||
|       this, | ||||
|       [this](const QItemSelection& selected, const QItemSelection& deselected) | ||||
|       { | ||||
|          if (selected.size() == 0 && deselected.size() == 0) | ||||
|          { | ||||
|             // Items which stay selected but change their index are not
 | ||||
|             // included in selected and deselected. Thus, this signal might
 | ||||
|             // be emitted with both selected and deselected empty, if only
 | ||||
|             // the indices of selected items change.
 | ||||
|             return; | ||||
|          } | ||||
| 
 | ||||
|               ui->buttonBox->button(QDialogButtonBox::Ok) | ||||
|                  ->setEnabled(selected.size() > 0); | ||||
|          ui->buttonBox->button(QDialogButtonBox::Ok) | ||||
|             ->setEnabled(selected.size() > 0); | ||||
| 
 | ||||
|               if (selected.size() > 0) | ||||
|               { | ||||
|                  QModelIndex selectedIndex = | ||||
|                     p->proxyModel_->mapToSource(selected[0].indexes()[0]); | ||||
|                  QVariant variantData = p->radarSiteModel_->data(selectedIndex); | ||||
|                  if (variantData.typeId() == QMetaType::QString) | ||||
|                  { | ||||
|                     p->selectedRadarSite_ = | ||||
|                        variantData.toString().toStdString(); | ||||
|                  } | ||||
|                  else | ||||
|                  { | ||||
|                     logger_->warn("Unexpected selection data type"); | ||||
|                     p->selectedRadarSite_ = "?"; | ||||
|                  } | ||||
|               } | ||||
|               else | ||||
|               { | ||||
|                  p->selectedRadarSite_ = "?"; | ||||
|               } | ||||
|          if (selected.size() > 0) | ||||
|          { | ||||
|             QModelIndex selectedIndex = | ||||
|                p->proxyModel_->mapToSource(selected[0].indexes()[0]); | ||||
|             QVariant variantData = p->radarSiteModel_->data(selectedIndex); | ||||
|             if (variantData.typeId() == QMetaType::QString) | ||||
|             { | ||||
|                p->selectedRadarSite_ = variantData.toString().toStdString(); | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                logger_->warn("Unexpected selection data type"); | ||||
|                p->selectedRadarSite_ = std::string {"?"}; | ||||
|             } | ||||
|          } | ||||
|          else | ||||
|          { | ||||
|             p->selectedRadarSite_ = std::string {"?"}; | ||||
|          } | ||||
| 
 | ||||
|               logger_->debug("Selected: {}", p->selectedRadarSite_); | ||||
|            }); | ||||
|          logger_->debug("Selected: {}", p->selectedRadarSite_); | ||||
|       }); | ||||
| } | ||||
| 
 | ||||
| RadarSiteDialog::~RadarSiteDialog() | ||||
|  |  | |||
|  | @ -514,11 +514,13 @@ void SettingsDialogImpl::SetupPalettesAlertsTab() | |||
|       QObject::connect(activeButton, | ||||
|                        &QAbstractButton::clicked, | ||||
|                        self_, | ||||
|                        [=]() { ShowColorDialog(activeEdit, activeFrame); }); | ||||
|                        [=, this]() | ||||
|                        { ShowColorDialog(activeEdit, activeFrame); }); | ||||
|       QObject::connect(inactiveButton, | ||||
|                        &QAbstractButton::clicked, | ||||
|                        self_, | ||||
|                        [=]() { ShowColorDialog(inactiveEdit, inactiveFrame); }); | ||||
|                        [=, this]() | ||||
|                        { ShowColorDialog(inactiveEdit, inactiveFrame); }); | ||||
|    } | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat