@@ -456,13 +456,21 @@ void MainWindowPrivate::createActions()
456456 ui.toolBar ->addAction (PerspectiveListAction);
457457 ui.toolBar ->addAction (SavePerspectiveAction);
458458
459- QAction* a = ui.toolBar ->addAction (" Create Editor" );
459+ QAction* a = ui.toolBar ->addAction (" Create Floating Editor" );
460+ a->setProperty (" Floating" , true );
460461 a->setToolTip (" Creates floating dynamic dockable editor windows that are deleted on close" );
461462 a->setIcon (svgIcon (" :/adsdemo/images/note_add.svg" ));
462463 _this->connect (a, SIGNAL (triggered ()), SLOT (createEditor ()));
463464 ui.menuTests ->addAction (a);
464465
465- a = ui.toolBar ->addAction (" Create Table" );
466+ a = ui.toolBar ->addAction (" Create Docked Editor" );
467+ a->setProperty (" Floating" , false );
468+ a->setToolTip (" Creates a docked editor windows that are deleted on close" );
469+ a->setIcon (svgIcon (" :/adsdemo/images/docked_editor.svg" ));
470+ _this->connect (a, SIGNAL (triggered ()), SLOT (createEditor ()));
471+ ui.menuTests ->addAction (a);
472+
473+ a = ui.toolBar ->addAction (" Create Floating Table" );
466474 a->setToolTip (" Creates floating dynamic dockable table with millions of entries" );
467475 a->setIcon (svgIcon (" :/adsdemo/images/grid_on.svg" ));
468476 _this->connect (a, SIGNAL (triggered ()), SLOT (createTable ()));
@@ -661,11 +669,22 @@ void CMainWindow::onViewVisibilityChanged(bool Visible)
661669// ============================================================================
662670void CMainWindow::createEditor ()
663671{
672+ QObject* Sender = sender ();
673+ QVariant vFloating = Sender->property (" Floating" );
674+ bool Floating = vFloating.isValid () ? vFloating.toBool () : true ;
664675 auto DockWidget = createEditorWidget (d->ui .menuView );
665676 DockWidget->setFeature (ads::CDockWidget::DockWidgetDeleteOnClose, true );
666- auto FloatingWidget = d->DockManager ->addDockWidgetFloating (DockWidget);
667- FloatingWidget->move (QPoint (20 , 20 ));
668677 connect (DockWidget, SIGNAL (closeRequested ()), SLOT (onEditorCloseRequested ()));
678+
679+ if (Floating)
680+ {
681+ auto FloatingWidget = d->DockManager ->addDockWidgetFloating (DockWidget);
682+ FloatingWidget->move (QPoint (20 , 20 ));
683+ }
684+ else
685+ {
686+ d->DockManager ->addDockWidget (ads::TopDockWidgetArea, DockWidget);
687+ }
669688}
670689
671690
0 commit comments