titleblockpropertieswidget : edit and duplicate titleblock work in every case.

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4618 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2016-08-10 06:55:16 +00:00
parent 74553c4093
commit 8780b6c489
10 changed files with 44 additions and 51 deletions

View File

@@ -20,6 +20,7 @@
#include "templatescollection.h"
#include "qeticons.h"
#include "titleblocktemplate.h"
#include "qetapp.h"
#include <QMenu>
/**
@@ -216,6 +217,20 @@ TitleBlockProperties TitleBlockPropertiesWidget::propertiesAutoNum(QString autoN
return prop;
}
TitleBlockTemplateLocation TitleBlockPropertiesWidget::currentTitleBlockLocation() const
{
QET::QetCollection qc = m_map_index_to_collection_type.at(ui->m_tbt_cb->currentIndex());
TitleBlockTemplatesCollection *collection = nullptr;
foreach (TitleBlockTemplatesCollection *c, m_tbt_collection_list)
if (c -> collection() == qc)
collection = c;
if (!collection)
return TitleBlockTemplateLocation();
return collection->location(currentTitleBlockTemplateName());
}
/**
* @brief TitleBlockPropertiesWidget::setTitleBlockTemplatesVisible
* if true, title block template combo box and menu button is visible
@@ -313,11 +328,11 @@ int TitleBlockPropertiesWidget::getIndexFor(const QString &tbt_name, const QET::
}
void TitleBlockPropertiesWidget::editCurrentTitleBlockTemplate() {
emit(editTitleBlockTemplate(currentTitleBlockTemplateName(), false));
QETApp::instance()->openTitleBlockTemplate(currentTitleBlockLocation(), false);
}
void TitleBlockPropertiesWidget::duplicateCurrentTitleBlockTemplate() {
emit(editTitleBlockTemplate(currentTitleBlockTemplateName(), true));
QETApp::instance()->openTitleBlockTemplate(currentTitleBlockLocation(), true);
}
/**