Makes project mostly compatible with Qt 4.5

This commit is contained in:
mfreiholz
2016-02-12 08:00:31 +01:00
parent 08f1968b31
commit 8f13dbd77c
12 changed files with 106 additions and 16 deletions

View File

@@ -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
}
}