From f1eccc2d8fc74af0e062b088a965347e25d7f681 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Mon, 11 Apr 2016 19:40:41 +0200 Subject: [PATCH] refs #638, allow to select model in own model set for forms (double click) --- src/blackgui/components/dbmappingcomponent.cpp | 12 ++++++++++++ src/blackgui/components/dbmappingcomponent.ui | 6 ++++++ 2 files changed, 18 insertions(+) diff --git a/src/blackgui/components/dbmappingcomponent.cpp b/src/blackgui/components/dbmappingcomponent.cpp index d2ea80ca5..cd051231c 100644 --- a/src/blackgui/components/dbmappingcomponent.cpp +++ b/src/blackgui/components/dbmappingcomponent.cpp @@ -73,6 +73,8 @@ namespace BlackGui connect(ui->tw_ModelsToBeMapped, &QTabWidget::currentChanged, this, &CDbMappingComponent::ps_tabIndexChanged); connect(ui->tw_ModelsToBeMapped, &QTabWidget::currentChanged, ui->comp_ModelMatcher , &CModelMatcherComponent::tabIndexChanged); + connect(ui->comp_OwnModelSet->view(), &CAircraftModelView::doubleClicked, this, &CDbMappingComponent::ps_onModelRowSelected); + // how to display forms ui->editor_AircraftIcao->setSelectOnly(); ui->editor_Distributor->setSelectOnly(); @@ -82,6 +84,10 @@ namespace BlackGui this->ui->tw_ModelsToBeMapped->setTabIcon(TabOwnModels, CIcons::appModels16()); this->ui->comp_StashAircraft->view()->setCustomMenu(new CApplyDbDataMenu(this)); + // custom menu + this->setContextMenuPolicy(Qt::CustomContextMenu); + connect(this, &CDbMappingComponent::customContextMenuRequested, this, &CDbMappingComponent::ps_onCustomContextMenu); + // vPilot this->initVPilotLoading(); } @@ -137,6 +143,8 @@ namespace BlackGui { if (!index.isValid()) { return CAircraftModel(); } const QObject *sender = QObject::sender(); + + // check if we have an explicit sender if (sender == this->ui->tvp_AircraftModelsForVPilot) { return this->ui->tvp_AircraftModelsForVPilot->at(index); @@ -149,6 +157,10 @@ namespace BlackGui { return this->ui->comp_StashAircraft->view()->at(index); } + else if (sender == this->ui->comp_OwnModelSet->view()) + { + return this->ui->comp_OwnModelSet->view()->at(index); + } // no sender, use current tab const CAircraftModelView *v = this->currentModelView(); diff --git a/src/blackgui/components/dbmappingcomponent.ui b/src/blackgui/components/dbmappingcomponent.ui index 50d364582..1804c367f 100644 --- a/src/blackgui/components/dbmappingcomponent.ui +++ b/src/blackgui/components/dbmappingcomponent.ui @@ -37,6 +37,12 @@ + + + 0 + 0 + + Qt::Vertical