C++98 compatibility.

This commit is contained in:
mfreiholz
2016-02-12 07:15:10 +01:00
parent c74204d5b7
commit 08f1968b31
17 changed files with 77 additions and 67 deletions

View File

@@ -83,4 +83,4 @@ QSplitter* findImmediateSplitter(class QWidget* w)
return sp;
}
ADS_NAMESPACE_END
ADS_NAMESPACE_END

View File

@@ -17,7 +17,7 @@ ADS_NAMESPACE_BEGIN
static QWidget* createDropWidget(const QString& img)
{
auto label = new QLabel();
QLabel* label = new QLabel();
label->setObjectName("DropAreaLabel");
label->setPixmap(QPixmap(img));
return label;
@@ -57,7 +57,7 @@ DropOverlay::~DropOverlay()
DropArea DropOverlay::cursorLocation() const
{
auto loc = InvalidDropArea;
DropArea loc = InvalidDropArea;
if (_splitAreas)
{
loc = _splitAreas->cursorLocation();
@@ -201,8 +201,8 @@ DropSplitAreas::DropSplitAreas(DropAreas areas, QWidget* parent) :
DropArea DropSplitAreas::cursorLocation() const
{
auto loc = InvalidDropArea;
auto pos = mapFromGlobal(QCursor::pos());
DropArea loc = InvalidDropArea;
QPoint pos = mapFromGlobal(QCursor::pos());
if (_top && _top->geometry().contains(pos))
{
loc = TopDropArea;

View File

@@ -21,7 +21,7 @@ FloatingWidget::FloatingWidget(ContainerWidget* container, SectionContent::RefPt
_titleWidget(titleWidget),
_contentWidget(contentWidget)
{
auto l = new QBoxLayout(QBoxLayout::TopToBottom, this);
QBoxLayout* l = new QBoxLayout(QBoxLayout::TopToBottom, this);
l->setContentsMargins(0, 0, 0, 0);
l->setSpacing(0);
setLayout(l);
@@ -38,7 +38,7 @@ FloatingWidget::FloatingWidget(ContainerWidget* container, SectionContent::RefPt
// maximizeButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
// _titleLayout->addWidget(maximizeButton);
auto closeButton = new QPushButton();
QPushButton* closeButton = new QPushButton();
closeButton->setObjectName("closeButton");
closeButton->setFlat(true);
closeButton->setIcon(style()->standardIcon(QStyle::SP_TitleBarCloseButton));

View File

@@ -53,4 +53,4 @@ SectionContent::RefPtr SectionContent::newSectionContent(QWidget* title, QWidget
return sc;
}
ADS_NAMESPACE_END
ADS_NAMESPACE_END

View File

@@ -8,11 +8,11 @@ SectionContentWidget::SectionContentWidget(SectionContent::RefPtr c, QWidget* pa
QFrame(parent),
_content(c)
{
auto l = new QBoxLayout(QBoxLayout::TopToBottom);
QBoxLayout* l = new QBoxLayout(QBoxLayout::TopToBottom);
l->setContentsMargins(0, 0, 0, 0);
l->setSpacing(0);
l->addWidget(_content->contentWidget());
setLayout(l);
}
ADS_NAMESPACE_END
ADS_NAMESPACE_END

View File

@@ -30,7 +30,7 @@ SectionTitleWidget::SectionTitleWidget(SectionContent::RefPtr content, QWidget*
_tabMoving(false),
_activeTab(false)
{
auto l = new QBoxLayout(QBoxLayout::LeftToRight);
QBoxLayout* l = new QBoxLayout(QBoxLayout::LeftToRight);
l->addWidget(content->titleWidget());
setLayout(l);
}
@@ -74,33 +74,33 @@ void SectionTitleWidget::mouseReleaseEvent(QMouseEvent* ev)
// Drop contents of FloatingWidget into SectionWidget.
if (_fw)
{
auto cw = findParentContainerWidget(this);
auto sw = cw->sectionAt(cw->mapFromGlobal(ev->globalPos()));
ContainerWidget* cw = findParentContainerWidget(this);
SectionWidget* sw = cw->sectionAt(cw->mapFromGlobal(ev->globalPos()));
if (sw)
{
auto loc = showDropOverlay(sw);
DropArea loc = showDropOverlay(sw);
if (loc != InvalidDropArea)
{
#if !defined(ADS_ANIMATIONS_ENABLED)
auto data = _fw->takeContent();
InternalContentData data = _fw->takeContent();
_fw->deleteLater();
_fw.clear();
cw->dropContent(data, sw, loc);
#else
auto moveAnim = new QPropertyAnimation(_fw, "pos", this);
QPropertyAnimation* moveAnim = new QPropertyAnimation(_fw, "pos", this);
moveAnim->setStartValue(_fw->pos());
moveAnim->setEndValue(sw->mapToGlobal(sw->rect().topLeft()));
moveAnim->setDuration(ADS_ANIMATION_DURATION);
auto resizeAnim = new QPropertyAnimation(_fw, "size", this);
QPropertyAnimation* resizeAnim = new QPropertyAnimation(_fw, "size", this);
resizeAnim->setStartValue(_fw->size());
resizeAnim->setEndValue(sw->size());
resizeAnim->setDuration(ADS_ANIMATION_DURATION);
auto animGroup = new QParallelAnimationGroup(this);
QParallelAnimationGroup* animGroup = new QParallelAnimationGroup(this);
QObject::connect(animGroup, &QPropertyAnimation::finished, [this, data, sw, loc]()
{
auto data = _fw->takeContent();
InternalContentData data = _fw->takeContent();
_fw->deleteLater();
_fw.clear();
cw->dropContent(data, sw, loc);
@@ -127,7 +127,7 @@ void SectionTitleWidget::mouseReleaseEvent(QMouseEvent* ev)
if (dropArea != DropArea::InvalidDropArea)
{
#if !defined(ADS_ANIMATIONS_ENABLED)
auto data = _fw->takeContent();
InternalContentData data = _fw->takeContent();
_fw->deleteLater();
_fw.clear();
cw->dropContent(data, NULL, dropArea);
@@ -215,7 +215,7 @@ void SectionTitleWidget::mouseMoveEvent(QMouseEvent* ev)
&& !section->titleAreaGeometry().contains(section->mapFromGlobal(ev->globalPos())))
{
// Create floating widget.
auto data = section->take(_content->uid(), false);
InternalContentData data = section->take(_content->uid(), false);
_fw = new FloatingWidget(cw, data.content, data.titleWidget, data.contentWidget, cw);
_fw->resize(section->size());

View File

@@ -31,7 +31,7 @@ SectionWidget::SectionWidget(ContainerWidget* parent) :
_uid(NextUid++),
_container(parent)
{
auto l = new QBoxLayout(QBoxLayout::TopToBottom);
QBoxLayout* l = new QBoxLayout(QBoxLayout::TopToBottom);
l->setContentsMargins(0, 0, 0, 0);
l->setSpacing(0);
setLayout(l);
@@ -48,7 +48,7 @@ SectionWidget::SectionWidget(ContainerWidget* parent) :
l->addLayout(_contentsLayout, 1);
#if defined(ADS_ANIMATIONS_ENABLED)
auto shadow = new QGraphicsDropShadowEffect(this);
QGraphicsDropShadowEffect* shadow = new QGraphicsDropShadowEffect(this);
shadow->setOffset(0, 0);
shadow->setBlurRadius(8);
setGraphicsEffect(shadow);
@@ -65,7 +65,7 @@ SectionWidget::~SectionWidget()
_container->_sections.removeAll(this);
// Delete empty QSplitter.
auto splitter = findParentSplitter(this);
QSplitter* splitter = findParentSplitter(this);
if (splitter && splitter->count() == 0)
{
splitter->deleteLater();
@@ -97,12 +97,12 @@ void SectionWidget::addContent(SectionContent::RefPtr c)
{
_contents.append(c);
auto title = new SectionTitleWidget(c, nullptr);
SectionTitleWidget* title = new SectionTitleWidget(c, NULL);
_sectionTitles.append(title);
_tabsLayout->insertWidget(_tabsLayout->count() - 1, title);
QObject::connect(title, &SectionTitleWidget::clicked, this, &SectionWidget::onSectionTitleClicked);
auto content = new SectionContentWidget(c, nullptr);
SectionContentWidget* content = new SectionContentWidget(c, NULL);
_sectionContents.append(content);
_contentsLayout->addWidget(content);
@@ -153,7 +153,7 @@ InternalContentData SectionWidget::take(int uid, bool del)
}
// Title wrapper widget (TAB)
auto title = _sectionTitles.takeAt(index);
SectionTitleWidget* title = _sectionTitles.takeAt(index);
if (title)
{
_tabsLayout->removeWidget(title);
@@ -163,7 +163,7 @@ InternalContentData SectionWidget::take(int uid, bool del)
}
// Content wrapper widget (CONTENT)
auto content = _sectionContents.takeAt(index);
SectionContentWidget* content = _sectionContents.takeAt(index);
if (content)
{
_contentsLayout->removeWidget(content);
@@ -240,10 +240,10 @@ void SectionWidget::setCurrentIndex(int index)
qDebug() << Q_FUNC_INFO << index;
for (int i = 0; i < _tabsLayout->count(); ++i)
{
auto item = _tabsLayout->itemAt(i);
QLayoutItem* item = _tabsLayout->itemAt(i);
if (item->widget())
{
auto stw = dynamic_cast<SectionTitleWidget*>(item->widget());
SectionTitleWidget* stw = dynamic_cast<SectionTitleWidget*>(item->widget());
if (i == index)
stw->setActiveTab(true);
else
@@ -266,12 +266,12 @@ void SectionWidget::paintEvent(QPaintEvent* e)
void SectionWidget::onSectionTitleClicked()
{
auto stw = qobject_cast<SectionTitleWidget*>(sender());
SectionTitleWidget* stw = qobject_cast<SectionTitleWidget*>(sender());
if (stw)
{
auto index = _tabsLayout->indexOf(stw);
int index = _tabsLayout->indexOf(stw);
setCurrentIndex(index);
}
}
ADS_NAMESPACE_END
ADS_NAMESPACE_END