--- a/src/mainWindow.cc Tue Sep 09 01:16:24 2014 +0300 +++ b/src/mainWindow.cc Thu Nov 06 15:44:11 2014 +0200 @@ -58,6 +58,7 @@ CFGENTRY (Bool, ColorizeObjectsList, true) CFGENTRY (String, QuickColorToolbar, "4:25:14:27:2:3:11:1:22:|:0:72:71:15") CFGENTRY (Bool, ListImplicitFiles, false) +CFGENTRY (List, HiddenToolbars, {}) EXTERN_CFGENTRY (List, RecentFiles) EXTERN_CFGENTRY (Bool, DrawAxes) EXTERN_CFGENTRY (String, MainColor) @@ -125,6 +126,14 @@ connect (ui->ringToolSegments, SIGNAL (valueChanged (int)), this, SLOT (circleToolSegmentsChanged())); circleToolSegmentsChanged(); // invoke it manually for initial label text + + for (QVariant const& toolbarname : cfg::HiddenToolbars) + { + QToolBar* toolbar = findChild<QToolBar*> (toolbarname.toString()); + + if (toolbar != null) + toolbar->hide(); + } } MainWindow::~MainWindow() @@ -562,17 +571,41 @@ void MainWindow::updateSelection() { g_isSelectionLocked = true; - - ui->objectList->clearSelection(); + QItemSelection itemselect; + int top = -1; + int bottom = -1; for (LDObjectPtr obj : Selection()) { if (obj->qObjListEntry == null) continue; - obj->qObjListEntry->setSelected (true); + int row = ui->objectList->row (obj->qObjListEntry); + + if (top == -1) + { + top = bottom = row; + } + else + { + if (row != bottom + 1) + { + itemselect.select (ui->objectList->model()->index (top, 0), + ui->objectList->model()->index (bottom, 0)); + top = -1; + } + + bottom = row; + } } + if (top != -1) + { + itemselect.select (ui->objectList->model()->index (top, 0), + ui->objectList->model()->index (bottom, 0)); + } + + ui->objectList->selectionModel()->select (itemselect, QItemSelectionModel::ClearAndSelect); g_isSelectionLocked = false; } @@ -608,10 +641,17 @@ return; } - // Save the configuration before leaving so that, for instance, grid choice - // is preserved across instances. + // Save the toolbar set + cfg::HiddenToolbars.clear(); + + for (QToolBar* toolbar : findChildren<QToolBar*>()) + { + if (toolbar->isHidden()) + cfg::HiddenToolbars << toolbar->objectName(); + } + + // Save the configuration before leaving. Config::Save(); - ev->accept(); }