From b73562b33cd8d29bc5f53f65228c3039ab279349 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Sun, 13 Mar 2016 19:04:46 +0000 Subject: [PATCH] refs #485, CDbMappingComponent: refactor resize logic --- .../components/dbmappingcomponent.cpp | 19 ++++++++++++------- src/blackgui/components/dbmappingcomponent.h | 3 +++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/blackgui/components/dbmappingcomponent.cpp b/src/blackgui/components/dbmappingcomponent.cpp index 2c6e1c338..3de753460 100644 --- a/src/blackgui/components/dbmappingcomponent.cpp +++ b/src/blackgui/components/dbmappingcomponent.cpp @@ -419,16 +419,12 @@ namespace BlackGui void CDbMappingComponent::resizeForSelect() { - int h = this->height(); - int h1 = h / 3 * 2; - int h2 = h / 3; - QList sizes({h1, h2}); - this->ui->sp_MappingComponent->setSizes(sizes); + this->maxTableView(); } void CDbMappingComponent::resizeForMapping() { - int h = this->height(); // total height + const int h = this->height(); // total height int h2 = ui->qw_EditorsScrollArea->minimumHeight(); h2 *= 1.10; // desired height of inner widget + some space for scrollarea int currentSize = ui->sp_MappingComponent->sizes().last(); // current size @@ -445,7 +441,16 @@ namespace BlackGui h1 = h / 3; h2 = h / 3 * 2; } - QList sizes({h1, h2}); + const QList sizes({h1, h2}); + this->ui->sp_MappingComponent->setSizes(sizes); + } + + void CDbMappingComponent::maxTableView() + { + const int h = this->height(); + int h1 = h; + int h2 = 0; + const QList sizes({h1, h2}); this->ui->sp_MappingComponent->setSizes(sizes); } diff --git a/src/blackgui/components/dbmappingcomponent.h b/src/blackgui/components/dbmappingcomponent.h index ed4848588..0e8575494 100644 --- a/src/blackgui/components/dbmappingcomponent.h +++ b/src/blackgui/components/dbmappingcomponent.h @@ -122,6 +122,9 @@ namespace BlackGui //! Resize so that mapping is easier void resizeForMapping(); + //! Max. space for table view + void maxTableView(); + //! Stash models void stashSelectedModels();