fixes #20 crash on-show.

checks for _sections.count() > 0 in dropContent() and creates first
SectionWidget, if needed.
This commit is contained in:
mfreiholz
2016-06-08 06:50:08 +02:00
parent 0be013bca2
commit 0317c3ebeb
2 changed files with 23 additions and 12 deletions

View File

@@ -116,9 +116,9 @@ MainWindow::MainWindow(QWidget *parent) :
}
// ADS - Adding some contents.
// Test #1: Use high-level public API
if (true)
{
// Test #1: Use high-level public API
ADS_NS::ContainerWidget* cw = _container;
ADS_NS::SectionWidget* sw = NULL;
@@ -131,6 +131,20 @@ MainWindow::MainWindow(QWidget *parent) :
_container->addSectionContent(createLongTextLabelSC(_container));
_container->addSectionContent(createLongTextLabelSC(_container));
}
else if (false)
{
// Issue #2: If the first drop is not into CenterDropArea, the application crashes.
ADS_NS::ContainerWidget* cw = _container;
ADS_NS::SectionWidget* sw = NULL;
sw = _container->addSectionContent(createLongTextLabelSC(cw), sw, ADS_NS::LeftDropArea);
sw = _container->addSectionContent(createCalendarSC(cw), sw, ADS_NS::LeftDropArea);
sw = _container->addSectionContent(createLongTextLabelSC(cw), sw, ADS_NS::CenterDropArea);
sw = _container->addSectionContent(createLongTextLabelSC(cw), sw, ADS_NS::CenterDropArea);
sw = _container->addSectionContent(createLongTextLabelSC(cw), sw, ADS_NS::CenterDropArea);
sw = _container->addSectionContent(createLongTextLabelSC(cw), sw, ADS_NS::RightDropArea);
sw = _container->addSectionContent(createLongTextLabelSC(cw), sw, ADS_NS::BottomDropArea);
}
// Default window geometry
resize(800, 600);