@@ -575,6 +575,22 @@ void MainWindowPrivate::createActions()
575
575
_this->connect (a, SIGNAL (triggered ()), SLOT (createTable ()));
576
576
ui.menuTests ->addAction (a);
577
577
578
+ a = ui.toolBar ->addAction (" Create Image Viewer" );
579
+ auto ToolButton = qobject_cast<QToolButton*>(ui.toolBar ->widgetForAction (a));
580
+ ToolButton->setPopupMode (QToolButton::InstantPopup);
581
+ a->setToolTip (" Creates floating, docked or pinned image viewer" );
582
+ a->setIcon (svgIcon (" :/adsdemo/images/panorama.svg" ));
583
+ ui.menuTests ->addAction (a);
584
+ auto Menu = new QMenu ();
585
+ ToolButton->setMenu (Menu);
586
+ a = Menu->addAction (" Floating Image Viewer" );
587
+ _this->connect (a, SIGNAL (triggered ()), SLOT (createImageViewer ()));
588
+ a = Menu->addAction (" Docked Image Viewer" );
589
+ _this->connect (a, SIGNAL (triggered ()), SLOT (createImageViewer ()));
590
+ a = Menu->addAction (" Pinned Image Viewer" );
591
+ _this->connect (a, SIGNAL (triggered ()), SLOT (createImageViewer ()));
592
+
593
+
578
594
ui.menuTests ->addSeparator ();
579
595
a = ui.menuTests ->addAction (" Show Status Dialog" );
580
596
_this->connect (a, SIGNAL (triggered ()), SLOT (showStatusDialog ()));
@@ -587,6 +603,7 @@ void MainWindowPrivate::createActions()
587
603
a->setToolTip (" Applies a Visual Studio light style (visual_studio_light.css)." );
588
604
a->setIcon (svgIcon (" :/adsdemo/images/color_lens.svg" ));
589
605
QObject::connect (a, &QAction::triggered, _this, &CMainWindow::applyVsStyle);
606
+ ui.menuTests ->addAction (a);
590
607
}
591
608
592
609
@@ -902,3 +919,34 @@ void CMainWindow::applyVsStyle()
902
919
d->DockManager ->setStyleSheet (Stylesheet);
903
920
}
904
921
922
+
923
+ // ============================================================================
924
+ void CMainWindow::createImageViewer ()
925
+ {
926
+ QAction* a = qobject_cast<QAction*>(sender ());
927
+ qDebug () << " createImageViewer " << a->text ();
928
+
929
+ auto DockWidget = d->createImageViewer ();
930
+ DockWidget->setFeature (ads::CDockWidget::DockWidgetDeleteOnClose, true );
931
+ DockWidget->setFeature (ads::CDockWidget::DockWidgetForceCloseWithArea, true );
932
+ DockWidget->setFeature (ads::CDockWidget::CustomCloseHandling, true );
933
+ DockWidget->resize (QSize (640 , 480 ));
934
+ connect (DockWidget, &ads::CDockWidget::closeRequested, [this ](){
935
+ qDebug () << " ImageViewer close requested" ;
936
+ });
937
+
938
+ if (a->text ().startsWith (" Floating" ))
939
+ {
940
+ auto FloatingWidget = d->DockManager ->addDockWidgetFloating (DockWidget);
941
+ FloatingWidget->move (QPoint (20 , 20 ));
942
+ }
943
+ else if (a->text ().startsWith (" Docked" ))
944
+ {
945
+ d->DockManager ->addDockWidget (ads::RightDockWidgetArea, DockWidget);
946
+ }
947
+ else if (a->text ().startsWith (" Pinned" ))
948
+ {
949
+ d->DockManager ->addAutoHideDockWidget (ads::SideBarLeft, DockWidget);
950
+ }
951
+ }
952
+
0 commit comments