@@ -104,7 +104,7 @@ MainWindow::MainWindow(QWidget *parent)
104104 );
105105
106106 QConstraint::QConstraintBase::setPenSelected (
107- QPen ( Qt::black ,2 , Qt::DashLine, Qt::RoundCap, Qt::RoundJoin)
107+ QPen ( Qt::darkGreen ,2 , Qt::DashLine, Qt::RoundCap, Qt::RoundJoin)
108108 );
109109
110110 QEntity::QConstrained::setPenDefault (
@@ -118,6 +118,14 @@ MainWindow::MainWindow(QWidget *parent)
118118 QEntity::QStroke::setPenDefault (
119119 QPen ( Qt::darkRed, 2 , Qt::SolidLine, Qt::RoundCap)
120120 );
121+
122+ QEntity::QSegment::setPenSelected (
123+ QPen ( Qt::darkGreen, 2 , Qt::DashLine, Qt::RoundCap)
124+ );
125+
126+ QEntity::QStroke::setPenSelected (
127+ QPen ( Qt::darkGreen, 2 , Qt::DashLine, Qt::RoundCap)
128+ );
121129}
122130
123131MainWindow::~MainWindow ()
@@ -190,7 +198,7 @@ void MainWindow::createActions()
190198 actionExit->setIcon ( style ()->standardIcon ( QStyle::SP_BrowserStop));
191199
192200 actionTabulaRasa = std::make_unique<QAction>( " Delete all" );
193- actionTabulaRasa->setToolTip ( " Make a clean sweep (blank state)" );
201+ actionTabulaRasa->setToolTip ( " Make a clean sweep (blank state)" );
194202 actionTabulaRasa->setIcon ( QPixmap (" :/icons/Tango/Edit-clear.svg" ) );
195203 actionTabulaRasa->setIcon ( style ()->standardIcon ( QStyle::SP_DialogResetButton ) );
196204
@@ -246,7 +254,7 @@ void MainWindow::createActions()
246254 actionToggleShowConstrained->setIconVisibleInMenu ( false );
247255
248256 actionToggleShowUncertainty = std::make_unique<QAction>( " Show uncertainty" );
249- actionToggleShowUncertainty->setShortcut ( QKeySequence ( " Ctrl+U" ) );
257+ actionToggleShowUncertainty->setShortcut ( QKeySequence ( " Ctrl+U" ) );
250258 actionToggleShowUncertainty->setToolTip ( " Show confidence regions" );
251259 actionToggleShowUncertainty->setCheckable ( true );
252260 actionToggleShowUncertainty->setChecked ( QEntity::QSegment::showUncertainty () );
@@ -316,9 +324,16 @@ void MainWindow::createActions()
316324 actionToggleConsiderConcurrent->setIconVisibleInMenu ( false );
317325 actionToggleConsiderConcurrent->setIcon ( QPixmap ( " :/icons/consider_concurrence.svg" ));
318326
327+ actionItemMoveToBottom = std::make_unique<QAction>( " Move selected items to bottom" );
328+ actionItemMoveToBottom->setToolTip ( " Send items to back (visual stacking)" );
329+ actionItemMoveToBottom->setShortcut ( QKeySequence (" Ctrl+-" ) );
330+
331+ actionItemMoveToTop = std::make_unique<QAction>( " Move selected items to top" );
332+ actionItemMoveToTop->setToolTip ( " Bring items to front (visual stacking)" );
333+ actionItemMoveToTop->setShortcut ( QKeySequence (" Ctrl++" ) );
319334
320335 actionChangeFormat = std::make_unique<QAction>( " Format selected entities" , this );
321- actionChangeFormat->setToolTip ( " Format selected entities (Ctrl+F) " );
336+ actionChangeFormat->setToolTip ( " Format selected entities" );
322337 actionChangeFormat->setShortcut ( QKeySequence (" Ctrl+F" ));
323338
324339}
@@ -350,15 +365,6 @@ void MainWindow::createBoxes()
350365 spinBoxAlphaSnap->setToolTip ( " significance level" );
351366 spinBoxAlphaSnap->setFont ( font );
352367
353- /* spinBoxVizu = new QDoubleSpinBox(this);
354- spinBoxVizu->setRange(confBox.min,confBox.max);
355- spinBoxVizu->setSingleStep(confBox.step);
356- spinBoxVizu->setDecimals(confBox.decimals);
357- spinBoxVizu->setValue(confBox.default_val);
358- spinBoxVizu->setPrefix(QStringLiteral("P="));
359- spinBoxVizu->setSuffix(QStringLiteral(" "));
360- spinBoxVizu->setToolTip(QStringLiteral("visualization confidence region"));
361- */
362368 spinBoxOpacity = std::make_unique<QDoubleSpinBox>( this );
363369 spinBoxOpacity->setRange ( opacityBox.min , opacityBox.max );
364370 spinBoxOpacity->setSingleStep ( opacityBox.step );
@@ -404,20 +410,17 @@ void MainWindow::createMenus()
404410 menuEdit->addAction ( m_view->actionCopySvgToClipboard .get () );
405411 menuEdit->addAction ( m_view->actionCopyPdfToClipboard .get () );
406412 menuEdit->addAction ( m_view->actionCopyScreenshotToClipboard .get () );
407- /* menuEdit->addSeparator(); // ..............................................
408- menuEdit->addAction( actionBringToFront.get() );
409- menuEdit->addAction( actionSendBack.get() );*/
413+
410414 menuEdit->addAction ( actionBackgroundImageRemove.get () );
411415 menuEdit->addAction ( actionFitInView.get () );
412416 menuEdit->addSeparator ();
417+
418+ menuEdit->addAction ( actionItemMoveToTop.get () );
419+ menuEdit->addAction ( actionItemMoveToBottom.get () );
413420 menuEdit->addAction ( actionToggleSelection.get () );
414421 menuEdit->addAction ( actionDeselectAll.get () );
415- /* menuEdit->addAction( actionSelectAllConstraints.get() );
416- menuEdit->addAction( actionSelectAllRedundantConstraints.get() );
417- menuEdit->addAction( actionSelectAllSegments.get() );
418- menuEdit->addSeparator(); */ // ..............................................
422+
419423 menuEdit->addAction ( actionChangeFormat.get () );
420- // menuEdit->setFont(f);
421424 menuBar ()->addMenu ( menuEdit.get () );
422425
423426
@@ -524,19 +527,19 @@ void MainWindow::createToolBars()
524527void MainWindow::establishConnections ()
525528{
526529 connect ( m_undoStack.get (), &QUndoStack::indexChanged,
527- this , &MainWindow::slotStackIndexChanged);
530+ this , &MainWindow::slotStackIndexChanged);
528531
529532 // edit ............................................................
530533 connect ( m_scene.get (), &MainScene::signalCmdAddStroke,
531- this , &MainWindow::slotCmdAddStroke);
534+ this , &MainWindow::slotCmdAddStroke);
532535 connect ( m_scene.get (), &MainScene::signalCmdDeleteSelection, // pressed key [del] via emit signal
533- this , &MainWindow::slotCmdDeleteSelection);
536+ this , &MainWindow::slotCmdDeleteSelection);
534537 connect ( actionDeleteSelection.get (), &QAction::triggered, // select menu item
535538 this , &MainWindow::slotCmdDeleteSelection);
536539 connect ( actionTabulaRasa.get (), &QAction::triggered,
537540 this , &MainWindow::slotCmdTabulaRasa);
538541 connect ( actionToggleSelection.get (), &QAction::triggered,
539- this , &MainWindow::slotToggleSelection);
542+ this , &MainWindow::slotToggleSelection);
540543 connect ( actionDeselectAll.get (), &QAction::triggered,
541544 this , &MainWindow::slotDeselectAll);
542545
@@ -557,10 +560,10 @@ void MainWindow::establishConnections()
557560
558561 // If necessary, enable/disable the menu entry "delete selection"
559562 connect ( m_scene.get (), &MainScene::selectionChanged,
560- this , &MainWindow::slotSelectionChanged);
563+ this , &MainWindow::slotSelectionChanged);
561564
562565 connect ( m_scene.get (), &MainScene::signalUndoLastAction,
563- this , &MainWindow::slotUndoLastAction);
566+ this , &MainWindow::slotUndoLastAction);
564567
565568 // background
566569 connect ( actionBackgroundImageLoad.get (), &QAction::triggered,
@@ -569,12 +572,12 @@ void MainWindow::establishConnections()
569572 this , &MainWindow::slotBackgroundImageRemove);
570573
571574 // search, consider
572- connect ( actionToggleConsiderOrthogonal.get (), &QAction::triggered,
573- this , &MainWindow::slotToggleConsiderOrthogonal);
574- connect ( actionToggleConsiderParallel.get (), &QAction::triggered,
575+ connect ( actionToggleConsiderOrthogonal.get (), &QAction::triggered,
576+ this , &MainWindow::slotToggleConsiderOrthogonal);
577+ connect ( actionToggleConsiderParallel.get (), &QAction::triggered,
575578 this , &MainWindow::slotToggleConsiderParallel);
576579 connect ( actionToggleConsiderConcurrent.get (), &QAction::triggered,
577- this , &MainWindow::slotToggleConsiderConcurrent);
580+ this , &MainWindow::slotToggleConsiderConcurrent);
578581
579582 // show/display
580583 connect ( actionBackgroundImageToggleShow.get (), &QAction::triggered,
@@ -592,16 +595,11 @@ void MainWindow::establishConnections()
592595 connect ( actionToggleShowColoration.get (), &QAction::triggered,
593596 this , &MainWindow::slotToggleShowColored);
594597
595-
596-
597598 connect ( actionBinaryRead.get (), &QAction::triggered,
598599 this , &MainWindow::slotFileOpen);
599- // connect( this, &MainWindow::isWindowModified,
600- // actionBinarySave.get(), &QAction::setEnabled );
601600 connect ( actionBinarySave.get (), &QAction::triggered,
602601 this , &MainWindow::fileSave);
603602
604-
605603 connect ( actionExportSaveAs.get (), &QAction::triggered,
606604 this , &MainWindow::slotExportSaveAs);
607605
@@ -615,24 +613,16 @@ void MainWindow::establishConnections()
615613 this , &MainWindow::slotAboutQt);
616614 connect ( actionAbout.get (), &QAction::triggered,
617615 this , &MainWindow::slotAbout);
618- /* connect( actionShortcuts.get(), &QAction::triggered,
619- this, &MainWindow::slotShortcuts);*/
620-
621616
622617 // view
623618 connect ( actionFitInView.get (), &QAction::triggered,
624619 this , &MainWindow::slotFitInView);
625620
626- /* connect( actionSelectAllConstraints.get(), &QAction::triggered,
627- this, &MainWindow::slotSelectAllConstraints);
628- connect( actionSelectAllRedundantConstraints.get(), &QAction::triggered,
629- this, &MainWindow::slotSelectAllRedundantConstraints);
630- connect( actionSelectAllSegments.get(), &QAction::triggered,
631- this, &MainWindow::slotSelectAllSegments);
632- connect( actionBringToFront.get(), &QAction::triggered,
633- this, &MainWindow::slotItemBringToFront);
634- connect( actionSendBack.get(), &QAction::triggered,
635- this, &MainWindow::slotItemSendToBack);*/
621+ // edit
622+ connect ( actionItemMoveToTop.get (), &QAction::triggered,
623+ this , &MainWindow::slotItemMoveToTop);
624+ connect ( actionItemMoveToBottom.get (), &QAction::triggered,
625+ this , &MainWindow::slotItemMoveToBottom);
636626
637627 connect ( spinBoxAlphaRecognition.get (), QOverload<double >::of (&QDoubleSpinBox::valueChanged),
638628 this , &MainWindow::slotValueChangedAlphaRecognition);
@@ -645,8 +635,7 @@ void MainWindow::establishConnections()
645635 this , &MainWindow::slotValueChangedOpacity);
646636
647637 connect ( m_view.get (), &MainView::signalShowStatus,
648- this , &MainWindow::slotShowStatus );
649-
638+ this , &MainWindow::slotShowStatus );
650639}
651640
652641bool MainWindow::maybeSave ()
@@ -1204,4 +1193,52 @@ void MainWindow::slotUpdateMarkerSize( const int sz)
12041193 m_scene->update ();
12051194}
12061195
1196+
1197+ void MainWindow::slotItemMoveToBottom ()
1198+ {
1199+ qDebug () << Q_FUNC_INFO;
1200+ if ( m_scene->selectedItems ().isEmpty () ) {
1201+ return ;
1202+ }
1203+
1204+ constexpr double shift = -0.1 ;
1205+ const auto constSelectedItems = m_scene->selectedItems ();
1206+ for ( auto & selectedItem : constSelectedItems ) {
1207+ qreal zValue = selectedItem->zValue ();
1208+ const auto constCollidingItems = selectedItem->collidingItems ();
1209+ for ( const auto item : constCollidingItems ) {
1210+ if ( item->zValue () <= zValue ) {
1211+ zValue = item->zValue () +shift;
1212+ }
1213+ }
1214+ selectedItem->setZValue ( zValue );
1215+ // selectedItem->setSelected( false ); // ??
1216+ }
1217+ }
1218+
1219+ void MainWindow::slotItemMoveToTop ()
1220+ {
1221+ qDebug () << Q_FUNC_INFO;
1222+
1223+ if ( m_scene->selectedItems ().isEmpty () ) {
1224+ return ;
1225+ }
1226+
1227+ const auto constSelectedItems = m_scene->selectedItems ();
1228+ constexpr double shift = +0.1 ;
1229+ for ( auto & selectedItem : constSelectedItems ) {
1230+ qreal zValue = selectedItem->zValue ();
1231+
1232+ const auto collidingItems = selectedItem->collidingItems ();
1233+ for ( const auto item : collidingItems ) {
1234+ if ( item->zValue () >= zValue ) {
1235+ zValue = item->zValue () +shift;
1236+ }
1237+ }
1238+ selectedItem->setZValue ( zValue );
1239+ // selectedItem->setSelected( false );
1240+ }
1241+ }
1242+
1243+
12071244} // namespace GUI
0 commit comments