Makes project mostly compatible with Qt 4.5
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "ads/ContainerWidget.h"
|
||||
#include "ads/Internal.h"
|
||||
|
||||
#include <QPaintEvent>
|
||||
#include <QPainter>
|
||||
@@ -40,17 +41,33 @@ static void dropContentOuterHelper(ContainerWidget* cw, QLayout* l, const Intern
|
||||
QSplitter* sp = newSplitter(orientation);
|
||||
if (append)
|
||||
{
|
||||
#if QT_VERSION >= 0x050000
|
||||
QLayoutItem* li = l->replaceWidget(oldsp, sp);
|
||||
sp->addWidget(oldsp);
|
||||
sp->addWidget(sw);
|
||||
delete li;
|
||||
#else
|
||||
int index = l->indexOf(oldsp);
|
||||
QLayoutItem* li = l->takeAt(index);
|
||||
sp->addWidget(oldsp);
|
||||
sp->addWidget(sw);
|
||||
delete li;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#if QT_VERSION >= 0x050000
|
||||
sp->addWidget(sw);
|
||||
QLayoutItem* li = l->replaceWidget(oldsp, sp);
|
||||
sp->addWidget(oldsp);
|
||||
delete li;
|
||||
#else
|
||||
sp->addWidget(sw);
|
||||
int index = l->indexOf(oldsp);
|
||||
QLayoutItem* li = l->takeAt(index);
|
||||
sp->addWidget(oldsp);
|
||||
delete li;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -349,7 +366,11 @@ QMenu* ContainerWidget::createContextMenu() const
|
||||
QAction* a = m->addAction(QIcon(), QString("Floating %1").arg(c->uid()));
|
||||
a->setCheckable(true);
|
||||
a->setChecked(fw->isVisible());
|
||||
#if QT_VERSION >= 0x050000
|
||||
QObject::connect(a, &QAction::toggled, fw, &FloatingWidget::setVisible);
|
||||
#else
|
||||
QObject::connect(a, SIGNAL(toggled(bool)), fw, SLOT(setVisible(bool)));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
#include <QPainter>
|
||||
#include <QGridLayout>
|
||||
#include <QCursor>
|
||||
#include <QtGui/QIcon>
|
||||
#include <QtWidgets/QLabel>
|
||||
#include <QIcon>
|
||||
#include <QLabel>
|
||||
|
||||
ADS_NAMESPACE_BEGIN
|
||||
|
||||
@@ -288,7 +288,11 @@ void hideDropOverlay()
|
||||
{
|
||||
MyOverlay->hide();
|
||||
delete MyOverlay;
|
||||
#if QT_VERSION >= 0x050000
|
||||
MyOverlayParent.clear();
|
||||
#else
|
||||
MyOverlayParent = 0;
|
||||
#endif
|
||||
MyOverlayParentRect = QRect();
|
||||
MyOverlayLastLocation = InvalidDropArea;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "ads/ContainerWidget.h"
|
||||
#include "ads/SectionTitleWidget.h"
|
||||
#include "ads/SectionContentWidget.h"
|
||||
#include "ads/Internal.h"
|
||||
|
||||
ADS_NAMESPACE_BEGIN
|
||||
|
||||
@@ -45,7 +46,8 @@ FloatingWidget::FloatingWidget(ContainerWidget* container, SectionContent::RefPt
|
||||
closeButton->setToolTip(tr("Close"));
|
||||
closeButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
_titleLayout->addWidget(closeButton);
|
||||
QObject::connect(closeButton, &QPushButton::clicked, this, &FloatingWidget::close);
|
||||
//QObject::connect(closeButton, &QPushButton::clicked, this, &FloatingWidget::close);
|
||||
QObject::connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
|
||||
|
||||
// Content
|
||||
l->addWidget(contentWidget, 1);
|
||||
|
||||
15
AdvancedDockingSystem/src/Internal.cpp
Normal file
15
AdvancedDockingSystem/src/Internal.cpp
Normal file
@@ -0,0 +1,15 @@
|
||||
#include "ads/Internal.h"
|
||||
|
||||
ADS_NAMESPACE_BEGIN
|
||||
|
||||
InternalContentData::InternalContentData() :
|
||||
titleWidget(NULL),
|
||||
contentWidget(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
InternalContentData::~InternalContentData()
|
||||
{
|
||||
}
|
||||
|
||||
ADS_NAMESPACE_END
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <QParallelAnimationGroup>
|
||||
#endif
|
||||
|
||||
#include "ads/Internal.h"
|
||||
#include "ads/DropOverlay.h"
|
||||
#include "ads/SectionContent.h"
|
||||
#include "ads/SectionWidget.h"
|
||||
@@ -84,7 +85,11 @@ void SectionTitleWidget::mouseReleaseEvent(QMouseEvent* ev)
|
||||
#if !defined(ADS_ANIMATIONS_ENABLED)
|
||||
InternalContentData data = _fw->takeContent();
|
||||
_fw->deleteLater();
|
||||
#if QT_VERSION >= 0x050000
|
||||
_fw.clear();
|
||||
#else
|
||||
_fw = 0;
|
||||
#endif
|
||||
cw->dropContent(data, sw, loc);
|
||||
#else
|
||||
QPropertyAnimation* moveAnim = new QPropertyAnimation(_fw, "pos", this);
|
||||
@@ -129,7 +134,11 @@ void SectionTitleWidget::mouseReleaseEvent(QMouseEvent* ev)
|
||||
#if !defined(ADS_ANIMATIONS_ENABLED)
|
||||
InternalContentData data = _fw->takeContent();
|
||||
_fw->deleteLater();
|
||||
#if QT_VERSION >= 0x050000
|
||||
_fw.clear();
|
||||
#else
|
||||
_fw = 0;
|
||||
#endif
|
||||
cw->dropContent(data, NULL, dropArea);
|
||||
#else
|
||||
#endif
|
||||
|
||||
@@ -8,12 +8,13 @@
|
||||
#include <QMimeData>
|
||||
#include <QPainter>
|
||||
#include <QStyle>
|
||||
#include <QtWidgets/QSplitter>
|
||||
#include <QSplitter>
|
||||
|
||||
#if defined(ADS_ANIMATIONS_ENABLED)
|
||||
#include <QGraphicsDropShadowEffect>
|
||||
#endif
|
||||
|
||||
#include "ads/Internal.h"
|
||||
#include "ads/DropOverlay.h"
|
||||
#include "ads/SectionContent.h"
|
||||
#include "ads/SectionTitleWidget.h"
|
||||
@@ -100,7 +101,11 @@ void SectionWidget::addContent(SectionContent::RefPtr c)
|
||||
SectionTitleWidget* title = new SectionTitleWidget(c, NULL);
|
||||
_sectionTitles.append(title);
|
||||
_tabsLayout->insertWidget(_tabsLayout->count() - 1, title);
|
||||
#if QT_VERSION >= 0x050000
|
||||
QObject::connect(title, &SectionTitleWidget::clicked, this, &SectionWidget::onSectionTitleClicked);
|
||||
#else
|
||||
QObject::connect(title, SIGNAL(clicked()), this, SLOT(onSectionTitleClicked()));
|
||||
#endif
|
||||
|
||||
SectionContentWidget* content = new SectionContentWidget(c, NULL);
|
||||
_sectionContents.append(content);
|
||||
@@ -120,7 +125,11 @@ void SectionWidget::addContent(const InternalContentData& data, bool autoActivat
|
||||
|
||||
_sectionTitles.append(data.titleWidget);
|
||||
_tabsLayout->insertWidget(_tabsLayout->count() - 1, data.titleWidget);
|
||||
#if QT_VERSION >= 0x050000
|
||||
QObject::connect(data.titleWidget, &SectionTitleWidget::clicked, this, &SectionWidget::onSectionTitleClicked);
|
||||
#else
|
||||
QObject::connect(data.titleWidget, SIGNAL(clicked()), this, SLOT(onSectionTitleClicked()));
|
||||
#endif
|
||||
|
||||
_sectionContents.append(data.contentWidget);
|
||||
_contentsLayout->addWidget(data.contentWidget);
|
||||
@@ -227,7 +236,13 @@ void SectionWidget::moveContent(int from, int to)
|
||||
QLayoutItem* liFrom = NULL;
|
||||
|
||||
liFrom = _tabsLayout->takeAt(from);
|
||||
#if QT_VERSION >= 0x050000
|
||||
_tabsLayout->insertItem(to, liFrom);
|
||||
#else
|
||||
_tabsLayout->insertWidget(to, liFrom->widget());
|
||||
delete liFrom;
|
||||
liFrom = NULL;
|
||||
#endif
|
||||
|
||||
liFrom = _contentsLayout->takeAt(from);
|
||||
_contentsLayout->insertWidget(to, liFrom->widget());
|
||||
|
||||
Reference in New Issue
Block a user