Added new test action for adding docked editor widget to test fix for issue #148

This commit is contained in:
Uwe Kindler 2020-05-07 16:14:59 +02:00
parent cb18bc0d91
commit b7e7c0ccc3
5 changed files with 192 additions and 4 deletions

View File

@ -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()));
@ -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);
}
}

View File

@ -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>

View File

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
viewBox="0,0,1024,1024"
id="svg2562"
sodipodi:docname="create_floating_editor.svg"
inkscape:version="0.92.4 (5da689c313, 2019-01-14)">
<metadata
id="metadata2568">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs2566" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1017"
id="namedview2564"
showgrid="false"
inkscape:zoom="0.23046875"
inkscape:cx="512"
inkscape:cy="512"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg2562" />
<desc
id="desc2556">note_add icon - Licensed under Apache License v2.0 (http://www.apache.org/licenses/LICENSE-2.0) - Created with Iconfu.com - Derivative work of Material icons (Copyright Google Inc.)</desc>
<g
style="mix-blend-mode:normal;fill:#03b8e5;fill-rule:nonzero"
id="g2560"
transform="matrix(0.73242903,0,0,0.73242903,136.99634,136.99634)">
<path
d="m 853.33,341.33 v 512 c 0,46.93 -38.4,85.34 -85.33,85.34 H 255.57 c -46.93,0 -84.9,-38.41 -84.9,-85.34 l 0.42,-682.66 c 0,-46.93 37.98,-85.34 84.91,-85.34 h 341.33 z m -170.66,256 h -128 v -128 h -85.34 v 128 h -128 v 85.34 h 128 v 128 h 85.34 v -128 h 128 z M 789.33,384 554.67,149.33 V 384 Z"
id="path2558"
inkscape:connector-curvature="0" />
</g>
<path
style="mix-blend-mode:normal;fill:#03b8e5;fill-rule:nonzero"
d="M 426.6699,917.33988 512.4297,1024 597.3301,917.33988 Z"
id="path3115"
inkscape:connector-curvature="0" />
<path
style="mix-blend-mode:normal;fill:#03b8e5;fill-rule:nonzero"
d="M 426.6699,106.66012 512.4297,0 597.3301,106.66012 Z"
id="path3115-7"
inkscape:connector-curvature="0" />
<path
style="mix-blend-mode:normal;fill:#03b8e5;fill-rule:nonzero"
d="M 917.33988,426.6699 1024,512.4297 917.33988,597.3301 Z"
id="path3115-7-9"
inkscape:connector-curvature="0" />
<path
style="mix-blend-mode:normal;fill:#03b8e5;fill-rule:nonzero"
d="M 106.66016,426.6699 0,512.4297 106.66016,597.3301 Z"
id="path3115-7-9-4"
inkscape:connector-curvature="0" />
</svg>

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
viewBox="0,0,1024,1024"
id="svg2562"
sodipodi:docname="create_floating_table.svg"
inkscape:version="0.92.4 (5da689c313, 2019-01-14)">
<metadata
id="metadata2568">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs2566" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1017"
id="namedview2564"
showgrid="false"
inkscape:zoom="0.23046875"
inkscape:cx="512"
inkscape:cy="512"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg2562" />
<desc
id="desc2556">note_add icon - Licensed under Apache License v2.0 (http://www.apache.org/licenses/LICENSE-2.0) - Created with Iconfu.com - Derivative work of Material icons (Copyright Google Inc.)</desc>
<path
style="mix-blend-mode:normal;fill:#03b8e5;fill-rule:nonzero"
d="M 426.6699,917.33988 512.4297,1024 597.3301,917.33988 Z"
id="path3115"
inkscape:connector-curvature="0" />
<path
style="mix-blend-mode:normal;fill:#03b8e5;fill-rule:nonzero"
d="M 426.6699,106.66012 512.4297,0 597.3301,106.66012 Z"
id="path3115-7"
inkscape:connector-curvature="0" />
<path
style="mix-blend-mode:normal;fill:#03b8e5;fill-rule:nonzero"
d="M 917.33988,426.6699 1024,512.4297 917.33988,597.3301 Z"
id="path3115-7-9"
inkscape:connector-curvature="0" />
<path
style="mix-blend-mode:normal;fill:#03b8e5;fill-rule:nonzero"
d="M 106.66016,426.6699 0,512.4297 106.66016,597.3301 Z"
id="path3115-7-9-4"
inkscape:connector-curvature="0" />
<g
id="g3198"
style="mix-blend-mode:normal;fill:#03b8e5;fill-rule:nonzero"
transform="matrix(0.73241615,0,0,0.73241615,137.00293,137.00293)">
<path
id="path3196"
d="m 938.67,170.67 v 682.66 c 0,46.93 -38.41,85.34 -85.34,85.34 H 170.67 c -46.93,0 -85.34,-38.41 -85.34,-85.34 V 170.67 c 0,-46.93 38.41,-85.34 85.34,-85.34 h 682.66 c 46.93,0 85.34,38.41 85.34,85.34 z m -597.34,0 H 170.67 v 170.66 h 170.66 z m 0,512 H 170.67 v 170.66 h 170.66 z m 0,-256 H 170.67 v 170.66 h 170.66 z m 256,-256 H 426.67 v 170.66 h 170.66 z m 256,0 H 682.67 v 170.66 h 170.66 z m -256,512 H 426.67 v 170.66 h 170.66 z m 0,-256 H 426.67 v 170.66 h 170.66 z m 256,256 H 682.67 v 170.66 h 170.66 z m 0,-256 H 682.67 v 170.66 h 170.66 z"
inkscape:connector-curvature="0" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -0,0 +1,6 @@
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0,0,1024,1024">
<desc>chrome_reader_mode icon - Licensed under Apache License v2.0 (http://www.apache.org/licenses/LICENSE-2.0) - Created with Iconfu.com - Derivative work of Material icons (Copyright Google Inc.)</desc>
<g fill="#03b8e5" fill-rule="nonzero" style="mix-blend-mode: normal">
<path d="M981.33,256v554.67c0,46.93 -38.4,85.33 -85.33,85.33h-768c-46.93,0 -85.33,-38.4 -85.33,-85.33v-554.67c0,-46.93 38.4,-85.33 85.33,-85.33h768c46.93,0 85.33,38.4 85.33,85.33zM896,256h-384v554.67h384zM554.67,512h298.66v64h-298.66zM554.67,405.33h298.66v64h-298.66zM554.67,618.67h298.66v64h-298.66z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 717 B