Added support for dock widget feature DockWidgetDeleteOnClose, added toolbar action for creation of dynamic editors to demo appication, added new material design icons to improve demo gui
@ -24,6 +24,7 @@ set(ads_demo_SRCS
|
|||||||
main.cpp
|
main.cpp
|
||||||
MainWindow.cpp
|
MainWindow.cpp
|
||||||
mainwindow.ui
|
mainwindow.ui
|
||||||
|
demo.qrc
|
||||||
)
|
)
|
||||||
add_executable(AdvancedDockingSystemDemo WIN32 ${ads_demo_SRCS})
|
add_executable(AdvancedDockingSystemDemo WIN32 ${ads_demo_SRCS})
|
||||||
if(BUILD_STATIC)
|
if(BUILD_STATIC)
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
#include <QRubberBand>
|
#include <QRubberBand>
|
||||||
|
#include <QPlainTextEdit>
|
||||||
|
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QElapsedTimer>
|
#include <QElapsedTimer>
|
||||||
@ -115,6 +116,18 @@ static void appendFeaturStringToWindowTitle(ads::CDockWidget* DockWidget)
|
|||||||
+ QString(" (%1)").arg(featuresString(DockWidget)));
|
+ QString(" (%1)").arg(featuresString(DockWidget)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function to create an SVG icon
|
||||||
|
*/
|
||||||
|
static QIcon svgIcon(const QString& File)
|
||||||
|
{
|
||||||
|
// This is a workaround, because because in item views SVG icons are not
|
||||||
|
// properly scaled an look blurry or pixelate
|
||||||
|
QIcon SvgIcon(File);
|
||||||
|
SvgIcon.addPixmap(SvgIcon.pixmap(92));
|
||||||
|
return SvgIcon;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
static ads::CDockWidget* createCalendarDockWidget(QMenu* ViewMenu)
|
static ads::CDockWidget* createCalendarDockWidget(QMenu* ViewMenu)
|
||||||
@ -124,6 +137,7 @@ static ads::CDockWidget* createCalendarDockWidget(QMenu* ViewMenu)
|
|||||||
ads::CDockWidget* DockWidget = new ads::CDockWidget(QString("Calendar %1").arg(CalendarCount++));
|
ads::CDockWidget* DockWidget = new ads::CDockWidget(QString("Calendar %1").arg(CalendarCount++));
|
||||||
DockWidget->setWidget(w);
|
DockWidget->setWidget(w);
|
||||||
DockWidget->setToggleViewActionMode(ads::CDockWidget::ActionModeShow);
|
DockWidget->setToggleViewActionMode(ads::CDockWidget::ActionModeShow);
|
||||||
|
DockWidget->setIcon(svgIcon(":/adsdemo/images/date_range.svg"));
|
||||||
ViewMenu->addAction(DockWidget->toggleViewAction());
|
ViewMenu->addAction(DockWidget->toggleViewAction());
|
||||||
return DockWidget;
|
return DockWidget;
|
||||||
}
|
}
|
||||||
@ -199,7 +213,6 @@ void MainWindowPrivate::createContent()
|
|||||||
// Test container docking
|
// Test container docking
|
||||||
QMenu* ViewMenu = ui.menuView;
|
QMenu* ViewMenu = ui.menuView;
|
||||||
auto DockWidget = createCalendarDockWidget(ViewMenu);
|
auto DockWidget = createCalendarDockWidget(ViewMenu);
|
||||||
DockWidget->setIcon(_this->style()->standardIcon(QStyle::SP_DialogOpenButton));
|
|
||||||
DockWidget->setFeature(ads::CDockWidget::DockWidgetClosable, false);
|
DockWidget->setFeature(ads::CDockWidget::DockWidgetClosable, false);
|
||||||
DockManager->addDockWidget(ads::LeftDockWidgetArea, DockWidget);
|
DockManager->addDockWidget(ads::LeftDockWidgetArea, DockWidget);
|
||||||
DockManager->addDockWidget(ads::LeftDockWidgetArea, createLongTextLabelDockWidget(ViewMenu));
|
DockManager->addDockWidget(ads::LeftDockWidgetArea, createLongTextLabelDockWidget(ViewMenu));
|
||||||
@ -229,17 +242,9 @@ void MainWindowPrivate::createContent()
|
|||||||
DockManager->addDockWidget(ads::RightDockWidgetArea, createLongTextLabelDockWidget(ViewMenu), RighDockArea);
|
DockManager->addDockWidget(ads::RightDockWidgetArea, createLongTextLabelDockWidget(ViewMenu), RighDockArea);
|
||||||
DockManager->addDockWidget(ads::CenterDockWidgetArea, createLongTextLabelDockWidget(ViewMenu), BottomDockArea);
|
DockManager->addDockWidget(ads::CenterDockWidgetArea, createLongTextLabelDockWidget(ViewMenu), BottomDockArea);
|
||||||
|
|
||||||
// Test creation of floating dock widgets
|
|
||||||
DockWidget = createFileSystemTreeDockWidget(ViewMenu);
|
|
||||||
auto FloatingWidget = DockManager->addDockWidgetFloating(DockWidget);
|
|
||||||
FloatingWidget->move(QPoint(20, 20));
|
|
||||||
FloatingWidget = DockManager->addDockWidgetFloating(createLongTextLabelDockWidget(ViewMenu));
|
|
||||||
FloatingWidget->move(QPoint(100, 100));
|
|
||||||
|
|
||||||
auto Action = ui.menuView->addAction(QString("Set %1 floating").arg(DockWidget->windowTitle()));
|
auto Action = ui.menuView->addAction(QString("Set %1 floating").arg(DockWidget->windowTitle()));
|
||||||
DockWidget->connect(Action, SIGNAL(triggered()), SLOT(setFloating()));
|
DockWidget->connect(Action, SIGNAL(triggered()), SLOT(setFloating()));
|
||||||
|
|
||||||
|
|
||||||
for (auto DockWidget : DockManager->dockWidgetsMap())
|
for (auto DockWidget : DockManager->dockWidgetsMap())
|
||||||
{
|
{
|
||||||
_this->connect(DockWidget, SIGNAL(viewToggled(bool)), SLOT(onViewToggled(bool)));
|
_this->connect(DockWidget, SIGNAL(viewToggled(bool)), SLOT(onViewToggled(bool)));
|
||||||
@ -251,11 +256,13 @@ void MainWindowPrivate::createContent()
|
|||||||
void MainWindowPrivate::createActions()
|
void MainWindowPrivate::createActions()
|
||||||
{
|
{
|
||||||
ui.toolBar->addAction(ui.actionSaveState);
|
ui.toolBar->addAction(ui.actionSaveState);
|
||||||
ui.actionSaveState->setIcon(_this->style()->standardIcon(QStyle::SP_DialogSaveButton));
|
ui.toolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
||||||
|
ui.actionSaveState->setIcon(svgIcon(":/adsdemo/images/save.svg"));
|
||||||
ui.toolBar->addAction(ui.actionRestoreState);
|
ui.toolBar->addAction(ui.actionRestoreState);
|
||||||
ui.actionRestoreState->setIcon(_this->style()->standardIcon(QStyle::SP_DialogOpenButton));
|
ui.actionRestoreState->setIcon(svgIcon(":/adsdemo/images/restore.svg"));
|
||||||
|
|
||||||
SavePerspectiveAction = new QAction("Save Perspective", _this);
|
SavePerspectiveAction = new QAction("Create Perspective", _this);
|
||||||
|
SavePerspectiveAction->setIcon(svgIcon(":/adsdemo/images/picture_in_picture.svg"));
|
||||||
_this->connect(SavePerspectiveAction, SIGNAL(triggered()), SLOT(savePerspective()));
|
_this->connect(SavePerspectiveAction, SIGNAL(triggered()), SLOT(savePerspective()));
|
||||||
PerspectiveListAction = new QWidgetAction(_this);
|
PerspectiveListAction = new QWidgetAction(_this);
|
||||||
PerspectiveComboBox = new QComboBox(_this);
|
PerspectiveComboBox = new QComboBox(_this);
|
||||||
@ -265,6 +272,11 @@ void MainWindowPrivate::createActions()
|
|||||||
ui.toolBar->addSeparator();
|
ui.toolBar->addSeparator();
|
||||||
ui.toolBar->addAction(PerspectiveListAction);
|
ui.toolBar->addAction(PerspectiveListAction);
|
||||||
ui.toolBar->addAction(SavePerspectiveAction);
|
ui.toolBar->addAction(SavePerspectiveAction);
|
||||||
|
|
||||||
|
QAction* a = ui.toolBar->addAction("Create Editor");
|
||||||
|
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()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -410,3 +422,23 @@ void CMainWindow::onViewToggled(bool Open)
|
|||||||
qDebug() << DockWidget->objectName() << " viewToggled(" << Open << ")";
|
qDebug() << DockWidget->objectName() << " viewToggled(" << Open << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void CMainWindow::createEditor()
|
||||||
|
{
|
||||||
|
static int EditorCount = 0;
|
||||||
|
QPlainTextEdit* w = new QPlainTextEdit();
|
||||||
|
w->setPlaceholderText("This is an editor. If you close the editor, it will be "
|
||||||
|
"deleted. Enter your text here.");
|
||||||
|
w->setStyleSheet("border: none");
|
||||||
|
ads::CDockWidget* DockWidget = new ads::CDockWidget(QString("Editor %1").arg(EditorCount++));
|
||||||
|
DockWidget->setWidget(w);
|
||||||
|
DockWidget->setToggleViewActionMode(ads::CDockWidget::ActionModeShow);
|
||||||
|
DockWidget->setIcon(svgIcon(":/adsdemo/images/edit.svg"));
|
||||||
|
DockWidget->setFeature(ads::CDockWidget::DockWidgetDeleteOnClose, true);
|
||||||
|
d->ui.menuView->addAction(DockWidget->toggleViewAction());
|
||||||
|
|
||||||
|
auto FloatingWidget = d->DockManager->addDockWidgetFloating(DockWidget);
|
||||||
|
FloatingWidget->move(QPoint(20, 20));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -59,6 +59,7 @@ private slots:
|
|||||||
void on_actionRestoreState_triggered(bool);
|
void on_actionRestoreState_triggered(bool);
|
||||||
void savePerspective();
|
void savePerspective();
|
||||||
void onViewToggled(bool Open);
|
void onViewToggled(bool Open);
|
||||||
|
void createEditor();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
@ -21,6 +21,8 @@ HEADERS += \
|
|||||||
FORMS += \
|
FORMS += \
|
||||||
mainwindow.ui
|
mainwindow.ui
|
||||||
|
|
||||||
|
RESOURCES += demo.qrc
|
||||||
|
|
||||||
|
|
||||||
LIBS += -L$${ADS_OUT_ROOT}/lib
|
LIBS += -L$${ADS_OUT_ROOT}/lib
|
||||||
|
|
||||||
|
12
demo/demo.qrc
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<RCC>
|
||||||
|
<qresource prefix="/adsdemo">
|
||||||
|
<file>images/folder.svg</file>
|
||||||
|
<file>images/folder_open.svg</file>
|
||||||
|
<file>images/note_add.svg</file>
|
||||||
|
<file>images/picture_in_picture.svg</file>
|
||||||
|
<file>images/restore.svg</file>
|
||||||
|
<file>images/save.svg</file>
|
||||||
|
<file>images/date_range.svg</file>
|
||||||
|
<file>images/edit.svg</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
6
demo/images/date_range.svg
Normal 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>date_range 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="M896,256v597.33c0,46.93 -38.4,85.34 -85.33,85.34h-597.34c-47.36,0 -85.33,-38.41 -85.33,-85.34l0.43,-597.33c0,-46.93 37.54,-85.33 84.9,-85.33h42.67v-85.34h85.33v85.34h341.34v-85.34h85.33v85.34h42.67c46.93,0 85.33,38.4 85.33,85.33zM810.67,384h-597.34v469.33h597.34zM384,554.67h-85.33v-85.34h85.33zM554.67,554.67h-85.34v-85.34h85.34zM725.33,554.67h-85.33v-85.34h85.33z"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 783 B |
6
demo/images/edit.svg
Normal 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>create 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="M599.89,264.11l160,160l-471.89,471.89h-160v-160zM805.55,378.45l-160,-160l78.08,-78.08c16.64,-16.64 43.52,-16.64 60.16,0l99.84,99.84c16.64,16.64 16.64,43.52 0,60.16z"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 578 B |
6
demo/images/folder.svg
Normal 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>folder 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="M512,256h341.33c46.93,0 85.34,38.4 85.34,85.33v426.67c0,46.93 -38.41,85.33 -85.34,85.33h-682.66c-46.93,0 -85.34,-38.4 -85.34,-85.33l0.43,-512c0,-46.93 37.98,-85.33 84.91,-85.33h256z"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 595 B |
6
demo/images/folder_open.svg
Normal 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>folder_open 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="M938.67,341.33v426.67c0,46.93 -38.41,85.33 -85.34,85.33h-682.66c-46.93,0 -85.34,-38.4 -85.34,-85.33l0.43,-512c0,-46.93 37.98,-85.33 84.91,-85.33h256l85.33,85.33h341.33c46.93,0 85.34,38.4 85.34,85.33zM853.33,341.33h-682.66v426.67h682.66z"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 655 B |
211
demo/images/material_icons_license.txt
Normal file
@ -0,0 +1,211 @@
|
|||||||
|
The Google Material icons and modifications can be used free of charge for
|
||||||
|
commerical and non-commerical projects according to the Apache License 2.0.
|
||||||
|
|
||||||
|
An attribution to https://material.io/icons/ and/or https://iconfu.com on
|
||||||
|
your website or in your app's "about" screen would be wonderful.
|
||||||
|
|
||||||
|
Please do not re-sell the icons.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
6
demo/images/note_add.svg
Normal 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>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 fill="#03b8e5" fill-rule="nonzero" style="mix-blend-mode: normal">
|
||||||
|
<path d="M853.33,341.33v512c0,46.93 -38.4,85.34 -85.33,85.34h-512.43c-46.93,0 -84.9,-38.41 -84.9,-85.34l0.42,-682.66c0,-46.93 37.98,-85.34 84.91,-85.34h341.33zM682.67,597.33h-128v-128h-85.34v128h-128v85.34h128v128h85.34v-128h128zM789.33,384l-234.66,-234.67v234.67z"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 671 B |
6
demo/images/picture_in_picture.svg
Normal 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>picture_in_picture 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,213.33v597.34c0,46.93 -38.4,84.48 -85.33,84.48h-768c-46.93,0 -85.33,-37.55 -85.33,-84.48v-597.34c0,-46.93 38.4,-85.33 85.33,-85.33h768c46.93,0 85.33,38.4 85.33,85.33zM896,212.48h-768v598.61h768zM810.67,554.67h-341.34v-256h341.34z"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 663 B |
6
demo/images/restore.svg
Normal 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>restore 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="M938.67,512c0,212.05 -171.95,384 -384,384c-106.24,0 -201.81,-43.09 -271.36,-112.64l60.58,-60.59c53.76,54.19 128.43,87.9 210.78,87.9c165.12,0 298.66,-133.55 298.66,-298.67c0,-165.12 -133.54,-298.67 -298.66,-298.67c-165.12,0 -298.67,133.55 -298.67,298.67h128l-172.37,171.95l-2.99,-5.98l-165.97,-165.97h128c0,-212.05 171.95,-384 384,-384c212.05,0 384,171.95 384,384zM576,341.33v181.34l149.33,88.74l-30.72,51.63l-182.61,-108.37v-213.34z"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 847 B |
6
demo/images/save.svg
Normal 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>save 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="M896,298.67v512c0,46.93 -38.4,85.33 -85.33,85.33h-597.34c-47.36,0 -85.33,-38.4 -85.33,-85.33v-597.34c0,-46.93 37.97,-85.33 85.33,-85.33h512zM640,213.33h-426.67v170.67h426.67zM640,682.67c0,-70.83 -57.17,-128 -128,-128c-70.83,0 -128,57.17 -128,128c0,70.83 57.17,128 128,128c70.83,0 128,-57.17 128,-128z"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 712 B |
@ -491,7 +491,15 @@ void CDockAreaWidget::hideAreaWithNoVisibleContent()
|
|||||||
void CDockAreaWidget::onTabCloseRequested(int Index)
|
void CDockAreaWidget::onTabCloseRequested(int Index)
|
||||||
{
|
{
|
||||||
ADS_PRINT("CDockAreaWidget::onTabCloseRequested " << Index);
|
ADS_PRINT("CDockAreaWidget::onTabCloseRequested " << Index);
|
||||||
dockWidget(Index)->toggleView(false);
|
auto* DockWidget = dockWidget(Index);
|
||||||
|
if (DockWidget->features().testFlag(CDockWidget::DockWidgetDeleteOnClose))
|
||||||
|
{
|
||||||
|
DockWidget->deleteDockWidget();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DockWidget->toggleView(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -650,8 +650,10 @@ CDockWidget* CDockManager::findDockWidget(const QString& ObjectName) const
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
void CDockManager::removeDockWidget(CDockWidget* Dockwidget)
|
void CDockManager::removeDockWidget(CDockWidget* Dockwidget)
|
||||||
{
|
{
|
||||||
|
emit dockWidgetAboutToBeRemoved(Dockwidget);
|
||||||
d->DockWidgetsMap.remove(Dockwidget->objectName());
|
d->DockWidgetsMap.remove(Dockwidget->objectName());
|
||||||
CDockContainerWidget::removeDockWidget(Dockwidget);
|
CDockContainerWidget::removeDockWidget(Dockwidget);
|
||||||
|
emit dockWidgetRemoved(Dockwidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
@ -440,6 +440,20 @@ signals:
|
|||||||
* tooltips for the DockArea buttons.
|
* tooltips for the DockArea buttons.
|
||||||
*/
|
*/
|
||||||
void dockAreaCreated(CDockAreaWidget* DockArea);
|
void dockAreaCreated(CDockAreaWidget* DockArea);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This signal is emitted just before the given dock widget is removed
|
||||||
|
* from the
|
||||||
|
*/
|
||||||
|
void dockWidgetAboutToBeRemoved(CDockWidget* DockWidget);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This signal is emitted if a dock widget has been removed with the remove
|
||||||
|
* removeDockWidget() function.
|
||||||
|
* If this signal is emitted, the dock widget has been removed from the
|
||||||
|
* docking system but it is not deleted yet.
|
||||||
|
*/
|
||||||
|
void dockWidgetRemoved(CDockWidget* DockWidget);
|
||||||
}; // class DockManager
|
}; // class DockManager
|
||||||
} // namespace ads
|
} // namespace ads
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -737,6 +737,14 @@ void CDockWidget::setFloating()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void CDockWidget::deleteDockWidget()
|
||||||
|
{
|
||||||
|
dockManager()->removeDockWidget(this);
|
||||||
|
deleteLater();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace ads
|
} // namespace ads
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -143,6 +143,7 @@ public:
|
|||||||
DockWidgetClosable = 0x01,
|
DockWidgetClosable = 0x01,
|
||||||
DockWidgetMovable = 0x02,///< this feature is not properly implemented yet and is ignored
|
DockWidgetMovable = 0x02,///< this feature is not properly implemented yet and is ignored
|
||||||
DockWidgetFloatable = 0x04,
|
DockWidgetFloatable = 0x04,
|
||||||
|
DockWidgetDeleteOnClose = 0x08, ///< deletes the dock widget when it is closed
|
||||||
AllDockWidgetFeatures = DockWidgetClosable | DockWidgetMovable | DockWidgetFloatable,
|
AllDockWidgetFeatures = DockWidgetClosable | DockWidgetMovable | DockWidgetFloatable,
|
||||||
NoDockWidgetFeatures = 0x00
|
NoDockWidgetFeatures = 0x00
|
||||||
};
|
};
|
||||||
@ -419,6 +420,12 @@ public slots:
|
|||||||
*/
|
*/
|
||||||
void setFloating();
|
void setFloating();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function will delete the dock widget and its content from the
|
||||||
|
* docking system
|
||||||
|
*/
|
||||||
|
void deleteDockWidget();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
/**
|
/**
|
||||||
* This signal is emitted if the dock widget is opened or closed
|
* This signal is emitted if the dock widget is opened or closed
|
||||||
|
@ -346,7 +346,6 @@ void CDockWidgetTab::mouseMoveEvent(QMouseEvent* ev)
|
|||||||
{
|
{
|
||||||
// Moving the tab is always allowed because it does not mean moving the
|
// Moving the tab is always allowed because it does not mean moving the
|
||||||
// dock widget around
|
// dock widget around
|
||||||
qDebug() << "DraggingTab";
|
|
||||||
d->moveTab(ev);
|
d->moveTab(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,6 +353,13 @@ void CFloatingDockContainer::closeEvent(QCloseEvent *event)
|
|||||||
|
|
||||||
if (isClosable())
|
if (isClosable())
|
||||||
{
|
{
|
||||||
|
auto TopLevelDockWidget = topLevelDockWidget();
|
||||||
|
if (TopLevelDockWidget && TopLevelDockWidget->features().testFlag(CDockWidget::DockWidgetDeleteOnClose))
|
||||||
|
{
|
||||||
|
TopLevelDockWidget->deleteDockWidget();
|
||||||
|
this->deleteLater();
|
||||||
|
}
|
||||||
|
|
||||||
// In Qt version after 5.9.2 there seems to be a bug that causes the
|
// In Qt version after 5.9.2 there seems to be a bug that causes the
|
||||||
// QWidget::event() function to not receive any NonClientArea mouse
|
// QWidget::event() function to not receive any NonClientArea mouse
|
||||||
// events anymore after a close/show cycle. The bug is reported here:
|
// events anymore after a close/show cycle. The bug is reported here:
|
||||||
|