forked from qt-creator/qt-creator
QmlDesigner: Integrate upstream commits
- Integrate the newest commits from the base repository dec170ed24679fd49f9fb54af91f61146838f852 34cb2ae91790fc65ca5c0f7b81bb928de22a32e5 - Cleanup a few if statements - Cleanup a comment Change-Id: I158bff610f701e7a30680cfb8383f64475199bbe Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
committed by
Henning Gründl
parent
3749979ba8
commit
9684a5f269
@@ -138,13 +138,13 @@ struct DockOverlayCrossPrivate;
|
|||||||
* You can style the cross icon using the property system.
|
* You can style the cross icon using the property system.
|
||||||
* \code
|
* \code
|
||||||
* ADS--DockOverlayCross
|
* ADS--DockOverlayCross
|
||||||
{
|
* {
|
||||||
qproperty-iconFrameColor: palette(highlight);
|
* qproperty-iconFrameColor: palette(highlight);
|
||||||
qproperty-iconBackgroundColor: palette(base);
|
* qproperty-iconBackgroundColor: palette(base);
|
||||||
qproperty-iconOverlayColor: palette(highlight);
|
* qproperty-iconOverlayColor: palette(highlight);
|
||||||
qproperty-iconArrowColor: rgb(227, 227, 227);
|
* qproperty-iconArrowColor: rgb(227, 227, 227);
|
||||||
qproperty-iconShadowColor: rgb(0, 0, 0);
|
* qproperty-iconShadowColor: rgb(0, 0, 0);
|
||||||
}
|
* }
|
||||||
* \endcode
|
* \endcode
|
||||||
* Or you can use the iconColors property to pass in AARRGGBB values as
|
* Or you can use the iconColors property to pass in AARRGGBB values as
|
||||||
* hex string like shown in the example below.
|
* hex string like shown in the example below.
|
||||||
|
@@ -154,16 +154,18 @@ namespace ADS
|
|||||||
|
|
||||||
void DockWidgetPrivate::updateParentDockArea()
|
void DockWidgetPrivate::updateParentDockArea()
|
||||||
{
|
{
|
||||||
if (!m_dockArea) {
|
if (!m_dockArea)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// we don't need to change the current tab if the current DockWidget is not the one being closed
|
||||||
|
if (m_dockArea->currentDockWidget() != q)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
auto nextDockWidget = m_dockArea->nextOpenDockWidget(q);
|
auto nextDockWidget = m_dockArea->nextOpenDockWidget(q);
|
||||||
if (nextDockWidget) {
|
if (nextDockWidget)
|
||||||
m_dockArea->setCurrentDockWidget(nextDockWidget);
|
m_dockArea->setCurrentDockWidget(nextDockWidget);
|
||||||
} else {
|
else
|
||||||
m_dockArea->hideAreaWithNoVisibleContent();
|
m_dockArea->hideAreaWithNoVisibleContent();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DockWidgetPrivate::setupToolBar()
|
void DockWidgetPrivate::setupToolBar()
|
||||||
@@ -222,9 +224,8 @@ namespace ADS
|
|||||||
QScrollArea *scrollAreaWidget = qobject_cast<QScrollArea *>(widget);
|
QScrollArea *scrollAreaWidget = qobject_cast<QScrollArea *>(widget);
|
||||||
if (scrollAreaWidget || ForceNoScrollArea == insertMode) {
|
if (scrollAreaWidget || ForceNoScrollArea == insertMode) {
|
||||||
d->m_layout->addWidget(widget);
|
d->m_layout->addWidget(widget);
|
||||||
if (scrollAreaWidget && scrollAreaWidget->viewport()) {
|
if (scrollAreaWidget && scrollAreaWidget->viewport())
|
||||||
scrollAreaWidget->viewport()->setProperty("dockWidgetContent", true);
|
scrollAreaWidget->viewport()->setProperty("dockWidgetContent", true);
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
d->setupScrollArea();
|
d->setupScrollArea();
|
||||||
d->m_scrollArea->setWidget(widget);
|
d->m_scrollArea->setWidget(widget);
|
||||||
@@ -283,9 +284,8 @@ namespace ADS
|
|||||||
|
|
||||||
bool DockWidget::isFloating() const
|
bool DockWidget::isFloating() const
|
||||||
{
|
{
|
||||||
if (!isInFloatingContainer()) {
|
if (!isInFloatingContainer())
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
return dockContainer()->topLevelDockWidget() == this;
|
return dockContainer()->topLevelDockWidget() == this;
|
||||||
}
|
}
|
||||||
@@ -293,13 +293,11 @@ namespace ADS
|
|||||||
bool DockWidget::isInFloatingContainer() const
|
bool DockWidget::isInFloatingContainer() const
|
||||||
{
|
{
|
||||||
auto container = dockContainer();
|
auto container = dockContainer();
|
||||||
if (!container) {
|
if (!container)
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
if (!container->isFloating()) {
|
if (!container->isFloating())
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -324,17 +322,16 @@ namespace ADS
|
|||||||
// If the toggle view action mode is ActionModeShow, then Open is always
|
// If the toggle view action mode is ActionModeShow, then Open is always
|
||||||
// true if the sender is the toggle view action
|
// true if the sender is the toggle view action
|
||||||
QAction *action = qobject_cast<QAction *>(sender());
|
QAction *action = qobject_cast<QAction *>(sender());
|
||||||
if (action == d->m_toggleViewAction && !d->m_toggleViewAction->isCheckable()) {
|
if (action == d->m_toggleViewAction && !d->m_toggleViewAction->isCheckable())
|
||||||
open = true;
|
open = true;
|
||||||
}
|
|
||||||
// If the dock widget state is different, then we really need to toggle
|
// If the dock widget state is different, then we really need to toggle
|
||||||
// the state. If we are in the right state, then we simply make this
|
// the state. If we are in the right state, then we simply make this
|
||||||
// dock widget the current dock widget
|
// dock widget the current dock widget
|
||||||
if (d->m_closed != !open) {
|
if (d->m_closed != !open)
|
||||||
toggleViewInternal(open);
|
toggleViewInternal(open);
|
||||||
} else if (open && d->m_dockArea) {
|
else if (open && d->m_dockArea)
|
||||||
d->m_dockArea->setCurrentDockWidget(this);
|
d->m_dockArea->setCurrentDockWidget(this);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DockWidget::toggleViewInternal(bool open)
|
void DockWidget::toggleViewInternal(bool open)
|
||||||
@@ -353,13 +350,11 @@ namespace ADS
|
|||||||
//d->m_toggleViewAction->blockSignals(true);
|
//d->m_toggleViewAction->blockSignals(true);
|
||||||
d->m_toggleViewAction->setChecked(open);
|
d->m_toggleViewAction->setChecked(open);
|
||||||
//d->m_toggleViewAction->blockSignals(false);
|
//d->m_toggleViewAction->blockSignals(false);
|
||||||
if (d->m_dockArea) {
|
if (d->m_dockArea)
|
||||||
d->m_dockArea->toggleDockWidgetView(this, open);
|
d->m_dockArea->toggleDockWidgetView(this, open);
|
||||||
}
|
|
||||||
|
|
||||||
if (open && topLevelDockWidgetBefore) {
|
if (open && topLevelDockWidgetBefore)
|
||||||
DockWidget::emitTopLevelEventForWidget(topLevelDockWidgetBefore, false);
|
DockWidget::emitTopLevelEventForWidget(topLevelDockWidgetBefore, false);
|
||||||
}
|
|
||||||
|
|
||||||
// Here we need to call the dockContainer() function again, because if
|
// Here we need to call the dockContainer() function again, because if
|
||||||
// this dock widget was unassigned before the call to showDockWidget() then
|
// this dock widget was unassigned before the call to showDockWidget() then
|
||||||
@@ -370,13 +365,12 @@ namespace ADS
|
|||||||
: nullptr;
|
: nullptr;
|
||||||
DockWidget::emitTopLevelEventForWidget(topLevelDockWidgetAfter, true);
|
DockWidget::emitTopLevelEventForWidget(topLevelDockWidgetAfter, true);
|
||||||
FloatingDockContainer *floatingContainer = dockContainerWidget->floatingWidget();
|
FloatingDockContainer *floatingContainer = dockContainerWidget->floatingWidget();
|
||||||
if (floatingContainer) {
|
if (floatingContainer)
|
||||||
floatingContainer->updateWindowTitle();
|
floatingContainer->updateWindowTitle();
|
||||||
}
|
|
||||||
|
|
||||||
if (!open) {
|
if (!open)
|
||||||
emit closed();
|
emit closed();
|
||||||
}
|
|
||||||
emit viewToggled(open);
|
emit viewToggled(open);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -440,24 +434,22 @@ namespace ADS
|
|||||||
#ifndef QT_NO_TOOLTIP
|
#ifndef QT_NO_TOOLTIP
|
||||||
void DockWidget::setTabToolTip(const QString &text)
|
void DockWidget::setTabToolTip(const QString &text)
|
||||||
{
|
{
|
||||||
if (d->m_tabWidget) {
|
if (d->m_tabWidget)
|
||||||
d->m_tabWidget->setToolTip(text);
|
d->m_tabWidget->setToolTip(text);
|
||||||
}
|
|
||||||
if (d->m_toggleViewAction) {
|
if (d->m_toggleViewAction)
|
||||||
d->m_toggleViewAction->setToolTip(text);
|
d->m_toggleViewAction->setToolTip(text);
|
||||||
}
|
|
||||||
if (d->m_dockArea) {
|
if (d->m_dockArea)
|
||||||
d->m_dockArea->markTitleBarMenuOutdated(); //update tabs menu
|
d->m_dockArea->markTitleBarMenuOutdated(); //update tabs menu
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void DockWidget::setIcon(const QIcon &icon)
|
void DockWidget::setIcon(const QIcon &icon)
|
||||||
{
|
{
|
||||||
d->m_tabWidget->setIcon(icon);
|
d->m_tabWidget->setIcon(icon);
|
||||||
if (!d->m_toggleViewAction->isCheckable()) {
|
if (!d->m_toggleViewAction->isCheckable())
|
||||||
d->m_toggleViewAction->setIcon(icon);
|
d->m_toggleViewAction->setIcon(icon);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QIcon DockWidget::icon() const { return d->m_tabWidget->icon(); }
|
QIcon DockWidget::icon() const { return d->m_tabWidget->icon(); }
|
||||||
@@ -466,18 +458,16 @@ namespace ADS
|
|||||||
|
|
||||||
QToolBar *DockWidget::createDefaultToolBar()
|
QToolBar *DockWidget::createDefaultToolBar()
|
||||||
{
|
{
|
||||||
if (!d->m_toolBar) {
|
if (!d->m_toolBar)
|
||||||
d->setupToolBar();
|
d->setupToolBar();
|
||||||
}
|
|
||||||
|
|
||||||
return d->m_toolBar;
|
return d->m_toolBar;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DockWidget::setToolBar(QToolBar *toolBar)
|
void DockWidget::setToolBar(QToolBar *toolBar)
|
||||||
{
|
{
|
||||||
if (d->m_toolBar) {
|
if (d->m_toolBar)
|
||||||
delete d->m_toolBar;
|
delete d->m_toolBar;
|
||||||
}
|
|
||||||
|
|
||||||
d->m_toolBar = toolBar;
|
d->m_toolBar = toolBar;
|
||||||
d->m_layout->insertWidget(0, d->m_toolBar);
|
d->m_layout->insertWidget(0, d->m_toolBar);
|
||||||
@@ -487,59 +477,52 @@ namespace ADS
|
|||||||
|
|
||||||
void DockWidget::setToolBarStyle(Qt::ToolButtonStyle style, eState state)
|
void DockWidget::setToolBarStyle(Qt::ToolButtonStyle style, eState state)
|
||||||
{
|
{
|
||||||
if (StateFloating == state) {
|
if (StateFloating == state)
|
||||||
d->m_toolBarStyleFloating = style;
|
d->m_toolBarStyleFloating = style;
|
||||||
} else {
|
else
|
||||||
d->m_toolBarStyleDocked = style;
|
d->m_toolBarStyleDocked = style;
|
||||||
}
|
|
||||||
|
|
||||||
setToolbarFloatingStyle(isFloating());
|
setToolbarFloatingStyle(isFloating());
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt::ToolButtonStyle DockWidget::toolBarStyle(eState state) const
|
Qt::ToolButtonStyle DockWidget::toolBarStyle(eState state) const
|
||||||
{
|
{
|
||||||
if (StateFloating == state) {
|
if (StateFloating == state)
|
||||||
return d->m_toolBarStyleFloating;
|
return d->m_toolBarStyleFloating;
|
||||||
} else {
|
else
|
||||||
return d->m_toolBarStyleDocked;
|
return d->m_toolBarStyleDocked;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DockWidget::setToolBarIconSize(const QSize &iconSize, eState state)
|
void DockWidget::setToolBarIconSize(const QSize &iconSize, eState state)
|
||||||
{
|
{
|
||||||
if (StateFloating == state) {
|
if (StateFloating == state)
|
||||||
d->m_toolBarIconSizeFloating = iconSize;
|
d->m_toolBarIconSizeFloating = iconSize;
|
||||||
} else {
|
else
|
||||||
d->m_toolBarIconSizeDocked = iconSize;
|
d->m_toolBarIconSizeDocked = iconSize;
|
||||||
}
|
|
||||||
|
|
||||||
setToolbarFloatingStyle(isFloating());
|
setToolbarFloatingStyle(isFloating());
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize DockWidget::toolBarIconSize(eState state) const
|
QSize DockWidget::toolBarIconSize(eState state) const
|
||||||
{
|
{
|
||||||
if (StateFloating == state) {
|
if (StateFloating == state)
|
||||||
return d->m_toolBarIconSizeFloating;
|
return d->m_toolBarIconSizeFloating;
|
||||||
} else {
|
else
|
||||||
return d->m_toolBarIconSizeDocked;
|
return d->m_toolBarIconSizeDocked;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DockWidget::setToolbarFloatingStyle(bool floating)
|
void DockWidget::setToolbarFloatingStyle(bool floating)
|
||||||
{
|
{
|
||||||
if (!d->m_toolBar) {
|
if (!d->m_toolBar)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
auto iconSize = floating ? d->m_toolBarIconSizeFloating : d->m_toolBarIconSizeDocked;
|
auto iconSize = floating ? d->m_toolBarIconSizeFloating : d->m_toolBarIconSizeDocked;
|
||||||
if (iconSize != d->m_toolBar->iconSize()) {
|
if (iconSize != d->m_toolBar->iconSize())
|
||||||
d->m_toolBar->setIconSize(iconSize);
|
d->m_toolBar->setIconSize(iconSize);
|
||||||
}
|
|
||||||
|
|
||||||
auto buttonStyle = floating ? d->m_toolBarStyleFloating : d->m_toolBarStyleDocked;
|
auto buttonStyle = floating ? d->m_toolBarStyleFloating : d->m_toolBarStyleDocked;
|
||||||
if (buttonStyle != d->m_toolBar->toolButtonStyle()) {
|
if (buttonStyle != d->m_toolBar->toolButtonStyle())
|
||||||
d->m_toolBar->setToolButtonStyle(buttonStyle);
|
d->m_toolBar->setToolButtonStyle(buttonStyle);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DockWidget::emitTopLevelEventForWidget(DockWidget *topLevelDockWidget, bool floating)
|
void DockWidget::emitTopLevelEventForWidget(DockWidget *topLevelDockWidget, bool floating)
|
||||||
@@ -564,9 +547,9 @@ namespace ADS
|
|||||||
|
|
||||||
void DockWidget::setFloating()
|
void DockWidget::setFloating()
|
||||||
{
|
{
|
||||||
if (isClosed()) {
|
if (isClosed())
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
d->m_tabWidget->detachDockWidget();
|
d->m_tabWidget->detachDockWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -584,13 +567,11 @@ namespace ADS
|
|||||||
|
|
||||||
bool DockWidget::closeDockWidgetInternal(bool forceClose)
|
bool DockWidget::closeDockWidgetInternal(bool forceClose)
|
||||||
{
|
{
|
||||||
if (!forceClose) {
|
if (!forceClose)
|
||||||
emit closeRequested();
|
emit closeRequested();
|
||||||
}
|
|
||||||
|
|
||||||
if (!forceClose && features().testFlag(DockWidget::CustomCloseHandling)) {
|
if (!forceClose && features().testFlag(DockWidget::CustomCloseHandling))
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
if (features().testFlag(DockWidget::DockWidgetDeleteOnClose)) {
|
if (features().testFlag(DockWidget::DockWidgetDeleteOnClose)) {
|
||||||
// If the dock widget is floating, then we check if we also need to
|
// If the dock widget is floating, then we check if we also need to
|
||||||
@@ -598,11 +579,10 @@ namespace ADS
|
|||||||
if (isFloating()) {
|
if (isFloating()) {
|
||||||
FloatingDockContainer* floatingWidget = internal::findParent<
|
FloatingDockContainer* floatingWidget = internal::findParent<
|
||||||
FloatingDockContainer *>(this);
|
FloatingDockContainer *>(this);
|
||||||
if (floatingWidget->dockWidgets().count() == 1) {
|
if (floatingWidget->dockWidgets().count() == 1)
|
||||||
floatingWidget->deleteLater();
|
floatingWidget->deleteLater();
|
||||||
} else {
|
else
|
||||||
floatingWidget->hide();
|
floatingWidget->hide();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
deleteDockWidget();
|
deleteDockWidget();
|
||||||
} else {
|
} else {
|
||||||
|
@@ -112,7 +112,7 @@ namespace ADS
|
|||||||
if (testConfigFlag(DockManager::FloatingContainerHasWidgetTitle)) {
|
if (testConfigFlag(DockManager::FloatingContainerHasWidgetTitle)) {
|
||||||
setWindowTitle(currentWidget->windowTitle());
|
setWindowTitle(currentWidget->windowTitle());
|
||||||
} else {
|
} else {
|
||||||
setWindowTitle(qApp->applicationDisplayName());
|
setWindowTitle(QApplication::applicationDisplayName());
|
||||||
}
|
}
|
||||||
|
|
||||||
// reflect CurrentWidget's icon if configured to do so, otherwise display application icon as window icon
|
// reflect CurrentWidget's icon if configured to do so, otherwise display application icon as window icon
|
||||||
@@ -495,7 +495,7 @@ namespace ADS
|
|||||||
&FloatingDockContainer::onDockAreaCurrentChanged);
|
&FloatingDockContainer::onDockAreaCurrentChanged);
|
||||||
d->m_singleDockArea = nullptr;
|
d->m_singleDockArea = nullptr;
|
||||||
}
|
}
|
||||||
d->setWindowTitle(qApp->applicationDisplayName());
|
d->setWindowTitle(QApplication::applicationDisplayName());
|
||||||
setWindowIcon(QApplication::windowIcon());
|
setWindowIcon(QApplication::windowIcon());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -507,7 +507,7 @@ namespace ADS
|
|||||||
DockWidget *currentWidget = topLevelDockArea->currentDockWidget();
|
DockWidget *currentWidget = topLevelDockArea->currentDockWidget();
|
||||||
d->reflectCurrentWidget(currentWidget);
|
d->reflectCurrentWidget(currentWidget);
|
||||||
} else {
|
} else {
|
||||||
d->setWindowTitle(qApp->applicationDisplayName());
|
d->setWindowTitle(QApplication::applicationDisplayName());
|
||||||
setWindowIcon(QApplication::windowIcon());
|
setWindowIcon(QApplication::windowIcon());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -96,22 +96,19 @@ namespace ADS
|
|||||||
|
|
||||||
void FloatingDragPreviewPrivate::updateDropOverlays(const QPoint &globalPosition)
|
void FloatingDragPreviewPrivate::updateDropOverlays(const QPoint &globalPosition)
|
||||||
{
|
{
|
||||||
if (!q->isVisible() || !m_dockManager) {
|
if (!q->isVisible() || !m_dockManager)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
auto containers = m_dockManager->dockContainers();
|
auto containers = m_dockManager->dockContainers();
|
||||||
DockContainerWidget *topContainer = nullptr;
|
DockContainerWidget *topContainer = nullptr;
|
||||||
for (auto containerWidget : containers) {
|
for (auto containerWidget : containers) {
|
||||||
if (!containerWidget->isVisible()) {
|
if (!containerWidget->isVisible())
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
QPoint mappedPosition = containerWidget->mapFromGlobal(globalPosition);
|
QPoint mappedPosition = containerWidget->mapFromGlobal(globalPosition);
|
||||||
if (containerWidget->rect().contains(mappedPosition)) {
|
if (containerWidget->rect().contains(mappedPosition)) {
|
||||||
if (!topContainer || containerWidget->isInFrontOf(topContainer)) {
|
if (!topContainer || containerWidget->isInFrontOf(topContainer))
|
||||||
topContainer = containerWidget;
|
topContainer = containerWidget;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,9 +121,9 @@ namespace ADS
|
|||||||
if (!topContainer) {
|
if (!topContainer) {
|
||||||
containerOverlay->hideOverlay();
|
containerOverlay->hideOverlay();
|
||||||
dockAreaOverlay->hideOverlay();
|
dockAreaOverlay->hideOverlay();
|
||||||
if (DockManager::configFlags().testFlag(DockManager::DragPreviewIsDynamic)) {
|
if (DockManager::configFlags().testFlag(DockManager::DragPreviewIsDynamic))
|
||||||
setHidden(false);
|
setHidden(false);
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,9 +150,8 @@ namespace ADS
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dockAreaOverlay->hideOverlay();
|
dockAreaOverlay->hideOverlay();
|
||||||
if (dockArea == m_contentSourceArea && InvalidDockWidgetArea == containerDropArea) {
|
if (dockArea == m_contentSourceArea && InvalidDockWidgetArea == containerDropArea)
|
||||||
m_dropContainer = nullptr;
|
m_dropContainer = nullptr;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DockManager::configFlags().testFlag(DockManager::DragPreviewIsDynamic)) {
|
if (DockManager::configFlags().testFlag(DockManager::DragPreviewIsDynamic)) {
|
||||||
@@ -199,7 +195,10 @@ namespace ADS
|
|||||||
connect(qApp,
|
connect(qApp,
|
||||||
&QApplication::applicationStateChanged,
|
&QApplication::applicationStateChanged,
|
||||||
this,
|
this,
|
||||||
&FloatingDragPreview::onApplicationStateChanged); // TODO
|
&FloatingDragPreview::onApplicationStateChanged);
|
||||||
|
// The focused object will receive key press events and therefore we install
|
||||||
|
// the event filter on it to receive escape key press for drag canceling
|
||||||
|
QApplication::focusObject()->installEventFilter(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
FloatingDragPreview::FloatingDragPreview(DockWidget *content)
|
FloatingDragPreview::FloatingDragPreview(DockWidget *content)
|
||||||
@@ -212,9 +211,6 @@ namespace ADS
|
|||||||
d->m_contenSourceContainer = content->dockContainer();
|
d->m_contenSourceContainer = content->dockContainer();
|
||||||
}
|
}
|
||||||
setWindowTitle(content->windowTitle());
|
setWindowTitle(content->windowTitle());
|
||||||
// We need to install an event filter for the given content
|
|
||||||
// widget to receive the escape key press
|
|
||||||
content->dockAreaWidget()->installEventFilter(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FloatingDragPreview::FloatingDragPreview(DockAreaWidget *content)
|
FloatingDragPreview::FloatingDragPreview(DockAreaWidget *content)
|
||||||
@@ -225,10 +221,6 @@ namespace ADS
|
|||||||
d->m_contentSourceArea = content;
|
d->m_contentSourceArea = content;
|
||||||
d->m_contenSourceContainer = content->dockContainer();
|
d->m_contenSourceContainer = content->dockContainer();
|
||||||
setWindowTitle(content->currentDockWidget()->windowTitle());
|
setWindowTitle(content->currentDockWidget()->windowTitle());
|
||||||
|
|
||||||
// We need to install an event filter for the given Content
|
|
||||||
// widget to receive the escape key press
|
|
||||||
content->installEventFilter(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FloatingDragPreview::~FloatingDragPreview() { delete d; }
|
FloatingDragPreview::~FloatingDragPreview() { delete d; }
|
||||||
@@ -277,9 +269,8 @@ namespace ADS
|
|||||||
floatingWidget = new FloatingDockContainer(dockWidget);
|
floatingWidget = new FloatingDockContainer(dockWidget);
|
||||||
} else {
|
} else {
|
||||||
DockAreaWidget *dockArea = qobject_cast<DockAreaWidget *>(d->m_content);
|
DockAreaWidget *dockArea = qobject_cast<DockAreaWidget *>(d->m_content);
|
||||||
if (dockArea->features().testFlag(DockWidget::DockWidgetFloatable)) {
|
if (dockArea->features().testFlag(DockWidget::DockWidgetFloatable))
|
||||||
floatingWidget = new FloatingDockContainer(dockArea);
|
floatingWidget = new FloatingDockContainer(dockArea);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (floatingWidget) {
|
if (floatingWidget) {
|
||||||
@@ -303,14 +294,12 @@ namespace ADS
|
|||||||
void FloatingDragPreview::paintEvent(QPaintEvent *event)
|
void FloatingDragPreview::paintEvent(QPaintEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event)
|
Q_UNUSED(event)
|
||||||
if (d->m_hidden) {
|
if (d->m_hidden)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
QPainter painter(this);
|
QPainter painter(this);
|
||||||
if (DockManager::configFlags().testFlag(DockManager::DragPreviewShowsContentPixmap)) {
|
if (DockManager::configFlags().testFlag(DockManager::DragPreviewShowsContentPixmap))
|
||||||
painter.drawPixmap(QPoint(0, 0), d->m_contentPreviewPixmap);
|
painter.drawPixmap(QPoint(0, 0), d->m_contentPreviewPixmap);
|
||||||
}
|
|
||||||
|
|
||||||
// If we do not have a window frame then we paint a QRubberBand like frameless window
|
// If we do not have a window frame then we paint a QRubberBand like frameless window
|
||||||
if (!DockManager::configFlags().testFlag(DockManager::DragPreviewHasWindowFrame)) {
|
if (!DockManager::configFlags().testFlag(DockManager::DragPreviewHasWindowFrame)) {
|
||||||
|
Reference in New Issue
Block a user