Adds optional "title" attribute to SectionContent and show it in visible
areas e.g. context-menu. Build as shared library by default.
This commit is contained in:
@@ -213,7 +213,7 @@ QMenu* ContainerWidget::createContextMenu() const
|
||||
const QList<SectionContent::RefPtr>& contents = sw->contents();
|
||||
foreach (const SectionContent::RefPtr& sc, contents)
|
||||
{
|
||||
QAction* a = new QAction(QIcon(), sc->uniqueName(), NULL);
|
||||
QAction* a = new QAction(QIcon(), sc->visibleTitle(), NULL);
|
||||
a->setObjectName(QString("ads-action-sc-%1").arg(QString::number(sc->uid())));
|
||||
a->setProperty("uid", sc->uid());
|
||||
a->setProperty("type", "section");
|
||||
@@ -235,7 +235,7 @@ QMenu* ContainerWidget::createContextMenu() const
|
||||
hiddenIter.next();
|
||||
const SectionContent::RefPtr sc = hiddenIter.value().data.content;
|
||||
|
||||
QAction* a = new QAction(QIcon(), sc->uniqueName(), NULL);
|
||||
QAction* a = new QAction(QIcon(), sc->visibleTitle(), NULL);
|
||||
a->setObjectName(QString("ads-action-sc-%1").arg(QString::number(sc->uid())));
|
||||
a->setProperty("uid", sc->uid());
|
||||
a->setProperty("type", "section");
|
||||
@@ -255,7 +255,7 @@ QMenu* ContainerWidget::createContextMenu() const
|
||||
const FloatingWidget* fw = _floatings.at(i);
|
||||
const SectionContent::RefPtr sc = fw->content();
|
||||
|
||||
QAction* a = new QAction(QIcon(), sc->uniqueName(), NULL);
|
||||
QAction* a = new QAction(QIcon(), sc->visibleTitle(), NULL);
|
||||
a->setObjectName(QString("ads-action-sc-%1").arg(QString::number(sc->uid())));
|
||||
a->setProperty("uid", sc->uid());
|
||||
a->setProperty("type", "floating");
|
||||
|
||||
@@ -30,9 +30,9 @@ SectionContent::RefPtr SectionContent::newSectionContent(const QString& uniqueNa
|
||||
|
||||
QSharedPointer<SectionContent> sc(new SectionContent());
|
||||
sc->_uniqueName = uniqueName;
|
||||
sc->_container = container;
|
||||
sc->_title = title;
|
||||
sc->_content = content;
|
||||
sc->_containerWidget = container;
|
||||
sc->_titleWidget = title;
|
||||
sc->_contentWidget = content;
|
||||
|
||||
GetLookupMap().insert(sc->uid(), sc);
|
||||
if (!sc->uniqueName().isEmpty())
|
||||
@@ -45,8 +45,8 @@ SectionContent::~SectionContent()
|
||||
{
|
||||
GetLookupMap().remove(_uid);
|
||||
GetLookupMapByName().remove(_uniqueName);
|
||||
delete _title;
|
||||
delete _content;
|
||||
delete _titleWidget;
|
||||
delete _contentWidget;
|
||||
}
|
||||
|
||||
int SectionContent::uid() const
|
||||
@@ -61,17 +61,34 @@ QString SectionContent::uniqueName() const
|
||||
|
||||
ContainerWidget* SectionContent::containerWidget() const
|
||||
{
|
||||
return _container;
|
||||
return _containerWidget;
|
||||
}
|
||||
|
||||
QWidget* SectionContent::titleWidget() const
|
||||
{
|
||||
return _title;
|
||||
return _titleWidget;
|
||||
}
|
||||
|
||||
QWidget* SectionContent::contentWidget() const
|
||||
{
|
||||
return _content;
|
||||
return _contentWidget;
|
||||
}
|
||||
|
||||
QString SectionContent::visibleTitle() const
|
||||
{
|
||||
if (_title.isEmpty())
|
||||
return _uniqueName;
|
||||
return _title;
|
||||
}
|
||||
|
||||
QString SectionContent::title() const
|
||||
{
|
||||
return _title;
|
||||
}
|
||||
|
||||
void SectionContent::setTitle(const QString& title)
|
||||
{
|
||||
_title = title;
|
||||
}
|
||||
|
||||
int SectionContent::GetNextUid()
|
||||
|
||||
Reference in New Issue
Block a user