mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2025-04-01 02:42:39 +08:00
Fixed placing of drop overlay cross, resizing of floating widget to drop
area rectangle size prior to insertion
This commit is contained in:
parent
051c379e4a
commit
bc37a2788e
@ -34,6 +34,7 @@
|
|||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/QtAdvancedDockingSystem/demo}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/QtAdvancedDockingSystem/demo}""/>
|
||||||
<listOptionValue builtIn="false" value=""${QTDIR}/include""/>
|
<listOptionValue builtIn="false" value=""${QTDIR}/include""/>
|
||||||
</option>
|
</option>
|
||||||
|
<option id="gnu.cpp.compiler.option.preprocessor.def.56223209" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" useByScannerDiscovery="false" valueType="definedSymbols"/>
|
||||||
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1318830536" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
|
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1318830536" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
|
||||||
</tool>
|
</tool>
|
||||||
<tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.base.389117097" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.base">
|
<tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.base.389117097" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.base">
|
||||||
@ -42,6 +43,7 @@
|
|||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/QtAdvancedDockingSystem/src}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/QtAdvancedDockingSystem/src}""/>
|
||||||
<listOptionValue builtIn="false" value=""${QTDIR}/include""/>
|
<listOptionValue builtIn="false" value=""${QTDIR}/include""/>
|
||||||
</option>
|
</option>
|
||||||
|
<option id="gnu.c.compiler.option.preprocessor.def.symbols.806805509" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" useByScannerDiscovery="false" valueType="definedSymbols"/>
|
||||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1568363924" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
|
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1568363924" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
|
||||||
</tool>
|
</tool>
|
||||||
<tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.base.1734874312" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.base"/>
|
<tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.base.1734874312" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.base"/>
|
||||||
|
@ -2,13 +2,13 @@
|
|||||||
<project>
|
<project>
|
||||||
<configuration id="cdt.managedbuild.toolchain.gnu.mingw.base.1119687795" name="Default">
|
<configuration id="cdt.managedbuild.toolchain.gnu.mingw.base.1119687795" name="Default">
|
||||||
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
||||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
<provider class="org.eclipse.cdt.managedbuilder.internal.language.settings.providers.GCCBuiltinSpecsDetectorMinGW" console="false" env-hash="-853214798705706782" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetectorMinGW" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings MinGW" parameter="${COMMAND} ${FLAGS} -E -P -v -dD -std=c++14 "${INPUTS}"" prefer-non-shared="true">
|
||||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
|
||||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuildCommandParser" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser" keep-relative-paths="false" name="CDT GCC Build Output Parser" parameter="(g?cc)|([gc]\+\+)|(clang)" prefer-non-shared="true"/>
|
|
||||||
<provider class="org.eclipse.cdt.managedbuilder.internal.language.settings.providers.GCCBuiltinSpecsDetectorMinGW" console="false" env-hash="-797032510223863550" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetectorMinGW" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings MinGW" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
|
||||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||||
</provider>
|
</provider>
|
||||||
|
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||||
|
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||||
|
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuildCommandParser" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser" keep-relative-paths="false" name="CDT GCC Build Output Parser" parameter="(g?cc)|([gc]\+\+)|(clang)" prefer-non-shared="true"/>
|
||||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||||
</extension>
|
</extension>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
|
|
||||||
@ -33,6 +35,7 @@ void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QS
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
std::shared_ptr<int> b;
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
a.setQuitOnLastWindowClosed(true);
|
a.setQuitOnLastWindowClosed(true);
|
||||||
qInstallMessageHandler(myMessageOutput);
|
qInstallMessageHandler(myMessageOutput);
|
||||||
|
@ -201,6 +201,7 @@ struct DockOverlayPrivate
|
|||||||
DockWidgetArea LastLocation = InvalidDockWidgetArea;
|
DockWidgetArea LastLocation = InvalidDockWidgetArea;
|
||||||
bool DropPreviewEnabled = true;
|
bool DropPreviewEnabled = true;
|
||||||
CDockOverlay::eMode Mode = CDockOverlay::ModeDockAreaOverlay;
|
CDockOverlay::eMode Mode = CDockOverlay::ModeDockAreaOverlay;
|
||||||
|
QRect DropAreaRect;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private data constructor
|
* Private data constructor
|
||||||
@ -246,12 +247,6 @@ CDockOverlay::CDockOverlay(QWidget* parent, eMode Mode) :
|
|||||||
setAttribute(Qt::WA_NoSystemBackground);
|
setAttribute(Qt::WA_NoSystemBackground);
|
||||||
setAttribute(Qt::WA_TranslucentBackground);
|
setAttribute(Qt::WA_TranslucentBackground);
|
||||||
|
|
||||||
QBoxLayout* l = new QBoxLayout(QBoxLayout::TopToBottom);
|
|
||||||
l->setSpacing(0);
|
|
||||||
setLayout(l);
|
|
||||||
l->setContentsMargins(QMargins(0, 0, 0, 0));
|
|
||||||
l->addWidget(d->Cross);
|
|
||||||
|
|
||||||
d->Cross->setupOverlayCross(Mode);
|
d->Cross->setupOverlayCross(Mode);
|
||||||
d->Cross->setVisible(false);
|
d->Cross->setVisible(false);
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
@ -330,6 +325,7 @@ DockWidgetArea CDockOverlay::showOverlay(QWidget* target)
|
|||||||
QPoint TopLeft = target->mapToGlobal(target->rect().topLeft());
|
QPoint TopLeft = target->mapToGlobal(target->rect().topLeft());
|
||||||
move(TopLeft);
|
move(TopLeft);
|
||||||
show();
|
show();
|
||||||
|
d->Cross->updatePosition();
|
||||||
return dropAreaUnderCursor();
|
return dropAreaUnderCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -359,13 +355,12 @@ void CDockOverlay::paintEvent(QPaintEvent* event)
|
|||||||
// Draw rect based on location
|
// Draw rect based on location
|
||||||
if (!d->DropPreviewEnabled)
|
if (!d->DropPreviewEnabled)
|
||||||
{
|
{
|
||||||
|
d->DropAreaRect = QRect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QRect r = rect();
|
QRect r = rect();
|
||||||
const DockWidgetArea da = dropAreaUnderCursor();
|
const DockWidgetArea da = dropAreaUnderCursor();
|
||||||
//std::cout << "CursorLocation: " << dropAreaUnderCursor() << std::endl;
|
|
||||||
|
|
||||||
double Factor = (CDockOverlay::ModeContainerOverlay == d->Mode) ?
|
double Factor = (CDockOverlay::ModeContainerOverlay == d->Mode) ?
|
||||||
3 : 2;
|
3 : 2;
|
||||||
|
|
||||||
@ -383,6 +378,14 @@ void CDockOverlay::paintEvent(QPaintEvent* event)
|
|||||||
Color.setAlpha(64);
|
Color.setAlpha(64);
|
||||||
painter.setPen(Qt::NoPen);
|
painter.setPen(Qt::NoPen);
|
||||||
painter.fillRect(r, Color);
|
painter.fillRect(r, Color);
|
||||||
|
d->DropAreaRect = r;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
QRect CDockOverlay::dropOverlayRect() const
|
||||||
|
{
|
||||||
|
return d->DropAreaRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -569,6 +572,13 @@ DockWidgetArea CDockOverlayCross::cursorLocation() const
|
|||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
void CDockOverlayCross::showEvent(QShowEvent*)
|
void CDockOverlayCross::showEvent(QShowEvent*)
|
||||||
|
{
|
||||||
|
this->updatePosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void CDockOverlayCross::updatePosition()
|
||||||
{
|
{
|
||||||
resize(d->DockOverlay->size());
|
resize(d->DockOverlay->size());
|
||||||
QPoint TopLeft = d->DockOverlay->pos();
|
QPoint TopLeft = d->DockOverlay->pos();
|
||||||
|
@ -95,6 +95,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
void enableDropPreview(bool Enable);
|
void enableDropPreview(bool Enable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The drop overlay rectangle for the target area
|
||||||
|
*/
|
||||||
|
QRect dropOverlayRect() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void paintEvent(QPaintEvent *e) override;
|
virtual void paintEvent(QPaintEvent *e) override;
|
||||||
virtual void showEvent(QShowEvent* e) override;
|
virtual void showEvent(QShowEvent* e) override;
|
||||||
@ -144,6 +149,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the current position
|
||||||
|
*/
|
||||||
|
void updatePosition();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void showEvent(QShowEvent* e) override;
|
virtual void showEvent(QShowEvent* e) override;
|
||||||
void setAreaWidgets(const QHash<DockWidgetArea, QWidget*>& widgets);
|
void setAreaWidgets(const QHash<DockWidgetArea, QWidget*>& widgets);
|
||||||
|
@ -8,17 +8,48 @@
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
// INCLUDES
|
// INCLUDES
|
||||||
//============================================================================
|
//============================================================================
|
||||||
#include <DockSplitter.h>
|
#include "DockSplitter.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QChildEvent>
|
||||||
|
|
||||||
|
#include "DockAreaWidget.h"
|
||||||
|
|
||||||
namespace ads
|
namespace ads
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Private dock splitter data
|
||||||
|
*/
|
||||||
|
struct DockSplitterPrivate
|
||||||
|
{
|
||||||
|
CDockSplitter* _this;
|
||||||
|
int VisibleContentCount = 0;
|
||||||
|
|
||||||
|
DockSplitterPrivate(CDockSplitter* _public) : _this(_public) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
CDockSplitter::CDockSplitter(QWidget *parent)
|
||||||
|
: QSplitter(parent),
|
||||||
|
d(new DockSplitterPrivate(this))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
CDockSplitter::CDockSplitter(Qt::Orientation orientation, QWidget *parent)
|
||||||
|
: QSplitter(orientation, parent),
|
||||||
|
d(new DockSplitterPrivate(this))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
CDockSplitter::~CDockSplitter()
|
CDockSplitter::~CDockSplitter()
|
||||||
{
|
{
|
||||||
qDebug() << "~CDockSplitter";
|
qDebug() << "~CDockSplitter";
|
||||||
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
namespace ads
|
namespace ads
|
||||||
{
|
{
|
||||||
|
struct DockSplitterPrivate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Splitter used internally instead of QSplitter
|
* Splitter used internally instead of QSplitter
|
||||||
@ -21,8 +22,13 @@ namespace ads
|
|||||||
class CDockSplitter : public QSplitter
|
class CDockSplitter : public QSplitter
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
private:
|
||||||
|
DockSplitterPrivate* d;
|
||||||
|
friend class DockSplitterPrivate;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using QSplitter::QSplitter;
|
CDockSplitter(QWidget *parent = Q_NULLPTR);
|
||||||
|
CDockSplitter(Qt::Orientation orientation, QWidget *parent = Q_NULLPTR);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prints debug info
|
* Prints debug info
|
||||||
|
@ -43,6 +43,7 @@
|
|||||||
#include "DockWidget.h"
|
#include "DockWidget.h"
|
||||||
#include "DockOverlay.h"
|
#include "DockOverlay.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
namespace ads
|
namespace ads
|
||||||
{
|
{
|
||||||
@ -91,6 +92,18 @@ void FloatingDockContainerPrivate::titleMouseReleaseEvent()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Resize the floating widget to the size of the highlighted drop area
|
||||||
|
// rectangle
|
||||||
|
QRect Rect = DockManager->containerOverlay()->dropOverlayRect();
|
||||||
|
if (!Rect.isValid())
|
||||||
|
{
|
||||||
|
Rect = DockManager->dockAreaOverlay()->rect();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Rect.isValid())
|
||||||
|
{
|
||||||
|
_this->resize(Rect.size());
|
||||||
|
}
|
||||||
DropContainer->dropFloatingWidget(_this, QCursor::pos());
|
DropContainer->dropFloatingWidget(_this, QCursor::pos());
|
||||||
DockManager->containerOverlay()->hideOverlay();
|
DockManager->containerOverlay()->hideOverlay();
|
||||||
DockManager->dockAreaOverlay()->hideOverlay();
|
DockManager->dockAreaOverlay()->hideOverlay();
|
||||||
|
Loading…
Reference in New Issue
Block a user