Skip to content

Commit

Permalink
Added new test action for adding docked editor widget to test fix for…
Browse files Browse the repository at this point in the history
… issue #148
  • Loading branch information
githubuser0xFFFF committed May 7, 2020
1 parent cb18bc0 commit b7e7c0c
Show file tree
Hide file tree
Showing 5 changed files with 192 additions and 4 deletions.
27 changes: 23 additions & 4 deletions demo/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,13 +456,21 @@ void MainWindowPrivate::createActions()
ui.toolBar->addAction(PerspectiveListAction);
ui.toolBar->addAction(SavePerspectiveAction);

QAction* a = ui.toolBar->addAction("Create Editor");
QAction* a = ui.toolBar->addAction("Create Floating Editor");
a->setProperty("Floating", true);
a->setToolTip("Creates floating dynamic dockable editor windows that are deleted on close");
a->setIcon(svgIcon(":/adsdemo/images/note_add.svg"));
_this->connect(a, SIGNAL(triggered()), SLOT(createEditor()));
ui.menuTests->addAction(a);

a = ui.toolBar->addAction("Create Table");
a = ui.toolBar->addAction("Create Docked Editor");
a->setProperty("Floating", false);
a->setToolTip("Creates a docked editor windows that are deleted on close");
a->setIcon(svgIcon(":/adsdemo/images/docked_editor.svg"));
_this->connect(a, SIGNAL(triggered()), SLOT(createEditor()));
ui.menuTests->addAction(a);

a = ui.toolBar->addAction("Create Floating Table");
a->setToolTip("Creates floating dynamic dockable table with millions of entries");
a->setIcon(svgIcon(":/adsdemo/images/grid_on.svg"));
_this->connect(a, SIGNAL(triggered()), SLOT(createTable()));
Expand Down Expand Up @@ -661,11 +669,22 @@ void CMainWindow::onViewVisibilityChanged(bool Visible)
//============================================================================
void CMainWindow::createEditor()
{
QObject* Sender = sender();
QVariant vFloating = Sender->property("Floating");
bool Floating = vFloating.isValid() ? vFloating.toBool() : true;
auto DockWidget = createEditorWidget(d->ui.menuView);
DockWidget->setFeature(ads::CDockWidget::DockWidgetDeleteOnClose, true);
auto FloatingWidget = d->DockManager->addDockWidgetFloating(DockWidget);
FloatingWidget->move(QPoint(20, 20));
connect(DockWidget, SIGNAL(closeRequested()), SLOT(onEditorCloseRequested()));

if (Floating)
{
auto FloatingWidget = d->DockManager->addDockWidgetFloating(DockWidget);
FloatingWidget->move(QPoint(20, 20));
}
else
{
d->DockManager->addDockWidget(ads::TopDockWidgetArea, DockWidget);
}
}


Expand Down
3 changes: 3 additions & 0 deletions demo/demo.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
<file>images/plus.svg</file>
<file>images/help_outline.svg</file>
<file>images/fullscreen.svg</file>
<file>images/create_floating_editor.svg</file>
<file>images/create_floating_table.svg</file>
<file>images/docked_editor.svg</file>
</qresource>
</RCC>
80 changes: 80 additions & 0 deletions demo/images/create_floating_editor.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
80 changes: 80 additions & 0 deletions demo/images/create_floating_table.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions demo/images/docked_editor.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b7e7c0c

Please sign in to comment.