Introduced Config::setDropIndicatorsInhibited(bool)
Allows you to disable support for drop indicators while dragging
This commit is contained in:
@@ -12,6 +12,8 @@
|
|||||||
dock widget docked. Tabbed cases are more difficult since QStackedLayout doesn't
|
dock widget docked. Tabbed cases are more difficult since QStackedLayout doesn't
|
||||||
propagate size constraints.
|
propagate size constraints.
|
||||||
- Added MainWindowBase::frameCountChanged()
|
- Added MainWindowBase::frameCountChanged()
|
||||||
|
- Introduced Config::setDropIndicatorsInhibited(), which allows you to disable support
|
||||||
|
for drop indicators while dragging.
|
||||||
|
|
||||||
* v1.3.1 (unreleased)
|
* v1.3.1 (unreleased)
|
||||||
- Improve restoring layout when RestoreOption_RelativeToMainWindow is used (#171)
|
- Improve restoring layout when RestoreOption_RelativeToMainWindow is used (#171)
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include "MyMainWindow.h"
|
#include "MyMainWindow.h"
|
||||||
#include "MyWidget.h"
|
#include "MyWidget.h"
|
||||||
|
|
||||||
|
#include <kddockwidgets/Config.h>
|
||||||
#include <kddockwidgets/LayoutSaver.h>
|
#include <kddockwidgets/LayoutSaver.h>
|
||||||
|
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
@@ -69,8 +70,11 @@ MyMainWindow::MyMainWindow(const QString &uniqueName, KDDockWidgets::MainWindowO
|
|||||||
auto menubar = menuBar();
|
auto menubar = menuBar();
|
||||||
auto fileMenu = new QMenu(QStringLiteral("File"));
|
auto fileMenu = new QMenu(QStringLiteral("File"));
|
||||||
m_toggleMenu = new QMenu(QStringLiteral("Toggle"));
|
m_toggleMenu = new QMenu(QStringLiteral("Toggle"));
|
||||||
|
auto miscMenu = new QMenu(QStringLiteral("Misc"));
|
||||||
|
|
||||||
menubar->addMenu(fileMenu);
|
menubar->addMenu(fileMenu);
|
||||||
menubar->addMenu(m_toggleMenu);
|
menubar->addMenu(m_toggleMenu);
|
||||||
|
menubar->addMenu(miscMenu);
|
||||||
|
|
||||||
QAction *newAction = fileMenu->addAction(QStringLiteral("New DockWidget"));
|
QAction *newAction = fileMenu->addAction(QStringLiteral("New DockWidget"));
|
||||||
|
|
||||||
@@ -114,6 +118,13 @@ MyMainWindow::MyMainWindow(const QString &uniqueName, KDDockWidgets::MainWindowO
|
|||||||
auto quitAction = fileMenu->addAction(QStringLiteral("Quit"));
|
auto quitAction = fileMenu->addAction(QStringLiteral("Quit"));
|
||||||
connect(quitAction, &QAction::triggered, qApp, &QApplication::quit);
|
connect(quitAction, &QAction::triggered, qApp, &QApplication::quit);
|
||||||
|
|
||||||
|
QAction *toggleDropIndicatorSupport = miscMenu->addAction(QStringLiteral("Toggle Drop Indicator Support"));
|
||||||
|
toggleDropIndicatorSupport->setCheckable(true);
|
||||||
|
toggleDropIndicatorSupport->setChecked(true);
|
||||||
|
connect(toggleDropIndicatorSupport, &QAction::toggled, this, [](bool checked) {
|
||||||
|
KDDockWidgets::Config::self().setDropIndicatorsInhibited(!checked);
|
||||||
|
});
|
||||||
|
|
||||||
setAffinities({ affinityName });
|
setAffinities({ affinityName });
|
||||||
createDockWidgets();
|
createDockWidgets();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ public:
|
|||||||
CustomizableWidgets m_disabledPaintEvents = CustomizableWidget_None;
|
CustomizableWidgets m_disabledPaintEvents = CustomizableWidget_None;
|
||||||
qreal m_draggedWindowOpacity = Q_QNAN;
|
qreal m_draggedWindowOpacity = Q_QNAN;
|
||||||
int m_mdiPopupThreshold = 250;
|
int m_mdiPopupThreshold = 250;
|
||||||
|
bool m_dropIndicatorsInhibited = false;
|
||||||
#ifdef KDDOCKWIDGETS_QTQUICK
|
#ifdef KDDOCKWIDGETS_QTQUICK
|
||||||
QtQuickHelpers m_qquickHelpers;
|
QtQuickHelpers m_qquickHelpers;
|
||||||
#endif
|
#endif
|
||||||
@@ -325,4 +326,18 @@ int Config::mdiPopupThreshold() const
|
|||||||
{
|
{
|
||||||
return d->m_mdiPopupThreshold;
|
return d->m_mdiPopupThreshold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Config::setDropIndicatorsInhibited(bool inhibit) const
|
||||||
|
{
|
||||||
|
if (d->m_dropIndicatorsInhibited != inhibit) {
|
||||||
|
d->m_dropIndicatorsInhibited = inhibit;
|
||||||
|
Q_EMIT DockRegistry::self()->dropIndicatorsInhibitedChanged(inhibit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Config::dropIndicatorsInhibited() const
|
||||||
|
{
|
||||||
|
return d->m_dropIndicatorsInhibited;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -182,6 +182,15 @@ public:
|
|||||||
///By default it's 1.0, fully opaque
|
///By default it's 1.0, fully opaque
|
||||||
qreal draggedWindowOpacity() const;
|
qreal draggedWindowOpacity() const;
|
||||||
|
|
||||||
|
/// @brief Allows to disable support for drop indicators while dragging
|
||||||
|
/// By default drop indicators will be shown when dragging dock widgets.
|
||||||
|
/// This functionality can be toggled whenever you need it (it's not a startup-only setting).
|
||||||
|
void setDropIndicatorsInhibited(bool inhibit) const;
|
||||||
|
|
||||||
|
/// @brief Returns whether drop indicators are inhibited.
|
||||||
|
/// by default this is false unless you call setDropIndicatorsInhibited(true)
|
||||||
|
bool dropIndicatorsInhibited() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Allows the user to intercept a docking attempt to center (tabbed) and disallow it.
|
* @brief Allows the user to intercept a docking attempt to center (tabbed) and disallow it.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -235,6 +235,9 @@ Q_SIGNALS:
|
|||||||
/// @brief emitted when the MDI frame that's being resized changed
|
/// @brief emitted when the MDI frame that's being resized changed
|
||||||
void frameInMDIResizeChanged();
|
void frameInMDIResizeChanged();
|
||||||
|
|
||||||
|
/// @brief emitted whenever Config::dropIndicatorsInhibited changes
|
||||||
|
void dropIndicatorsInhibitedChanged(bool inhibited);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool eventFilter(QObject *watched, QEvent *event) override;
|
bool eventFilter(QObject *watched, QEvent *event) override;
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ void DropArea::layoutParentContainerEqually(DockWidgetBase *dw)
|
|||||||
|
|
||||||
DropIndicatorOverlayInterface::DropLocation DropArea::hover(WindowBeingDragged *draggedWindow, QPoint globalPos)
|
DropIndicatorOverlayInterface::DropLocation DropArea::hover(WindowBeingDragged *draggedWindow, QPoint globalPos)
|
||||||
{
|
{
|
||||||
if (!validateAffinity(draggedWindow))
|
if (Config::self().dropIndicatorsInhibited() || !validateAffinity(draggedWindow))
|
||||||
return DropIndicatorOverlayInterface::DropLocation_None;
|
return DropIndicatorOverlayInterface::DropLocation_None;
|
||||||
|
|
||||||
if (!m_dropIndicatorOverlay) {
|
if (!m_dropIndicatorOverlay) {
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include "Frame_p.h"
|
#include "Frame_p.h"
|
||||||
#include "DropArea_p.h"
|
#include "DropArea_p.h"
|
||||||
|
#include "DockRegistry_p.h"
|
||||||
|
|
||||||
using namespace KDDockWidgets;
|
using namespace KDDockWidgets;
|
||||||
|
|
||||||
@@ -22,6 +23,14 @@ DropIndicatorOverlayInterface::DropIndicatorOverlayInterface(DropArea *dropArea)
|
|||||||
{
|
{
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
setObjectName(QStringLiteral("DropIndicatorOverlayInterface"));
|
setObjectName(QStringLiteral("DropIndicatorOverlayInterface"));
|
||||||
|
|
||||||
|
connect(DockRegistry::self(), &DockRegistry::dropIndicatorsInhibitedChanged, this,
|
||||||
|
[this](bool inhibited) {
|
||||||
|
if (inhibited)
|
||||||
|
removeHover();
|
||||||
|
|
||||||
|
// if false then simply moving the mouse will make the drop indicators appear again
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void DropIndicatorOverlayInterface::setWindowBeingDragged(bool is)
|
void DropIndicatorOverlayInterface::setWindowBeingDragged(bool is)
|
||||||
|
|||||||
Reference in New Issue
Block a user