mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 12:40:35 +01:00
Apply clang-tidy's modernize-use-auto
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5449 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -75,7 +75,7 @@ ElementCollectionItem *ElementCollectionItem::childWithCollectionName(const QStr
|
|||||||
{
|
{
|
||||||
rowCount();
|
rowCount();
|
||||||
foreach (QStandardItem *qsi, directChilds()) {
|
foreach (QStandardItem *qsi, directChilds()) {
|
||||||
ElementCollectionItem *eci = static_cast<ElementCollectionItem *>(qsi);
|
auto *eci = static_cast<ElementCollectionItem *>(qsi);
|
||||||
if (eci->name() == name)
|
if (eci->name() == name)
|
||||||
return eci;
|
return eci;
|
||||||
}
|
}
|
||||||
@@ -167,7 +167,7 @@ QList<ElementCollectionItem *> ElementCollectionItem::elementsDirectChild() cons
|
|||||||
QList <ElementCollectionItem *> element_child;
|
QList <ElementCollectionItem *> element_child;
|
||||||
|
|
||||||
foreach (QStandardItem *qsi, directChilds()) {
|
foreach (QStandardItem *qsi, directChilds()) {
|
||||||
ElementCollectionItem *eci = static_cast<ElementCollectionItem *>(qsi);
|
auto *eci = static_cast<ElementCollectionItem *>(qsi);
|
||||||
if (eci->isElement())
|
if (eci->isElement())
|
||||||
element_child.append(eci);
|
element_child.append(eci);
|
||||||
}
|
}
|
||||||
@@ -184,7 +184,7 @@ QList<ElementCollectionItem *> ElementCollectionItem::directoriesDirectChild() c
|
|||||||
QList <ElementCollectionItem *> dir_child;
|
QList <ElementCollectionItem *> dir_child;
|
||||||
|
|
||||||
foreach (QStandardItem *qsi, directChilds()) {
|
foreach (QStandardItem *qsi, directChilds()) {
|
||||||
ElementCollectionItem *eci = static_cast<ElementCollectionItem *>(qsi);
|
auto *eci = static_cast<ElementCollectionItem *>(qsi);
|
||||||
if (eci->isDir())
|
if (eci->isDir())
|
||||||
dir_child.append(eci);
|
dir_child.append(eci);
|
||||||
}
|
}
|
||||||
@@ -231,7 +231,7 @@ QList<ElementCollectionItem *> ElementCollectionItem::items() const
|
|||||||
QList <ElementCollectionItem *> list;
|
QList <ElementCollectionItem *> list;
|
||||||
|
|
||||||
for (int i=0 ; i<rowCount() ; i++) {
|
for (int i=0 ; i<rowCount() ; i++) {
|
||||||
ElementCollectionItem *eci = static_cast<ElementCollectionItem *>(child(i));
|
auto *eci = static_cast<ElementCollectionItem *>(child(i));
|
||||||
list.append(eci);
|
list.append(eci);
|
||||||
list.append(eci->items());
|
list.append(eci->items());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,9 +68,9 @@ QMimeData *ElementsCollectionModel::mimeData(const QModelIndexList &indexes) con
|
|||||||
QModelIndex index = indexes.first();
|
QModelIndex index = indexes.first();
|
||||||
if (index.isValid())
|
if (index.isValid())
|
||||||
{
|
{
|
||||||
ElementCollectionItem *item = static_cast<ElementCollectionItem*>(itemFromIndex(index));
|
auto *item = static_cast<ElementCollectionItem*>(itemFromIndex(index));
|
||||||
|
|
||||||
QMimeData *mime_data = new QMimeData();
|
auto *mime_data = new QMimeData();
|
||||||
mime_data->setText(item->collectionPath());
|
mime_data->setText(item->collectionPath());
|
||||||
|
|
||||||
if (item->isElement())
|
if (item->isElement())
|
||||||
@@ -120,7 +120,7 @@ bool ElementsCollectionModel::canDropMimeData(const QMimeData *data, Qt::DropAct
|
|||||||
if (static_cast<FileElementCollectionItem *>(qsi)->isCommonCollection())
|
if (static_cast<FileElementCollectionItem *>(qsi)->isCommonCollection())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ElementCollectionItem *eci = static_cast<ElementCollectionItem *>(qsi);
|
auto *eci = static_cast<ElementCollectionItem *>(qsi);
|
||||||
|
|
||||||
if (data->hasFormat("application/x-qet-element-uri") || data->hasFormat("application/x-qet-category-uri"))
|
if (data->hasFormat("application/x-qet-element-uri") || data->hasFormat("application/x-qet-category-uri"))
|
||||||
{
|
{
|
||||||
@@ -156,7 +156,7 @@ bool ElementsCollectionModel::dropMimeData(const QMimeData *data, Qt::DropAction
|
|||||||
|
|
||||||
if (qsi->type() == FileElementCollectionItem::Type)
|
if (qsi->type() == FileElementCollectionItem::Type)
|
||||||
{
|
{
|
||||||
FileElementCollectionItem *feci = static_cast<FileElementCollectionItem *>(qsi);
|
auto *feci = static_cast<FileElementCollectionItem *>(qsi);
|
||||||
|
|
||||||
if (feci->isCommonCollection())
|
if (feci->isCommonCollection())
|
||||||
return false;
|
return false;
|
||||||
@@ -185,7 +185,7 @@ bool ElementsCollectionModel::dropMimeData(const QMimeData *data, Qt::DropAction
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (qsi->type() == XmlProjectElementCollectionItem::Type) {
|
else if (qsi->type() == XmlProjectElementCollectionItem::Type) {
|
||||||
XmlProjectElementCollectionItem *xpeci = static_cast<XmlProjectElementCollectionItem*>(qsi);
|
auto *xpeci = static_cast<XmlProjectElementCollectionItem*>(qsi);
|
||||||
|
|
||||||
if (xpeci->isElement() && xpeci->parent() && xpeci->parent()->type() == XmlProjectElementCollectionItem::Type)
|
if (xpeci->isElement() && xpeci->parent() && xpeci->parent()->type() == XmlProjectElementCollectionItem::Type)
|
||||||
xpeci = static_cast<XmlProjectElementCollectionItem *>(xpeci->parent());
|
xpeci = static_cast<XmlProjectElementCollectionItem *>(xpeci->parent());
|
||||||
@@ -254,7 +254,7 @@ void ElementsCollectionModel::loadCollections(bool common_collection, bool custo
|
|||||||
*/
|
*/
|
||||||
void ElementsCollectionModel::addCommonCollection(bool set_data)
|
void ElementsCollectionModel::addCommonCollection(bool set_data)
|
||||||
{
|
{
|
||||||
FileElementCollectionItem *feci = new FileElementCollectionItem();
|
auto *feci = new FileElementCollectionItem();
|
||||||
if (feci->setRootPath(QETApp::commonElementsDirN(), set_data, m_hide_element)) {
|
if (feci->setRootPath(QETApp::commonElementsDirN(), set_data, m_hide_element)) {
|
||||||
invisibleRootItem()->appendRow(feci);
|
invisibleRootItem()->appendRow(feci);
|
||||||
if (set_data)
|
if (set_data)
|
||||||
@@ -270,7 +270,7 @@ void ElementsCollectionModel::addCommonCollection(bool set_data)
|
|||||||
*/
|
*/
|
||||||
void ElementsCollectionModel::addCustomCollection(bool set_data)
|
void ElementsCollectionModel::addCustomCollection(bool set_data)
|
||||||
{
|
{
|
||||||
FileElementCollectionItem *feci = new FileElementCollectionItem();
|
auto *feci = new FileElementCollectionItem();
|
||||||
if (feci->setRootPath(QETApp::customElementsDirN(), set_data, m_hide_element)) {
|
if (feci->setRootPath(QETApp::customElementsDirN(), set_data, m_hide_element)) {
|
||||||
invisibleRootItem()->appendRow(feci);
|
invisibleRootItem()->appendRow(feci);
|
||||||
if (set_data)
|
if (set_data)
|
||||||
@@ -313,7 +313,7 @@ void ElementsCollectionModel::addLocation(const ElementsLocation& location)
|
|||||||
foreach(ElementCollectionItem *eci, child_list) {
|
foreach(ElementCollectionItem *eci, child_list) {
|
||||||
|
|
||||||
if (eci->type() == FileElementCollectionItem::Type) {
|
if (eci->type() == FileElementCollectionItem::Type) {
|
||||||
FileElementCollectionItem *feci = static_cast<FileElementCollectionItem *>(eci);
|
auto *feci = static_cast<FileElementCollectionItem *>(eci);
|
||||||
|
|
||||||
if (feci->isCustomCollection()) {
|
if (feci->isCustomCollection()) {
|
||||||
last_item = feci->lastItemForPath(location.collectionPath(false), collection_name);
|
last_item = feci->lastItemForPath(location.collectionPath(false), collection_name);
|
||||||
@@ -341,7 +341,7 @@ void ElementsCollectionModel::addProject(QETProject *project, bool set_data)
|
|||||||
|
|
||||||
m_project_list.append(project);
|
m_project_list.append(project);
|
||||||
int row = m_project_list.indexOf(project);
|
int row = m_project_list.indexOf(project);
|
||||||
XmlProjectElementCollectionItem *xpeci = new XmlProjectElementCollectionItem();
|
auto *xpeci = new XmlProjectElementCollectionItem();
|
||||||
m_project_hash.insert(project, xpeci);
|
m_project_hash.insert(project, xpeci);
|
||||||
|
|
||||||
xpeci->setProject(project, set_data);
|
xpeci->setProject(project, set_data);
|
||||||
@@ -419,7 +419,7 @@ QList <ElementCollectionItem *> ElementsCollectionModel::items() const
|
|||||||
QList <ElementCollectionItem *> list;
|
QList <ElementCollectionItem *> list;
|
||||||
|
|
||||||
for (int i=0 ; i<rowCount() ; i++) {
|
for (int i=0 ; i<rowCount() ; i++) {
|
||||||
ElementCollectionItem *eci = static_cast<ElementCollectionItem *>(item(i));
|
auto *eci = static_cast<ElementCollectionItem *>(item(i));
|
||||||
list.append(eci);
|
list.append(eci);
|
||||||
list.append(eci->items());
|
list.append(eci->items());
|
||||||
}
|
}
|
||||||
@@ -478,7 +478,7 @@ QModelIndex ElementsCollectionModel::indexFromLocation(const ElementsLocation &l
|
|||||||
ElementCollectionItem *match_eci = nullptr;
|
ElementCollectionItem *match_eci = nullptr;
|
||||||
|
|
||||||
if (eci->type() == FileElementCollectionItem::Type) {
|
if (eci->type() == FileElementCollectionItem::Type) {
|
||||||
if (FileElementCollectionItem *feci = static_cast<FileElementCollectionItem *>(eci)) {
|
if (auto *feci = static_cast<FileElementCollectionItem *>(eci)) {
|
||||||
if ( (location.isCommonCollection() && feci->isCommonCollection()) ||
|
if ( (location.isCommonCollection() && feci->isCommonCollection()) ||
|
||||||
(location.isCustomCollection() && !feci->isCommonCollection()) ) {
|
(location.isCustomCollection() && !feci->isCommonCollection()) ) {
|
||||||
match_eci = feci->itemAtPath(location.collectionPath(false));
|
match_eci = feci->itemAtPath(location.collectionPath(false));
|
||||||
@@ -486,7 +486,7 @@ QModelIndex ElementsCollectionModel::indexFromLocation(const ElementsLocation &l
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (eci->type() == XmlProjectElementCollectionItem::Type) {
|
else if (eci->type() == XmlProjectElementCollectionItem::Type) {
|
||||||
if (XmlProjectElementCollectionItem *xpeci = static_cast<XmlProjectElementCollectionItem *>(eci)) {
|
if (auto *xpeci = static_cast<XmlProjectElementCollectionItem *>(eci)) {
|
||||||
match_eci = xpeci->itemAtPath(location.collectionPath(false));
|
match_eci = xpeci->itemAtPath(location.collectionPath(false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -507,7 +507,7 @@ QModelIndex ElementsCollectionModel::indexFromLocation(const ElementsLocation &l
|
|||||||
void ElementsCollectionModel::elementIntegratedToCollection(const QString& path)
|
void ElementsCollectionModel::elementIntegratedToCollection(const QString& path)
|
||||||
{
|
{
|
||||||
QObject *object = sender();
|
QObject *object = sender();
|
||||||
XmlElementCollection *collection = static_cast<XmlElementCollection *> (object);
|
auto *collection = static_cast<XmlElementCollection *> (object);
|
||||||
if (!collection)
|
if (!collection)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -540,7 +540,7 @@ void ElementsCollectionModel::elementIntegratedToCollection(const QString& path)
|
|||||||
void ElementsCollectionModel::itemRemovedFromCollection(const QString& path)
|
void ElementsCollectionModel::itemRemovedFromCollection(const QString& path)
|
||||||
{
|
{
|
||||||
QObject *object = sender();
|
QObject *object = sender();
|
||||||
XmlElementCollection *collection = static_cast<XmlElementCollection *> (object);
|
auto *collection = static_cast<XmlElementCollection *> (object);
|
||||||
if (!collection)
|
if (!collection)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -568,7 +568,7 @@ void ElementsCollectionModel::itemRemovedFromCollection(const QString& path)
|
|||||||
void ElementsCollectionModel::updateItem(const QString& path)
|
void ElementsCollectionModel::updateItem(const QString& path)
|
||||||
{
|
{
|
||||||
QObject *object = sender();
|
QObject *object = sender();
|
||||||
XmlElementCollection *collection = static_cast<XmlElementCollection *> (object);
|
auto *collection = static_cast<XmlElementCollection *> (object);
|
||||||
if (!collection)
|
if (!collection)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -242,7 +242,7 @@ void ElementsCollectionWidget::customContextMenu(const QPoint &point)
|
|||||||
if (eci->type() == FileElementCollectionItem::Type)
|
if (eci->type() == FileElementCollectionItem::Type)
|
||||||
{
|
{
|
||||||
add_open_dir = true;
|
add_open_dir = true;
|
||||||
FileElementCollectionItem *feci = static_cast<FileElementCollectionItem*>(eci);
|
auto *feci = static_cast<FileElementCollectionItem*>(eci);
|
||||||
if (!feci->isCommonCollection())
|
if (!feci->isCommonCollection())
|
||||||
{
|
{
|
||||||
if (feci->isDir())
|
if (feci->isDir())
|
||||||
@@ -261,7 +261,7 @@ void ElementsCollectionWidget::customContextMenu(const QPoint &point)
|
|||||||
}
|
}
|
||||||
if (eci->type() == XmlProjectElementCollectionItem::Type)
|
if (eci->type() == XmlProjectElementCollectionItem::Type)
|
||||||
{
|
{
|
||||||
XmlProjectElementCollectionItem *xpeci = static_cast<XmlProjectElementCollectionItem *>(eci);
|
auto *xpeci = static_cast<XmlProjectElementCollectionItem *>(eci);
|
||||||
if (xpeci->isCollectionRoot())
|
if (xpeci->isCollectionRoot())
|
||||||
add_open_dir = true;
|
add_open_dir = true;
|
||||||
}
|
}
|
||||||
@@ -404,7 +404,7 @@ void ElementsCollectionWidget::editDirectory()
|
|||||||
|
|
||||||
if (eci->type() != FileElementCollectionItem::Type) return;
|
if (eci->type() != FileElementCollectionItem::Type) return;
|
||||||
|
|
||||||
FileElementCollectionItem *feci = static_cast<FileElementCollectionItem*>(eci);
|
auto *feci = static_cast<FileElementCollectionItem*>(eci);
|
||||||
if(feci->isCommonCollection()) return;
|
if(feci->isCommonCollection()) return;
|
||||||
|
|
||||||
ElementsLocation location(feci->collectionPath());
|
ElementsLocation location(feci->collectionPath());
|
||||||
@@ -424,7 +424,7 @@ void ElementsCollectionWidget::newDirectory()
|
|||||||
|
|
||||||
if (eci->type() != FileElementCollectionItem::Type) return;
|
if (eci->type() != FileElementCollectionItem::Type) return;
|
||||||
|
|
||||||
FileElementCollectionItem *feci = static_cast<FileElementCollectionItem*>(eci);
|
auto *feci = static_cast<FileElementCollectionItem*>(eci);
|
||||||
if(feci->isCommonCollection()) return;
|
if(feci->isCommonCollection()) return;
|
||||||
|
|
||||||
ElementsLocation location(feci->collectionPath());
|
ElementsLocation location(feci->collectionPath());
|
||||||
@@ -445,7 +445,7 @@ void ElementsCollectionWidget::newElement()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileElementCollectionItem *feci = static_cast<FileElementCollectionItem*>(eci);
|
auto *feci = static_cast<FileElementCollectionItem*>(eci);
|
||||||
if(feci->isCommonCollection()) {
|
if(feci->isCommonCollection()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -533,7 +533,7 @@ void ElementsCollectionWidget::dirProperties()
|
|||||||
void ElementsCollectionWidget::reload()
|
void ElementsCollectionWidget::reload()
|
||||||
{
|
{
|
||||||
m_progress_bar->show();
|
m_progress_bar->show();
|
||||||
ElementsCollectionModel *new_model = new ElementsCollectionModel(m_tree_view);
|
auto *new_model = new ElementsCollectionModel(m_tree_view);
|
||||||
|
|
||||||
QList <QETProject *> project_list;
|
QList <QETProject *> project_list;
|
||||||
project_list.append(m_waiting_project);
|
project_list.append(m_waiting_project);
|
||||||
|
|||||||
@@ -50,8 +50,8 @@ void ElementsTreeView::startDrag(Qt::DropActions supportedActions)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (QStandardItemModel *qsim = static_cast<QStandardItemModel *>(model())) {
|
if (auto *qsim = static_cast<QStandardItemModel *>(model())) {
|
||||||
if (ElementCollectionItem *eci = static_cast<ElementCollectionItem *>(qsim->itemFromIndex(index))) {
|
if (auto *eci = static_cast<ElementCollectionItem *>(qsim->itemFromIndex(index))) {
|
||||||
ElementsLocation loc (eci->collectionPath());
|
ElementsLocation loc (eci->collectionPath());
|
||||||
if (loc.exist()) {
|
if (loc.exist()) {
|
||||||
startElementDrag(loc);
|
startElementDrag(loc);
|
||||||
@@ -72,10 +72,10 @@ void ElementsTreeView::startElementDrag(const ElementsLocation &location)
|
|||||||
if (!location.exist())
|
if (!location.exist())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QDrag *drag = new QDrag(this);
|
auto *drag = new QDrag(this);
|
||||||
|
|
||||||
QString location_str = location.toString();
|
QString location_str = location.toString();
|
||||||
QMimeData *mime_data = new QMimeData();
|
auto *mime_data = new QMimeData();
|
||||||
mime_data->setText(location_str);
|
mime_data->setText(location_str);
|
||||||
|
|
||||||
if (location.isDirectory())
|
if (location.isDirectory())
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ QString FileElementCollectionItem::fileSystemPath() const
|
|||||||
if (isCollectionRoot())
|
if (isCollectionRoot())
|
||||||
return m_path;
|
return m_path;
|
||||||
|
|
||||||
FileElementCollectionItem *feci = static_cast<FileElementCollectionItem *> (parent());
|
auto *feci = static_cast<FileElementCollectionItem *> (parent());
|
||||||
if (feci)
|
if (feci)
|
||||||
return feci->fileSystemPath() + "/" + m_path;
|
return feci->fileSystemPath() + "/" + m_path;
|
||||||
else
|
else
|
||||||
@@ -172,7 +172,7 @@ QString FileElementCollectionItem::collectionPath() const
|
|||||||
return "custom://";
|
return "custom://";
|
||||||
}
|
}
|
||||||
else if (parent() && parent()->type() == FileElementCollectionItem::Type) {
|
else if (parent() && parent()->type() == FileElementCollectionItem::Type) {
|
||||||
ElementCollectionItem *eci = static_cast<ElementCollectionItem*>(parent());
|
auto *eci = static_cast<ElementCollectionItem*>(parent());
|
||||||
if (eci->isCollectionRoot())
|
if (eci->isCollectionRoot())
|
||||||
return eci->collectionPath() + m_path;
|
return eci->collectionPath() + m_path;
|
||||||
else
|
else
|
||||||
@@ -222,7 +222,7 @@ void FileElementCollectionItem::addChildAtPath(const QString &collection_name)
|
|||||||
if (collection_name.isEmpty())
|
if (collection_name.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FileElementCollectionItem *feci = new FileElementCollectionItem();
|
auto *feci = new FileElementCollectionItem();
|
||||||
insertRow(rowForInsertItem(collection_name), feci);
|
insertRow(rowForInsertItem(collection_name), feci);
|
||||||
feci->setPathName(collection_name);
|
feci->setPathName(collection_name);
|
||||||
feci->setUpData();
|
feci->setUpData();
|
||||||
@@ -299,7 +299,7 @@ void FileElementCollectionItem::populate(bool set_data, bool hide_element)
|
|||||||
//Get all directory in this directory.
|
//Get all directory in this directory.
|
||||||
foreach(QString str, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name))
|
foreach(QString str, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name))
|
||||||
{
|
{
|
||||||
FileElementCollectionItem *feci = new FileElementCollectionItem();
|
auto *feci = new FileElementCollectionItem();
|
||||||
appendRow(feci);
|
appendRow(feci);
|
||||||
feci->setPathName(str, set_data, hide_element);
|
feci->setPathName(str, set_data, hide_element);
|
||||||
if (set_data)
|
if (set_data)
|
||||||
@@ -313,7 +313,7 @@ void FileElementCollectionItem::populate(bool set_data, bool hide_element)
|
|||||||
dir.setNameFilters(QStringList() << "*.elmt");
|
dir.setNameFilters(QStringList() << "*.elmt");
|
||||||
foreach(QString str, dir.entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name))
|
foreach(QString str, dir.entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name))
|
||||||
{
|
{
|
||||||
FileElementCollectionItem *feci = new FileElementCollectionItem();
|
auto *feci = new FileElementCollectionItem();
|
||||||
appendRow(feci);
|
appendRow(feci);
|
||||||
feci->setPathName(str, set_data);
|
feci->setPathName(str, set_data);
|
||||||
if (set_data)
|
if (set_data)
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ QString XmlProjectElementCollectionItem::embeddedPath() const
|
|||||||
if (isCollectionRoot())
|
if (isCollectionRoot())
|
||||||
return "embed://";
|
return "embed://";
|
||||||
else if (parent()){
|
else if (parent()){
|
||||||
XmlProjectElementCollectionItem *xpeci = static_cast<XmlProjectElementCollectionItem *>(parent());
|
auto *xpeci = static_cast<XmlProjectElementCollectionItem *>(parent());
|
||||||
|
|
||||||
if (xpeci->isCollectionRoot())
|
if (xpeci->isCollectionRoot())
|
||||||
return xpeci->embeddedPath() + name();
|
return xpeci->embeddedPath() + name();
|
||||||
@@ -143,7 +143,7 @@ void XmlProjectElementCollectionItem::addChildAtPath(const QString &collection_n
|
|||||||
|
|
||||||
while (!child_element.isNull()) {
|
while (!child_element.isNull()) {
|
||||||
if (child_element.attribute("name") == collection_name) {
|
if (child_element.attribute("name") == collection_name) {
|
||||||
XmlProjectElementCollectionItem *xpeci = new XmlProjectElementCollectionItem ();
|
auto *xpeci = new XmlProjectElementCollectionItem ();
|
||||||
insertRow(rowForInsertItem(collection_name), xpeci);
|
insertRow(rowForInsertItem(collection_name), xpeci);
|
||||||
xpeci->setXmlElement(child_element, m_project);
|
xpeci->setXmlElement(child_element, m_project);
|
||||||
xpeci->setUpData();
|
xpeci->setUpData();
|
||||||
@@ -229,7 +229,7 @@ void XmlProjectElementCollectionItem::populate(bool set_data, bool hide_element)
|
|||||||
|
|
||||||
foreach (QDomElement element, dom_category)
|
foreach (QDomElement element, dom_category)
|
||||||
{
|
{
|
||||||
XmlProjectElementCollectionItem *xpeci = new XmlProjectElementCollectionItem();
|
auto *xpeci = new XmlProjectElementCollectionItem();
|
||||||
appendRow(xpeci);
|
appendRow(xpeci);
|
||||||
xpeci->setXmlElement(element, m_project, set_data, hide_element);
|
xpeci->setXmlElement(element, m_project, set_data, hide_element);
|
||||||
if (set_data)
|
if (set_data)
|
||||||
@@ -244,7 +244,7 @@ void XmlProjectElementCollectionItem::populate(bool set_data, bool hide_element)
|
|||||||
|
|
||||||
foreach (QDomElement element, dom_elements)
|
foreach (QDomElement element, dom_elements)
|
||||||
{
|
{
|
||||||
XmlProjectElementCollectionItem *xpeci = new XmlProjectElementCollectionItem();
|
auto *xpeci = new XmlProjectElementCollectionItem();
|
||||||
appendRow(xpeci);
|
appendRow(xpeci);
|
||||||
xpeci->setXmlElement(element, m_project, set_data);
|
xpeci->setXmlElement(element, m_project, set_data);
|
||||||
if (set_data)
|
if (set_data)
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ void QPropertyUndoCommand::setAnimated(bool animate, bool first_time)
|
|||||||
bool QPropertyUndoCommand::mergeWith(const QUndoCommand *other)
|
bool QPropertyUndoCommand::mergeWith(const QUndoCommand *other)
|
||||||
{
|
{
|
||||||
if (id() != other->id() || other->childCount()) return false;
|
if (id() != other->id() || other->childCount()) return false;
|
||||||
QPropertyUndoCommand const *undo = static_cast<const QPropertyUndoCommand *>(other);
|
auto const *undo = static_cast<const QPropertyUndoCommand *>(other);
|
||||||
if (m_object != undo->m_object || m_property_name != undo->m_property_name) return false;
|
if (m_object != undo->m_object || m_property_name != undo->m_property_name) return false;
|
||||||
m_new_value = undo->m_new_value;
|
m_new_value = undo->m_new_value;
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ QVector<QetGraphicsHandlerItem *> QetGraphicsHandlerItem::handlerForPoint(const
|
|||||||
QVector <QetGraphicsHandlerItem *> list_;
|
QVector <QetGraphicsHandlerItem *> list_;
|
||||||
for (QPointF point : points)
|
for (QPointF point : points)
|
||||||
{
|
{
|
||||||
QetGraphicsHandlerItem *qghi = new QetGraphicsHandlerItem(size);
|
auto *qghi = new QetGraphicsHandlerItem(size);
|
||||||
qghi->setPos(point);
|
qghi->setPos(point);
|
||||||
list_ << qghi;
|
list_ << qghi;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ AboutQET::AboutQET(QWidget *parent) :
|
|||||||
setModal(true);
|
setModal(true);
|
||||||
|
|
||||||
|
|
||||||
QTabWidget *tabs = new QTabWidget();
|
auto *tabs = new QTabWidget();
|
||||||
tabs -> addTab(aboutTab(), tr("À &propos", "tab title"));
|
tabs -> addTab(aboutTab(), tr("À &propos", "tab title"));
|
||||||
tabs -> addTab(authorsTab(), tr("A&uteurs", "tab title"));
|
tabs -> addTab(authorsTab(), tr("A&uteurs", "tab title"));
|
||||||
tabs -> addTab(translatorsTab(), tr("&Traducteurs", "tab title"));
|
tabs -> addTab(translatorsTab(), tr("&Traducteurs", "tab title"));
|
||||||
@@ -52,11 +52,11 @@ AboutQET::AboutQET(QWidget *parent) :
|
|||||||
connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
|
connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
|
||||||
connect(buttons, SIGNAL(rejected()), this, SLOT(accept()));
|
connect(buttons, SIGNAL(rejected()), this, SLOT(accept()));
|
||||||
|
|
||||||
QVBoxLayout *vlayout = new QVBoxLayout(this);
|
auto *vlayout = new QVBoxLayout(this);
|
||||||
vlayout->addWidget(tabs);
|
vlayout->addWidget(tabs);
|
||||||
vlayout->addWidget(buttons);
|
vlayout->addWidget(buttons);
|
||||||
|
|
||||||
QScrollArea* scrollArea = new QScrollArea(this);
|
auto* scrollArea = new QScrollArea(this);
|
||||||
scrollArea->setWidgetResizable(true);
|
scrollArea->setWidgetResizable(true);
|
||||||
scrollArea->setFixedSize (590, 590);
|
scrollArea->setFixedSize (590, 590);
|
||||||
scrollArea->setWidget(tabs);
|
scrollArea->setWidget(tabs);
|
||||||
@@ -135,7 +135,7 @@ QWidget *AboutQET::authorsTab() const {
|
|||||||
authors -> setTextFormat(Qt::RichText);
|
authors -> setTextFormat(Qt::RichText);
|
||||||
|
|
||||||
QWidget *authors_widget = new QWidget();
|
QWidget *authors_widget = new QWidget();
|
||||||
QHBoxLayout *authors_layout = new QHBoxLayout(authors_widget);
|
auto *authors_layout = new QHBoxLayout(authors_widget);
|
||||||
authors_layout -> addWidget(authors, 0, Qt::AlignCenter);
|
authors_layout -> addWidget(authors, 0, Qt::AlignCenter);
|
||||||
return(authors_widget);
|
return(authors_widget);
|
||||||
}
|
}
|
||||||
@@ -175,7 +175,7 @@ QWidget *AboutQET::translatorsTab() const {
|
|||||||
translators -> setTextFormat(Qt::RichText);
|
translators -> setTextFormat(Qt::RichText);
|
||||||
|
|
||||||
QWidget *translators_widget = new QWidget();
|
QWidget *translators_widget = new QWidget();
|
||||||
QHBoxLayout *translators_layout = new QHBoxLayout(translators_widget);
|
auto *translators_layout = new QHBoxLayout(translators_widget);
|
||||||
translators_layout -> addWidget(translators, 0, Qt::AlignCenter);
|
translators_layout -> addWidget(translators, 0, Qt::AlignCenter);
|
||||||
return(translators_widget);
|
return(translators_widget);
|
||||||
}
|
}
|
||||||
@@ -207,7 +207,7 @@ QWidget *AboutQET::contributorsTab() const {
|
|||||||
contributors -> setTextFormat(Qt::RichText);
|
contributors -> setTextFormat(Qt::RichText);
|
||||||
|
|
||||||
QWidget *contributors_widget = new QWidget();
|
QWidget *contributors_widget = new QWidget();
|
||||||
QHBoxLayout *contributors_layout = new QHBoxLayout(contributors_widget);
|
auto *contributors_layout = new QHBoxLayout(contributors_widget);
|
||||||
contributors_layout -> addWidget(contributors, 0, Qt::AlignCenter);
|
contributors_layout -> addWidget(contributors, 0, Qt::AlignCenter);
|
||||||
return(contributors_widget);
|
return(contributors_widget);
|
||||||
}
|
}
|
||||||
@@ -221,12 +221,12 @@ QWidget *AboutQET::licenseTab() const {
|
|||||||
QLabel *title_license = new QLabel(tr("Ce programme est sous licence GNU/GPL."));
|
QLabel *title_license = new QLabel(tr("Ce programme est sous licence GNU/GPL."));
|
||||||
|
|
||||||
// Text of the GNU/GPL in a scrollable text box not editable
|
// Text of the GNU/GPL in a scrollable text box not editable
|
||||||
QTextEdit *text_license = new QTextEdit();
|
auto *text_license = new QTextEdit();
|
||||||
text_license -> setPlainText(QET::license());
|
text_license -> setPlainText(QET::license());
|
||||||
text_license -> setReadOnly(true);
|
text_license -> setReadOnly(true);
|
||||||
|
|
||||||
// All in a vertical arrangement
|
// All in a vertical arrangement
|
||||||
QVBoxLayout *license_layout = new QVBoxLayout();
|
auto *license_layout = new QVBoxLayout();
|
||||||
license_layout -> addWidget(title_license);
|
license_layout -> addWidget(title_license);
|
||||||
license_layout -> addWidget(text_license);
|
license_layout -> addWidget(text_license);
|
||||||
license -> setLayout(license_layout);
|
license -> setLayout(license_layout);
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ void SelectAutonumW::setContext(const NumerotationContext &context) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (int i=0; i<m_context.size(); ++i) { //build with the content of @context
|
for (int i=0; i<m_context.size(); ++i) { //build with the content of @context
|
||||||
NumPartEditorW *part= new NumPartEditorW(m_context, i, m_edited_type, this);
|
auto *part= new NumPartEditorW(m_context, i, m_edited_type, this);
|
||||||
connect (part, SIGNAL(changed()), this, SLOT(applyEnable()));
|
connect (part, SIGNAL(changed()), this, SLOT(applyEnable()));
|
||||||
num_part_list_ << part;
|
num_part_list_ << part;
|
||||||
ui -> editor_layout -> addWidget(part);
|
ui -> editor_layout -> addWidget(part);
|
||||||
@@ -125,7 +125,7 @@ NumerotationContext SelectAutonumW::toNumContext() const {
|
|||||||
void SelectAutonumW::on_add_button_clicked()
|
void SelectAutonumW::on_add_button_clicked()
|
||||||
{
|
{
|
||||||
applyEnable(false);
|
applyEnable(false);
|
||||||
NumPartEditorW *part = new NumPartEditorW(m_edited_type, this);
|
auto *part = new NumPartEditorW(m_edited_type, this);
|
||||||
connect (part, SIGNAL(changed()), this, SLOT(applyEnable()));
|
connect (part, SIGNAL(changed()), this, SLOT(applyEnable()));
|
||||||
num_part_list_ << part;
|
num_part_list_ << part;
|
||||||
ui -> editor_layout -> addWidget(part);
|
ui -> editor_layout -> addWidget(part);
|
||||||
|
|||||||
@@ -673,8 +673,8 @@ DiagramPosition BorderTitleBlock::convertPosition(const QPointF &pos)
|
|||||||
return (DiagramPosition("", 0));
|
return (DiagramPosition("", 0));
|
||||||
|
|
||||||
QPointF relative_pos = pos - insideBorderRect().topLeft();
|
QPointF relative_pos = pos - insideBorderRect().topLeft();
|
||||||
int row_number = int(ceil(relative_pos.x() / columnsWidth()));
|
auto row_number = int(ceil(relative_pos.x() / columnsWidth()));
|
||||||
int column_number = int(ceil(relative_pos.y() / rowsHeight()));
|
auto column_number = int(ceil(relative_pos.y() / rowsHeight()));
|
||||||
|
|
||||||
QString letter = "A";
|
QString letter = "A";
|
||||||
for (int i = 1 ; i < column_number ; ++ i)
|
for (int i = 1 ; i < column_number ; ++ i)
|
||||||
|
|||||||
@@ -41,11 +41,11 @@ ConfigDialog::ConfigDialog(QWidget *parent) : QDialog(parent) {
|
|||||||
buttons = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
|
buttons = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
|
||||||
|
|
||||||
// layouts
|
// layouts
|
||||||
QHBoxLayout *hlayout1 = new QHBoxLayout();
|
auto *hlayout1 = new QHBoxLayout();
|
||||||
hlayout1 -> addWidget(pages_list);
|
hlayout1 -> addWidget(pages_list);
|
||||||
hlayout1 -> addWidget(pages_widget);
|
hlayout1 -> addWidget(pages_widget);
|
||||||
|
|
||||||
QVBoxLayout *vlayout1 = new QVBoxLayout();
|
auto *vlayout1 = new QVBoxLayout();
|
||||||
vlayout1 -> addLayout(hlayout1);
|
vlayout1 -> addLayout(hlayout1);
|
||||||
vlayout1 -> addWidget(buttons);
|
vlayout1 -> addWidget(buttons);
|
||||||
setLayout(vlayout1);
|
setLayout(vlayout1);
|
||||||
@@ -80,7 +80,7 @@ void ConfigDialog::buildPagesList() {
|
|||||||
Add the \a page ConfigPage to this configuration dialog.
|
Add the \a page ConfigPage to this configuration dialog.
|
||||||
*/
|
*/
|
||||||
void ConfigDialog::addPageToList(ConfigPage *page) {
|
void ConfigDialog::addPageToList(ConfigPage *page) {
|
||||||
QListWidgetItem *new_button = new QListWidgetItem(pages_list);
|
auto *new_button = new QListWidgetItem(pages_list);
|
||||||
new_button -> setIcon(page -> icon());
|
new_button -> setIcon(page -> icon());
|
||||||
new_button -> setText(page -> title());
|
new_button -> setText(page -> title());
|
||||||
new_button -> setTextAlignment(Qt::AlignHCenter);
|
new_button -> setTextAlignment(Qt::AlignHCenter);
|
||||||
|
|||||||
@@ -73,9 +73,9 @@ NewDiagramPage::NewDiagramPage(QETProject *project, QWidget *parent, ProjectProp
|
|||||||
connect(ipw,SIGNAL(openAutoNumFolioEditor(QString)),this,SLOT(changeToAutoFolioTab()));
|
connect(ipw,SIGNAL(openAutoNumFolioEditor(QString)),this,SLOT(changeToAutoFolioTab()));
|
||||||
|
|
||||||
// main tab widget
|
// main tab widget
|
||||||
QTabWidget *tab_widget = new QTabWidget(this);
|
auto *tab_widget = new QTabWidget(this);
|
||||||
QWidget *diagram_widget = new QWidget();
|
QWidget *diagram_widget = new QWidget();
|
||||||
QVBoxLayout *diagram_layout = new QVBoxLayout(diagram_widget);
|
auto *diagram_layout = new QVBoxLayout(diagram_widget);
|
||||||
|
|
||||||
diagram_layout -> addWidget(bpw);
|
diagram_layout -> addWidget(bpw);
|
||||||
diagram_layout -> addWidget(ipw);
|
diagram_layout -> addWidget(ipw);
|
||||||
@@ -85,7 +85,7 @@ NewDiagramPage::NewDiagramPage(QETProject *project, QWidget *parent, ProjectProp
|
|||||||
tab_widget -> addTab (rpw, tr("Reports de folio"));
|
tab_widget -> addTab (rpw, tr("Reports de folio"));
|
||||||
tab_widget -> addTab (xrefpw, tr("Références croisées"));
|
tab_widget -> addTab (xrefpw, tr("Références croisées"));
|
||||||
|
|
||||||
QVBoxLayout *vlayout1 = new QVBoxLayout();
|
auto *vlayout1 = new QVBoxLayout();
|
||||||
vlayout1->addWidget(tab_widget);
|
vlayout1->addWidget(tab_widget);
|
||||||
|
|
||||||
setLayout(vlayout1);
|
setLayout(vlayout1);
|
||||||
@@ -235,7 +235,7 @@ ExportConfigPage::ExportConfigPage(QWidget *parent) : ConfigPage(parent) {
|
|||||||
epw = new ExportPropertiesWidget(ExportProperties::defaultExportProperties());
|
epw = new ExportPropertiesWidget(ExportProperties::defaultExportProperties());
|
||||||
|
|
||||||
// layout vertical contenant le titre, une ligne horizontale et epw
|
// layout vertical contenant le titre, une ligne horizontale et epw
|
||||||
QVBoxLayout *vlayout1 = new QVBoxLayout();
|
auto *vlayout1 = new QVBoxLayout();
|
||||||
|
|
||||||
QLabel *title = new QLabel(this -> title());
|
QLabel *title = new QLabel(this -> title());
|
||||||
vlayout1 -> addWidget(title);
|
vlayout1 -> addWidget(title);
|
||||||
@@ -283,7 +283,7 @@ PrintConfigPage::PrintConfigPage(QWidget *parent) : ConfigPage(parent) {
|
|||||||
epw -> setPrintingMode(true);
|
epw -> setPrintingMode(true);
|
||||||
|
|
||||||
// layout vertical contenant le titre, une ligne horizontale et epw
|
// layout vertical contenant le titre, une ligne horizontale et epw
|
||||||
QVBoxLayout *vlayout1 = new QVBoxLayout();
|
auto *vlayout1 = new QVBoxLayout();
|
||||||
|
|
||||||
QLabel *title = new QLabel(this -> title());
|
QLabel *title = new QLabel(this -> title());
|
||||||
vlayout1 -> addWidget(title);
|
vlayout1 -> addWidget(title);
|
||||||
|
|||||||
@@ -159,9 +159,9 @@ void Diagram::drawBackground(QPainter *p, const QRectF &r) {
|
|||||||
qreal limite_x = rect.x() + rect.width();
|
qreal limite_x = rect.x() + rect.width();
|
||||||
qreal limite_y = rect.y() + rect.height();
|
qreal limite_y = rect.y() + rect.height();
|
||||||
|
|
||||||
int g_x = (int)ceil(rect.x());
|
auto g_x = (int)ceil(rect.x());
|
||||||
while (g_x % xGrid) ++ g_x;
|
while (g_x % xGrid) ++ g_x;
|
||||||
int g_y = (int)ceil(rect.y());
|
auto g_y = (int)ceil(rect.y());
|
||||||
while (g_y % yGrid) ++ g_y;
|
while (g_y % yGrid) ++ g_y;
|
||||||
|
|
||||||
QPolygon points;
|
QPolygon points;
|
||||||
@@ -649,23 +649,23 @@ QDomDocument Diagram::toXml(bool whole_content) {
|
|||||||
;
|
;
|
||||||
// Determine les elements a "XMLiser"
|
// Determine les elements a "XMLiser"
|
||||||
foreach(QGraphicsItem *qgi, list_items) {
|
foreach(QGraphicsItem *qgi, list_items) {
|
||||||
if (Element *elmt = qgraphicsitem_cast<Element *>(qgi)) {
|
if (auto *elmt = qgraphicsitem_cast<Element *>(qgi)) {
|
||||||
if (whole_content) list_elements << elmt;
|
if (whole_content) list_elements << elmt;
|
||||||
else if (elmt -> isSelected()) list_elements << elmt;
|
else if (elmt -> isSelected()) list_elements << elmt;
|
||||||
} else if (Conductor *f = qgraphicsitem_cast<Conductor *>(qgi)) {
|
} else if (auto *f = qgraphicsitem_cast<Conductor *>(qgi)) {
|
||||||
if (whole_content) list_conductors << f;
|
if (whole_content) list_conductors << f;
|
||||||
// lorsqu'on n'exporte pas tout le diagram, il faut retirer les conducteurs non selectionnes
|
// lorsqu'on n'exporte pas tout le diagram, il faut retirer les conducteurs non selectionnes
|
||||||
// et pour l'instant, les conducteurs non selectionnes sont les conducteurs dont un des elements n'est pas selectionne
|
// et pour l'instant, les conducteurs non selectionnes sont les conducteurs dont un des elements n'est pas selectionne
|
||||||
else if (f -> terminal1 -> parentItem() -> isSelected() && f -> terminal2 -> parentItem() -> isSelected()) {
|
else if (f -> terminal1 -> parentItem() -> isSelected() && f -> terminal2 -> parentItem() -> isSelected()) {
|
||||||
list_conductors << f;
|
list_conductors << f;
|
||||||
}
|
}
|
||||||
} else if (IndependentTextItem *iti = qgraphicsitem_cast<IndependentTextItem *>(qgi)) {
|
} else if (auto *iti = qgraphicsitem_cast<IndependentTextItem *>(qgi)) {
|
||||||
if (whole_content) list_texts << iti;
|
if (whole_content) list_texts << iti;
|
||||||
else if (iti -> isSelected()) list_texts << iti;
|
else if (iti -> isSelected()) list_texts << iti;
|
||||||
} else if (DiagramImageItem *dii = qgraphicsitem_cast<DiagramImageItem *>(qgi)) {
|
} else if (auto *dii = qgraphicsitem_cast<DiagramImageItem *>(qgi)) {
|
||||||
if (whole_content) list_images << dii;
|
if (whole_content) list_images << dii;
|
||||||
else if (dii -> isSelected()) list_images << dii;
|
else if (dii -> isSelected()) list_images << dii;
|
||||||
} else if (QetShapeItem *dsi = qgraphicsitem_cast<QetShapeItem *>(qgi)) {
|
} else if (auto *dsi = qgraphicsitem_cast<QetShapeItem *>(qgi)) {
|
||||||
if (whole_content) list_shapes << dsi;
|
if (whole_content) list_shapes << dsi;
|
||||||
else if (dsi -> isSelected()) list_shapes << dsi;
|
else if (dsi -> isSelected()) list_shapes << dsi;
|
||||||
}
|
}
|
||||||
@@ -920,7 +920,7 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
|
|||||||
// Load text
|
// Load text
|
||||||
QList<IndependentTextItem *> added_texts;
|
QList<IndependentTextItem *> added_texts;
|
||||||
foreach (QDomElement text_xml, QET::findInDomElement(root, "inputs", "input")) {
|
foreach (QDomElement text_xml, QET::findInDomElement(root, "inputs", "input")) {
|
||||||
IndependentTextItem *iti = new IndependentTextItem();
|
auto *iti = new IndependentTextItem();
|
||||||
iti -> fromXml(text_xml);
|
iti -> fromXml(text_xml);
|
||||||
addItem(iti);
|
addItem(iti);
|
||||||
added_texts << iti;
|
added_texts << iti;
|
||||||
@@ -929,7 +929,7 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
|
|||||||
// Load image
|
// Load image
|
||||||
QList<DiagramImageItem *> added_images;
|
QList<DiagramImageItem *> added_images;
|
||||||
foreach (QDomElement image_xml, QET::findInDomElement(root, "images", "image")) {
|
foreach (QDomElement image_xml, QET::findInDomElement(root, "images", "image")) {
|
||||||
DiagramImageItem *dii = new DiagramImageItem ();
|
auto *dii = new DiagramImageItem ();
|
||||||
dii -> fromXml(image_xml);
|
dii -> fromXml(image_xml);
|
||||||
addItem(dii);
|
addItem(dii);
|
||||||
added_images << dii;
|
added_images << dii;
|
||||||
@@ -959,7 +959,7 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
|
|||||||
Terminal *p2 = table_adr_id.value(id_p2);
|
Terminal *p2 = table_adr_id.value(id_p2);
|
||||||
if (p1 != p2)
|
if (p1 != p2)
|
||||||
{
|
{
|
||||||
Conductor *c = new Conductor(p1, p2);
|
auto *c = new Conductor(p1, p2);
|
||||||
if (c->isValid())
|
if (c->isValid())
|
||||||
{
|
{
|
||||||
addItem(c);
|
addItem(c);
|
||||||
@@ -1069,7 +1069,7 @@ void Diagram::addItem(QGraphicsItem *item)
|
|||||||
{
|
{
|
||||||
case Conductor::Type:
|
case Conductor::Type:
|
||||||
{
|
{
|
||||||
Conductor *conductor = static_cast<Conductor *>(item);
|
auto *conductor = static_cast<Conductor *>(item);
|
||||||
conductor->terminal1->addConductor(conductor);
|
conductor->terminal1->addConductor(conductor);
|
||||||
conductor->terminal2->addConductor(conductor);
|
conductor->terminal2->addConductor(conductor);
|
||||||
conductor->calculateTextItemPosition();
|
conductor->calculateTextItemPosition();
|
||||||
@@ -1078,7 +1078,7 @@ void Diagram::addItem(QGraphicsItem *item)
|
|||||||
|
|
||||||
case IndependentTextItem::Type:
|
case IndependentTextItem::Type:
|
||||||
{
|
{
|
||||||
const IndependentTextItem *text = static_cast<const IndependentTextItem *>(item);
|
const auto *text = static_cast<const IndependentTextItem *>(item);
|
||||||
connect(text, &IndependentTextItem::diagramTextChanged, this, &Diagram::diagramTextChanged);
|
connect(text, &IndependentTextItem::diagramTextChanged, this, &Diagram::diagramTextChanged);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1098,13 +1098,13 @@ void Diagram::removeItem(QGraphicsItem *item)
|
|||||||
{
|
{
|
||||||
case Element::Type:
|
case Element::Type:
|
||||||
{
|
{
|
||||||
Element *elmt = static_cast<Element*>(item);
|
auto *elmt = static_cast<Element*>(item);
|
||||||
elmt->unlinkAllElements();
|
elmt->unlinkAllElements();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Conductor::Type:
|
case Conductor::Type:
|
||||||
{
|
{
|
||||||
Conductor *conductor = static_cast<Conductor *>(item);
|
auto *conductor = static_cast<Conductor *>(item);
|
||||||
conductor->terminal1->removeConductor(conductor);
|
conductor->terminal1->removeConductor(conductor);
|
||||||
conductor->terminal2->removeConductor(conductor);
|
conductor->terminal2->removeConductor(conductor);
|
||||||
}
|
}
|
||||||
@@ -1112,7 +1112,7 @@ void Diagram::removeItem(QGraphicsItem *item)
|
|||||||
|
|
||||||
case IndependentTextItem::Type:
|
case IndependentTextItem::Type:
|
||||||
{
|
{
|
||||||
const IndependentTextItem *text = static_cast<const IndependentTextItem *>(item);
|
const auto *text = static_cast<const IndependentTextItem *>(item);
|
||||||
disconnect(text, &IndependentTextItem::diagramTextChanged, this, &Diagram::diagramTextChanged);
|
disconnect(text, &IndependentTextItem::diagramTextChanged, this, &Diagram::diagramTextChanged);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1456,7 +1456,7 @@ QString Diagram::title() const {
|
|||||||
QList<CustomElement *> Diagram::customElements() const {
|
QList<CustomElement *> Diagram::customElements() const {
|
||||||
QList<CustomElement *> elements_list;
|
QList<CustomElement *> elements_list;
|
||||||
foreach(QGraphicsItem *qgi, items()) {
|
foreach(QGraphicsItem *qgi, items()) {
|
||||||
if (CustomElement *elmt = qgraphicsitem_cast<CustomElement *>(qgi)) {
|
if (auto *elmt = qgraphicsitem_cast<CustomElement *>(qgi)) {
|
||||||
elements_list << elmt;
|
elements_list << elmt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1466,7 +1466,7 @@ QList<CustomElement *> Diagram::customElements() const {
|
|||||||
QList <Element *> Diagram::elements() const {
|
QList <Element *> Diagram::elements() const {
|
||||||
QList<Element *> element_list;
|
QList<Element *> element_list;
|
||||||
foreach (QGraphicsItem *qgi, items()) {
|
foreach (QGraphicsItem *qgi, items()) {
|
||||||
if (Element *elmt = qgraphicsitem_cast<Element *>(qgi))
|
if (auto *elmt = qgraphicsitem_cast<Element *>(qgi))
|
||||||
element_list <<elmt;
|
element_list <<elmt;
|
||||||
}
|
}
|
||||||
return (element_list);
|
return (element_list);
|
||||||
@@ -1479,7 +1479,7 @@ QList <Element *> Diagram::elements() const {
|
|||||||
QList <Conductor *> Diagram::conductors() const {
|
QList <Conductor *> Diagram::conductors() const {
|
||||||
QList<Conductor *> cnd_list;
|
QList<Conductor *> cnd_list;
|
||||||
foreach (QGraphicsItem *qgi, items()) {
|
foreach (QGraphicsItem *qgi, items()) {
|
||||||
if (Conductor *cnd = qgraphicsitem_cast<Conductor *>(qgi))
|
if (auto *cnd = qgraphicsitem_cast<Conductor *>(qgi))
|
||||||
cnd_list <<cnd;
|
cnd_list <<cnd;
|
||||||
}
|
}
|
||||||
return (cnd_list);
|
return (cnd_list);
|
||||||
@@ -1662,7 +1662,7 @@ QPointF Diagram::snapToGrid(const QPointF &p)
|
|||||||
*/
|
*/
|
||||||
void Diagram::setDrawTerminals(bool dt) {
|
void Diagram::setDrawTerminals(bool dt) {
|
||||||
foreach(QGraphicsItem *qgi, items()) {
|
foreach(QGraphicsItem *qgi, items()) {
|
||||||
if (Terminal *t = qgraphicsitem_cast<Terminal *>(qgi)) {
|
if (auto *t = qgraphicsitem_cast<Terminal *>(qgi)) {
|
||||||
t -> setVisible(dt);
|
t -> setVisible(dt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1683,7 +1683,7 @@ void Diagram::setDrawColoredConductors(bool dcc) {
|
|||||||
QSet<Conductor *> Diagram::selectedConductors() const {
|
QSet<Conductor *> Diagram::selectedConductors() const {
|
||||||
QSet<Conductor *> conductors_set;
|
QSet<Conductor *> conductors_set;
|
||||||
foreach(QGraphicsItem *qgi, selectedItems()) {
|
foreach(QGraphicsItem *qgi, selectedItems()) {
|
||||||
if (Conductor *c = qgraphicsitem_cast<Conductor *>(qgi)) {
|
if (auto *c = qgraphicsitem_cast<Conductor *>(qgi)) {
|
||||||
conductors_set << c;
|
conductors_set << c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1761,11 +1761,11 @@ bool Diagram::isReadOnly() const
|
|||||||
DiagramContent Diagram::content() const {
|
DiagramContent Diagram::content() const {
|
||||||
DiagramContent dc;
|
DiagramContent dc;
|
||||||
foreach(QGraphicsItem *qgi, items()) {
|
foreach(QGraphicsItem *qgi, items()) {
|
||||||
if (Element *e = qgraphicsitem_cast<Element *>(qgi)) {
|
if (auto *e = qgraphicsitem_cast<Element *>(qgi)) {
|
||||||
dc.m_elements << e;
|
dc.m_elements << e;
|
||||||
} else if (IndependentTextItem *iti = qgraphicsitem_cast<IndependentTextItem *>(qgi)) {
|
} else if (auto *iti = qgraphicsitem_cast<IndependentTextItem *>(qgi)) {
|
||||||
dc.m_text_fields << iti;
|
dc.m_text_fields << iti;
|
||||||
} else if (Conductor *c = qgraphicsitem_cast<Conductor *>(qgi)) {
|
} else if (auto *c = qgraphicsitem_cast<Conductor *>(qgi)) {
|
||||||
dc.m_conductors_to_move << c;
|
dc.m_conductors_to_move << c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ void MoveElementsCommand::move(const QPointF &actual_movement)
|
|||||||
setupAnimation(qgi->toGraphicsObject(), "pos", qgi->pos(), qgi->pos() + actual_movement);
|
setupAnimation(qgi->toGraphicsObject(), "pos", qgi->pos(), qgi->pos() + actual_movement);
|
||||||
else if(qgi->type() == QGraphicsItemGroup::Type) //ElementTextItemGroup is a QObject but not a QGraphicsObject
|
else if(qgi->type() == QGraphicsItemGroup::Type) //ElementTextItemGroup is a QObject but not a QGraphicsObject
|
||||||
{
|
{
|
||||||
if(ElementTextItemGroup *etig = dynamic_cast<ElementTextItemGroup *>(qgi))
|
if(auto *etig = dynamic_cast<ElementTextItemGroup *>(qgi))
|
||||||
setupAnimation(etig, "pos", etig->pos(), etig->pos() + actual_movement);
|
setupAnimation(etig, "pos", etig->pos(), etig->pos() + actual_movement);
|
||||||
}
|
}
|
||||||
else qgi -> setPos(qgi->pos() + actual_movement);
|
else qgi -> setPos(qgi->pos() + actual_movement);
|
||||||
@@ -286,7 +286,7 @@ void MoveElementsCommand::move(const QPointF &actual_movement)
|
|||||||
void MoveElementsCommand::setupAnimation(QObject *target, const QByteArray &propertyName, const QVariant& start, const QVariant& end) {
|
void MoveElementsCommand::setupAnimation(QObject *target, const QByteArray &propertyName, const QVariant& start, const QVariant& end) {
|
||||||
//create animation group if not yet.
|
//create animation group if not yet.
|
||||||
if (m_anim_group == nullptr) m_anim_group = new QParallelAnimationGroup();
|
if (m_anim_group == nullptr) m_anim_group = new QParallelAnimationGroup();
|
||||||
QPropertyAnimation *animation = new QPropertyAnimation(target, propertyName);
|
auto *animation = new QPropertyAnimation(target, propertyName);
|
||||||
animation->setDuration(300);
|
animation->setDuration(300);
|
||||||
animation->setStartValue(start);
|
animation->setStartValue(start);
|
||||||
animation->setEndValue(end);
|
animation->setEndValue(end);
|
||||||
|
|||||||
@@ -44,11 +44,11 @@ DiagramContent::DiagramContent(Diagram *diagram) :
|
|||||||
//Get the selected items
|
//Get the selected items
|
||||||
for (QGraphicsItem *item : m_selected_items)
|
for (QGraphicsItem *item : m_selected_items)
|
||||||
{
|
{
|
||||||
if (Element *elmt = qgraphicsitem_cast<Element *>(item))
|
if (auto *elmt = qgraphicsitem_cast<Element *>(item))
|
||||||
m_elements << elmt;
|
m_elements << elmt;
|
||||||
else if (IndependentTextItem *iti = qgraphicsitem_cast<IndependentTextItem *>(item))
|
else if (auto *iti = qgraphicsitem_cast<IndependentTextItem *>(item))
|
||||||
m_text_fields << iti;
|
m_text_fields << iti;
|
||||||
else if (Conductor *c = qgraphicsitem_cast<Conductor *>(item))
|
else if (auto *c = qgraphicsitem_cast<Conductor *>(item))
|
||||||
{
|
{
|
||||||
//Get the isolated selected conductor (= not movable, but deletable)
|
//Get the isolated selected conductor (= not movable, but deletable)
|
||||||
if (!c->terminal1->parentItem()->isSelected() &&\
|
if (!c->terminal1->parentItem()->isSelected() &&\
|
||||||
@@ -56,14 +56,14 @@ DiagramContent::DiagramContent(Diagram *diagram) :
|
|||||||
m_other_conductors << c;
|
m_other_conductors << c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (DiagramImageItem *dii = qgraphicsitem_cast<DiagramImageItem *>(item))
|
else if (auto *dii = qgraphicsitem_cast<DiagramImageItem *>(item))
|
||||||
m_images << dii;
|
m_images << dii;
|
||||||
else if (QetShapeItem *dsi = qgraphicsitem_cast<QetShapeItem *>(item))
|
else if (auto *dsi = qgraphicsitem_cast<QetShapeItem *>(item))
|
||||||
m_shapes << dsi;
|
m_shapes << dsi;
|
||||||
else if (DynamicElementTextItem *deti = qgraphicsitem_cast<DynamicElementTextItem *>(item))
|
else if (auto *deti = qgraphicsitem_cast<DynamicElementTextItem *>(item))
|
||||||
m_element_texts << deti;
|
m_element_texts << deti;
|
||||||
else if (QGraphicsItemGroup *group = qgraphicsitem_cast<QGraphicsItemGroup *>(item))
|
else if (auto *group = qgraphicsitem_cast<QGraphicsItemGroup *>(item))
|
||||||
if(ElementTextItemGroup *etig = dynamic_cast<ElementTextItemGroup *>(group))
|
if(auto *etig = dynamic_cast<ElementTextItemGroup *>(group))
|
||||||
m_texts_groups << etig;
|
m_texts_groups << etig;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,7 +147,7 @@ QList<ElementTextItemGroup *> DiagramContent::selectedTextsGroup() const
|
|||||||
|
|
||||||
for(QGraphicsItem *qgi : m_selected_items)
|
for(QGraphicsItem *qgi : m_selected_items)
|
||||||
if(qgi->type() == QGraphicsItemGroup::Type)
|
if(qgi->type() == QGraphicsItemGroup::Type)
|
||||||
if(ElementTextItemGroup *grp = dynamic_cast<ElementTextItemGroup *>(qgi))
|
if(auto *grp = dynamic_cast<ElementTextItemGroup *>(qgi))
|
||||||
groups << grp;
|
groups << grp;
|
||||||
|
|
||||||
return groups;
|
return groups;
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ void DiagramContextWidget::initWidgets() {
|
|||||||
Initialize the layout of this widget.
|
Initialize the layout of this widget.
|
||||||
*/
|
*/
|
||||||
void DiagramContextWidget::initLayout() {
|
void DiagramContextWidget::initLayout() {
|
||||||
QVBoxLayout *vlayout0 = new QVBoxLayout();
|
auto *vlayout0 = new QVBoxLayout();
|
||||||
vlayout0 -> setContentsMargins(0, 0, 0, 0);
|
vlayout0 -> setContentsMargins(0, 0, 0, 0);
|
||||||
vlayout0 -> addWidget(format_label);
|
vlayout0 -> addWidget(format_label);
|
||||||
vlayout0 -> addWidget(table_);
|
vlayout0 -> addWidget(table_);
|
||||||
|
|||||||
@@ -230,7 +230,7 @@ void DiagramEventAddElement::addElement()
|
|||||||
{
|
{
|
||||||
QPair <Terminal *, Terminal *> pair = element -> AlignedFreeTerminals().takeFirst();
|
QPair <Terminal *, Terminal *> pair = element -> AlignedFreeTerminals().takeFirst();
|
||||||
|
|
||||||
Conductor *conductor = new Conductor(pair.first, pair.second);
|
auto *conductor = new Conductor(pair.first, pair.second);
|
||||||
new AddItemCommand<Conductor *>(conductor, m_diagram, QPointF(), undo_object);
|
new AddItemCommand<Conductor *>(conductor, m_diagram, QPointF(), undo_object);
|
||||||
|
|
||||||
//Autonum the new conductor, the undo command associated for this, have for parent undo_object
|
//Autonum the new conductor, the undo command associated for this, have for parent undo_object
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ bool DiagramEventAddText::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
{
|
{
|
||||||
if (event->button() == Qt::LeftButton)
|
if (event->button() == Qt::LeftButton)
|
||||||
{
|
{
|
||||||
IndependentTextItem *text = new IndependentTextItem();
|
auto *text = new IndependentTextItem();
|
||||||
m_diagram -> undoStack().push(new AddItemCommand<IndependentTextItem *>(text, m_diagram, event->scenePos()));
|
m_diagram -> undoStack().push(new AddItemCommand<IndependentTextItem *>(text, m_diagram, event->scenePos()));
|
||||||
text->setTextInteractionFlags(Qt::TextEditorInteraction);
|
text->setTextInteractionFlags(Qt::TextEditorInteraction);
|
||||||
text->setFocus(Qt::MouseFocusReason);
|
text->setFocus(Qt::MouseFocusReason);
|
||||||
|
|||||||
@@ -236,16 +236,16 @@ void DiagramFolioList::buildGrid(QPainter *qp, const QRectF &rect, int rows, int
|
|||||||
qreal y0 = tablesSpacing + rect.topLeft().y();
|
qreal y0 = tablesSpacing + rect.topLeft().y();
|
||||||
|
|
||||||
for (int i = 0; i < tables; ++i) {
|
for (int i = 0; i < tables; ++i) {
|
||||||
QRectF *tableRect = new QRectF(x0, y0, tableWidth, rect.height() - 2*tablesSpacing);
|
auto *tableRect = new QRectF(x0, y0, tableWidth, rect.height() - 2*tablesSpacing);
|
||||||
qp->drawRect(*tableRect);
|
qp->drawRect(*tableRect);
|
||||||
list_rectangles_.push_back(tableRect);
|
list_rectangles_.push_back(tableRect);
|
||||||
for (int j = 1; j < rows; ++j) {
|
for (int j = 1; j < rows; ++j) {
|
||||||
QLineF *line = new QLineF(x0, y0 + j*rowHeight, x0 + tableWidth,y0 + j*rowHeight);
|
auto *line = new QLineF(x0, y0 + j*rowHeight, x0 + tableWidth,y0 + j*rowHeight);
|
||||||
qp->drawLine(*line);
|
qp->drawLine(*line);
|
||||||
list_lines_.push_back(line);
|
list_lines_.push_back(line);
|
||||||
}
|
}
|
||||||
for (int j = 0; j < cols-1; ++j) {
|
for (int j = 0; j < cols-1; ++j) {
|
||||||
QLineF *line = new QLineF(x0 + colWidths[j]*tableWidth, y0, x0 + colWidths[j]*tableWidth,y0 + rows*rowHeight);
|
auto *line = new QLineF(x0 + colWidths[j]*tableWidth, y0, x0 + colWidths[j]*tableWidth,y0 + rows*rowHeight);
|
||||||
qp->drawLine(*line);
|
qp->drawLine(*line);
|
||||||
list_lines_.push_back(line);
|
list_lines_.push_back(line);
|
||||||
x0 += colWidths[j]*tableWidth;
|
x0 += colWidths[j]*tableWidth;
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ int DiagramPrintDialog::horizontalPagesCount(Diagram *diagram, const ExportPrope
|
|||||||
QRect printable_area = fullpage ? printer_ -> paperRect() : printer_ -> pageRect();
|
QRect printable_area = fullpage ? printer_ -> paperRect() : printer_ -> pageRect();
|
||||||
QRect diagram_rect = diagramRect(diagram, options);
|
QRect diagram_rect = diagramRect(diagram, options);
|
||||||
|
|
||||||
int h_pages_count = int(ceil(qreal(diagram_rect.width()) / qreal(printable_area.width())));
|
auto h_pages_count = int(ceil(qreal(diagram_rect.width()) / qreal(printable_area.width())));
|
||||||
return(h_pages_count);
|
return(h_pages_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,7 +203,7 @@ int DiagramPrintDialog::verticalPagesCount(Diagram *diagram, const ExportPropert
|
|||||||
QRect printable_area = fullpage ? printer_ -> paperRect() : printer_ -> pageRect();
|
QRect printable_area = fullpage ? printer_ -> paperRect() : printer_ -> pageRect();
|
||||||
QRect diagram_rect = diagramRect(diagram, options);
|
QRect diagram_rect = diagramRect(diagram, options);
|
||||||
|
|
||||||
int v_pages_count = int(ceil(qreal(diagram_rect.height()) / qreal(printable_area.height())));
|
auto v_pages_count = int(ceil(qreal(diagram_rect.height()) / qreal(printable_area.height())));
|
||||||
return(v_pages_count);
|
return(v_pages_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ void DiagramsChooser::updateList() {
|
|||||||
QString diagram_title = diagram -> title();
|
QString diagram_title = diagram -> title();
|
||||||
if (diagram_title.isEmpty()) diagram_title = tr("Folio sans titre");
|
if (diagram_title.isEmpty()) diagram_title = tr("Folio sans titre");
|
||||||
|
|
||||||
QCheckBox *checkbox = new QCheckBox(diagram_title);
|
auto *checkbox = new QCheckBox(diagram_title);
|
||||||
checkbox -> setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum));
|
checkbox -> setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum));
|
||||||
checkbox -> setChecked(selected_diagrams.contains(diagram));
|
checkbox -> setChecked(selected_diagrams.contains(diagram));
|
||||||
connect(checkbox, SIGNAL(toggled(bool)), this, SIGNAL(selectionChanged()));
|
connect(checkbox, SIGNAL(toggled(bool)), this, SIGNAL(selectionChanged()));
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ void DiagramView::handleTitleBlockDrop(QDropEvent *e) {
|
|||||||
QString integrated_template_name = tbt_loc.name();
|
QString integrated_template_name = tbt_loc.name();
|
||||||
if (mustIntegrateTitleBlockTemplate(tbt_loc))
|
if (mustIntegrateTitleBlockTemplate(tbt_loc))
|
||||||
{
|
{
|
||||||
IntegrationMoveTitleBlockTemplatesHandler *handler = new IntegrationMoveTitleBlockTemplatesHandler(this);
|
auto *handler = new IntegrationMoveTitleBlockTemplatesHandler(this);
|
||||||
//QString error_message;
|
//QString error_message;
|
||||||
integrated_template_name = m_diagram->project()->integrateTitleBlockTemplate(tbt_loc, handler);
|
integrated_template_name = m_diagram->project()->integrateTitleBlockTemplate(tbt_loc, handler);
|
||||||
|
|
||||||
@@ -507,7 +507,7 @@ bool DiagramView::gestureEvent(QGestureEvent *event)
|
|||||||
{
|
{
|
||||||
if (QGesture *gesture = event->gesture(Qt::PinchGesture))
|
if (QGesture *gesture = event->gesture(Qt::PinchGesture))
|
||||||
{
|
{
|
||||||
QPinchGesture *pinch = static_cast<QPinchGesture *>(gesture);
|
auto *pinch = static_cast<QPinchGesture *>(gesture);
|
||||||
if (pinch->changeFlags() & QPinchGesture::ScaleFactorChanged)
|
if (pinch->changeFlags() & QPinchGesture::ScaleFactorChanged)
|
||||||
{
|
{
|
||||||
qreal value = gesture->property("scaleFactor").toReal();
|
qreal value = gesture->property("scaleFactor").toReal();
|
||||||
@@ -831,7 +831,7 @@ void DiagramView::editConductorColor(Conductor *edited_conductor)
|
|||||||
ConductorProperties initial_properties = edited_conductor -> properties();
|
ConductorProperties initial_properties = edited_conductor -> properties();
|
||||||
|
|
||||||
// prepare a color dialog showing the initial conductor color
|
// prepare a color dialog showing the initial conductor color
|
||||||
QColorDialog *color_dialog = new QColorDialog(this);
|
auto *color_dialog = new QColorDialog(this);
|
||||||
color_dialog -> setWindowTitle(tr("Choisir la nouvelle couleur de ce conducteur"));
|
color_dialog -> setWindowTitle(tr("Choisir la nouvelle couleur de ce conducteur"));
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
color_dialog -> setWindowFlags(Qt::Sheet);
|
color_dialog -> setWindowFlags(Qt::Sheet);
|
||||||
@@ -850,7 +850,7 @@ void DiagramView::editConductorColor(Conductor *edited_conductor)
|
|||||||
initial_properties.color = new_color;
|
initial_properties.color = new_color;
|
||||||
new_value.setValue(initial_properties);
|
new_value.setValue(initial_properties);
|
||||||
|
|
||||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(edited_conductor, "properties", old_value, new_value);
|
auto *undo = new QPropertyUndoCommand(edited_conductor, "properties", old_value, new_value);
|
||||||
undo->setText(tr("Modifier les propriétés d'un conducteur", "undo caption"));
|
undo->setText(tr("Modifier les propriétés d'un conducteur", "undo caption"));
|
||||||
diagram() -> undoStack().push(undo);
|
diagram() -> undoStack().push(undo);
|
||||||
}
|
}
|
||||||
@@ -958,11 +958,11 @@ bool DiagramView::isCtrlShifting(QInputEvent *e) {
|
|||||||
// note: QInputEvent::modifiers and QKeyEvent::modifiers() do not return the
|
// note: QInputEvent::modifiers and QKeyEvent::modifiers() do not return the
|
||||||
// same values, hence the casts
|
// same values, hence the casts
|
||||||
if (e -> type() == QEvent::KeyPress || e -> type() == QEvent::KeyRelease) {
|
if (e -> type() == QEvent::KeyPress || e -> type() == QEvent::KeyRelease) {
|
||||||
if (QKeyEvent *ke = static_cast<QKeyEvent *>(e)) {
|
if (auto *ke = static_cast<QKeyEvent *>(e)) {
|
||||||
result = (ke -> modifiers() == (Qt::ControlModifier | Qt::ShiftModifier));
|
result = (ke -> modifiers() == (Qt::ControlModifier | Qt::ShiftModifier));
|
||||||
}
|
}
|
||||||
} else if (e -> type() >= QEvent::MouseButtonPress && e -> type() <= QEvent::MouseMove) {
|
} else if (e -> type() >= QEvent::MouseButtonPress && e -> type() <= QEvent::MouseMove) {
|
||||||
if (QMouseEvent *me = static_cast<QMouseEvent *>(e)) {
|
if (auto *me = static_cast<QMouseEvent *>(e)) {
|
||||||
result = (me -> modifiers() == (Qt::ControlModifier | Qt::ShiftModifier));
|
result = (me -> modifiers() == (Qt::ControlModifier | Qt::ShiftModifier));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -992,11 +992,11 @@ void DiagramView::editSelection() {
|
|||||||
//We use dynamic_cast instead of qgraphicsitem_cast for QetGraphicsItem
|
//We use dynamic_cast instead of qgraphicsitem_cast for QetGraphicsItem
|
||||||
//because they haven't got they own type().
|
//because they haven't got they own type().
|
||||||
//Use qgraphicsitem_cast will have weird behavior for this class.
|
//Use qgraphicsitem_cast will have weird behavior for this class.
|
||||||
if (IndependentTextItem *iti = qgraphicsitem_cast<IndependentTextItem *>(item))
|
if (auto *iti = qgraphicsitem_cast<IndependentTextItem *>(item))
|
||||||
iti -> edit();
|
iti -> edit();
|
||||||
else if (QetGraphicsItem *qgi = dynamic_cast<QetGraphicsItem *> (item))
|
else if (auto *qgi = dynamic_cast<QetGraphicsItem *> (item))
|
||||||
qgi -> editProperty();
|
qgi -> editProperty();
|
||||||
else if (Conductor *c = qgraphicsitem_cast<Conductor *>(item))
|
else if (auto *c = qgraphicsitem_cast<Conductor *>(item))
|
||||||
c -> editProperty();
|
c -> editProperty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1084,7 +1084,7 @@ void DiagramView::contextMenuEvent(QContextMenuEvent *e)
|
|||||||
QList <QAction *> list = contextMenuActions();
|
QList <QAction *> list = contextMenuActions();
|
||||||
if(!list.isEmpty())
|
if(!list.isEmpty())
|
||||||
{
|
{
|
||||||
QMenu *context_menu = new QMenu(this);
|
auto *context_menu = new QMenu(this);
|
||||||
context_menu->addActions(list);
|
context_menu->addActions(list);
|
||||||
context_menu->popup(e->globalPos());
|
context_menu->popup(e->globalPos());
|
||||||
e->accept();
|
e->accept();
|
||||||
|
|||||||
@@ -47,9 +47,9 @@ ArcEditor::ArcEditor(QETElementEditor *editor, PartArc *arc, QWidget *parent) :
|
|||||||
h->setRange(-5000, 5000);
|
h->setRange(-5000, 5000);
|
||||||
v->setRange(-5000, 5000);
|
v->setRange(-5000, 5000);
|
||||||
|
|
||||||
QVBoxLayout *v_layout = new QVBoxLayout(this);
|
auto *v_layout = new QVBoxLayout(this);
|
||||||
|
|
||||||
QGridLayout *grid = new QGridLayout();
|
auto *grid = new QGridLayout();
|
||||||
grid -> addWidget(new QLabel(tr("Centre : ")), 0, 0);
|
grid -> addWidget(new QLabel(tr("Centre : ")), 0, 0);
|
||||||
grid -> addWidget(new QLabel("x"), 1, 0, Qt::AlignRight);
|
grid -> addWidget(new QLabel("x"), 1, 0, Qt::AlignRight);
|
||||||
grid -> addWidget(x, 1, 1);
|
grid -> addWidget(x, 1, 1);
|
||||||
@@ -99,7 +99,7 @@ bool ArcEditor::setPart(CustomElementPart *new_part)
|
|||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PartArc *part_arc = dynamic_cast<PartArc *>(new_part))
|
if (auto *part_arc = dynamic_cast<PartArc *>(new_part))
|
||||||
{
|
{
|
||||||
if (part == part_arc) return true;
|
if (part == part_arc) return true;
|
||||||
if (part)
|
if (part)
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ void ElementPrimitiveDecorator::setItems(const QList<QGraphicsItem *> &items)
|
|||||||
QList<CustomElementPart *> primitives;
|
QList<CustomElementPart *> primitives;
|
||||||
for(QGraphicsItem *item : items)
|
for(QGraphicsItem *item : items)
|
||||||
{
|
{
|
||||||
if (CustomElementPart *part_item = dynamic_cast<CustomElementPart *>(item))
|
if (auto *part_item = dynamic_cast<CustomElementPart *>(item))
|
||||||
{
|
{
|
||||||
primitives << part_item;
|
primitives << part_item;
|
||||||
}
|
}
|
||||||
@@ -143,7 +143,7 @@ QList<CustomElementPart *> ElementPrimitiveDecorator::items() const {
|
|||||||
QList<QGraphicsItem *> ElementPrimitiveDecorator::graphicsItems() const {
|
QList<QGraphicsItem *> ElementPrimitiveDecorator::graphicsItems() const {
|
||||||
QList<QGraphicsItem *> list;
|
QList<QGraphicsItem *> list;
|
||||||
foreach (CustomElementPart *part_item, decorated_items_) {
|
foreach (CustomElementPart *part_item, decorated_items_) {
|
||||||
if (QGraphicsItem *item = dynamic_cast<QGraphicsItem *>(part_item)) {
|
if (auto *item = dynamic_cast<QGraphicsItem *>(part_item)) {
|
||||||
list << item;
|
list << item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -555,7 +555,7 @@ void ElementPrimitiveDecorator::handlerMouseReleaseEvent(QetGraphicsHandlerItem
|
|||||||
ElementEditionCommand *command = nullptr;
|
ElementEditionCommand *command = nullptr;
|
||||||
if (current_operation_square_ > QET::NoOperation)
|
if (current_operation_square_ > QET::NoOperation)
|
||||||
{
|
{
|
||||||
ScalePartsCommand *scale_command = new ScalePartsCommand();
|
auto *scale_command = new ScalePartsCommand();
|
||||||
scale_command -> setScaledPrimitives(items());
|
scale_command -> setScaledPrimitives(items());
|
||||||
scale_command -> setTransformation(
|
scale_command -> setTransformation(
|
||||||
mapToScene(original_bounding_rect_).boundingRect(),
|
mapToScene(original_bounding_rect_).boundingRect(),
|
||||||
@@ -717,7 +717,7 @@ bool ElementPrimitiveDecorator::sceneEventFilter(QGraphicsItem *watched, QEvent
|
|||||||
//Watched must be an handler
|
//Watched must be an handler
|
||||||
if(watched->type() == QetGraphicsHandlerItem::Type)
|
if(watched->type() == QetGraphicsHandlerItem::Type)
|
||||||
{
|
{
|
||||||
QetGraphicsHandlerItem *qghi = qgraphicsitem_cast<QetGraphicsHandlerItem *>(watched);
|
auto *qghi = qgraphicsitem_cast<QetGraphicsHandlerItem *>(watched);
|
||||||
|
|
||||||
if(m_handler_vector.contains(qghi)) //Handler must be in m_vector_index, then we can start resize
|
if(m_handler_vector.contains(qghi)) //Handler must be in m_vector_index, then we can start resize
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -416,7 +416,7 @@ const QDomDocument ElementScene::toXml(bool all_parts)
|
|||||||
{
|
{
|
||||||
//If the export concerns only the selection, the not selected part is ignored
|
//If the export concerns only the selection, the not selected part is ignored
|
||||||
if (!all_parts && !qgi -> isSelected()) continue;
|
if (!all_parts && !qgi -> isSelected()) continue;
|
||||||
if (CustomElementPart *ce = dynamic_cast<CustomElementPart *>(qgi))
|
if (auto *ce = dynamic_cast<CustomElementPart *>(qgi))
|
||||||
{
|
{
|
||||||
if (ce -> isUseless()) continue;
|
if (ce -> isUseless()) continue;
|
||||||
description.appendChild(ce -> toXml(xml_document));
|
description.appendChild(ce -> toXml(xml_document));
|
||||||
@@ -492,7 +492,7 @@ QRectF ElementScene::elementSceneGeometricRect() const{
|
|||||||
if (qgi->type() == ElementPrimitiveDecorator::Type) continue;
|
if (qgi->type() == ElementPrimitiveDecorator::Type) continue;
|
||||||
if (qgi->type() == QGraphicsRectItem::Type) continue;
|
if (qgi->type() == QGraphicsRectItem::Type) continue;
|
||||||
if (qgi->type() == PartDynamicTextField::Type) continue;
|
if (qgi->type() == PartDynamicTextField::Type) continue;
|
||||||
if (CustomElementPart *cep = dynamic_cast <CustomElementPart*> (qgi)) {
|
if (auto *cep = dynamic_cast <CustomElementPart*> (qgi)) {
|
||||||
esgr |= cep -> sceneGeometricRect();
|
esgr |= cep -> sceneGeometricRect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -675,7 +675,7 @@ void ElementScene::slot_editAuthorInformations() {
|
|||||||
#endif
|
#endif
|
||||||
dialog_author.setMinimumSize(400, 260);
|
dialog_author.setMinimumSize(400, 260);
|
||||||
dialog_author.setWindowTitle(tr("Éditer les informations sur l'auteur", "window title"));
|
dialog_author.setWindowTitle(tr("Éditer les informations sur l'auteur", "window title"));
|
||||||
QVBoxLayout *dialog_layout = new QVBoxLayout(&dialog_author);
|
auto *dialog_layout = new QVBoxLayout(&dialog_author);
|
||||||
|
|
||||||
// ajoute un champ explicatif au dialogue
|
// ajoute un champ explicatif au dialogue
|
||||||
QLabel *information_label = new QLabel(tr("Vous pouvez utiliser ce champ libre pour mentionner les auteurs de l'élément, sa licence, ou tout autre renseignement que vous jugerez utile."));
|
QLabel *information_label = new QLabel(tr("Vous pouvez utiliser ce champ libre pour mentionner les auteurs de l'élément, sa licence, ou tout autre renseignement que vous jugerez utile."));
|
||||||
@@ -684,7 +684,7 @@ void ElementScene::slot_editAuthorInformations() {
|
|||||||
dialog_layout -> addWidget(information_label);
|
dialog_layout -> addWidget(information_label);
|
||||||
|
|
||||||
// ajoute un QTextEdit au dialogue
|
// ajoute un QTextEdit au dialogue
|
||||||
QTextEdit *text_field = new QTextEdit();
|
auto *text_field = new QTextEdit();
|
||||||
text_field -> setAcceptRichText(false);
|
text_field -> setAcceptRichText(false);
|
||||||
text_field -> setPlainText(informations());
|
text_field -> setPlainText(informations());
|
||||||
text_field -> setReadOnly(is_read_only);
|
text_field -> setReadOnly(is_read_only);
|
||||||
@@ -738,7 +738,7 @@ void ElementScene::slot_editNames() {
|
|||||||
dialog.setModal(true);
|
dialog.setModal(true);
|
||||||
dialog.setMinimumSize(400, 330);
|
dialog.setMinimumSize(400, 330);
|
||||||
dialog.setWindowTitle(tr("Éditer les noms", "window title"));
|
dialog.setWindowTitle(tr("Éditer les noms", "window title"));
|
||||||
QVBoxLayout *dialog_layout = new QVBoxLayout(&dialog);
|
auto *dialog_layout = new QVBoxLayout(&dialog);
|
||||||
|
|
||||||
// ajoute un champ explicatif au dialogue
|
// ajoute un champ explicatif au dialogue
|
||||||
QLabel *information_label = new QLabel(tr("Vous pouvez spécifier le nom de l'élément dans plusieurs langues."));
|
QLabel *information_label = new QLabel(tr("Vous pouvez spécifier le nom de l'élément dans plusieurs langues."));
|
||||||
@@ -747,7 +747,7 @@ void ElementScene::slot_editNames() {
|
|||||||
dialog_layout -> addWidget(information_label);
|
dialog_layout -> addWidget(information_label);
|
||||||
|
|
||||||
// ajoute un NamesListWidget au dialogue
|
// ajoute un NamesListWidget au dialogue
|
||||||
NamesListWidget *names_widget = new NamesListWidget();
|
auto *names_widget = new NamesListWidget();
|
||||||
names_widget -> setNames(m_names_list);
|
names_widget -> setNames(m_names_list);
|
||||||
names_widget -> setReadOnly(is_read_only);
|
names_widget -> setReadOnly(is_read_only);
|
||||||
dialog_layout -> addWidget(names_widget);
|
dialog_layout -> addWidget(names_widget);
|
||||||
@@ -772,7 +772,7 @@ void ElementScene::slot_editNames() {
|
|||||||
QList<CustomElementPart *> ElementScene::primitives() const {
|
QList<CustomElementPart *> ElementScene::primitives() const {
|
||||||
QList<CustomElementPart *> primitives_list;
|
QList<CustomElementPart *> primitives_list;
|
||||||
foreach (QGraphicsItem *item, items()) {
|
foreach (QGraphicsItem *item, items()) {
|
||||||
if (CustomElementPart *primitive = dynamic_cast<CustomElementPart *>(item)) {
|
if (auto *primitive = dynamic_cast<CustomElementPart *>(item)) {
|
||||||
primitives_list << primitive;
|
primitives_list << primitive;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1001,7 +1001,7 @@ ElementContent ElementScene::loadContent(const QDomDocument &xml_document)
|
|||||||
else if (qde.tagName() == "input") cep = pdtf = new PartDynamicTextField(m_element_editor);
|
else if (qde.tagName() == "input") cep = pdtf = new PartDynamicTextField(m_element_editor);
|
||||||
else continue;
|
else continue;
|
||||||
|
|
||||||
if (QGraphicsItem *qgi = dynamic_cast<QGraphicsItem *>(cep))
|
if (auto *qgi = dynamic_cast<QGraphicsItem *>(cep))
|
||||||
{
|
{
|
||||||
if (!qgi->zValue())
|
if (!qgi->zValue())
|
||||||
qgi->setZValue(z++);
|
qgi->setZValue(z++);
|
||||||
@@ -1180,7 +1180,7 @@ void ElementScene::stackAction(ElementEditionCommand *command) {
|
|||||||
|
|
||||||
if (!command -> elementView()) {
|
if (!command -> elementView()) {
|
||||||
foreach (QGraphicsView *view, views()) {
|
foreach (QGraphicsView *view, views()) {
|
||||||
if (ElementView *element_view = dynamic_cast<ElementView *>(view)) {
|
if (auto *element_view = dynamic_cast<ElementView *>(view)) {
|
||||||
command -> setElementView(element_view);
|
command -> setElementView(element_view);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -296,7 +296,7 @@ ElementContent ElementView::paste(const QDomDocument &xml_document, const QPoint
|
|||||||
// si quelque chose a effectivement ete ajoute au schema, on cree un objet d'annulation
|
// si quelque chose a effectivement ete ajoute au schema, on cree un objet d'annulation
|
||||||
if (content_pasted.count()) {
|
if (content_pasted.count()) {
|
||||||
m_scene -> clearSelection();
|
m_scene -> clearSelection();
|
||||||
PastePartsCommand *undo_object = new PastePartsCommand(this, content_pasted);
|
auto *undo_object = new PastePartsCommand(this, content_pasted);
|
||||||
m_scene -> undoStack().push(undo_object);
|
m_scene -> undoStack().push(undo_object);
|
||||||
}
|
}
|
||||||
return(content_pasted);
|
return(content_pasted);
|
||||||
@@ -343,7 +343,7 @@ ElementContent ElementView::pasteWithOffset(const QDomDocument &xml_document) {
|
|||||||
// si quelque chose a effectivement ete ajoute au schema, on cree un objet d'annulation
|
// si quelque chose a effectivement ete ajoute au schema, on cree un objet d'annulation
|
||||||
if (content_pasted.count()) {
|
if (content_pasted.count()) {
|
||||||
m_scene -> clearSelection();
|
m_scene -> clearSelection();
|
||||||
PastePartsCommand *undo_object = new PastePartsCommand(this, content_pasted);
|
auto *undo_object = new PastePartsCommand(this, content_pasted);
|
||||||
undo_object -> setOffset(offset_paste_count_ - 1, old_start_top_left_corner, offset_paste_count_, start_top_left_corner_);
|
undo_object -> setOffset(offset_paste_count_ - 1, old_start_top_left_corner, offset_paste_count_, start_top_left_corner_);
|
||||||
m_scene -> undoStack().push(undo_object);
|
m_scene -> undoStack().push(undo_object);
|
||||||
}
|
}
|
||||||
@@ -446,7 +446,7 @@ bool ElementView::event(QEvent *e) {
|
|||||||
*/
|
*/
|
||||||
bool ElementView::gestureEvent(QGestureEvent *event){
|
bool ElementView::gestureEvent(QGestureEvent *event){
|
||||||
if (QGesture *gesture = event->gesture(Qt::PinchGesture)) {
|
if (QGesture *gesture = event->gesture(Qt::PinchGesture)) {
|
||||||
QPinchGesture *pinch = static_cast<QPinchGesture *>(gesture);
|
auto *pinch = static_cast<QPinchGesture *>(gesture);
|
||||||
if (pinch->changeFlags() & QPinchGesture::ScaleFactorChanged){
|
if (pinch->changeFlags() & QPinchGesture::ScaleFactorChanged){
|
||||||
qreal value = gesture->property("scaleFactor").toReal();
|
qreal value = gesture->property("scaleFactor").toReal();
|
||||||
if (value > 1){
|
if (value > 1){
|
||||||
@@ -515,9 +515,9 @@ void ElementView::drawBackground(QPainter *p, const QRectF &r) {
|
|||||||
qreal limite_x = r.x() + r.width();
|
qreal limite_x = r.x() + r.width();
|
||||||
qreal limite_y = r.y() + r.height();
|
qreal limite_y = r.y() + r.height();
|
||||||
|
|
||||||
int g_x = (int)ceil(r.x());
|
auto g_x = (int)ceil(r.x());
|
||||||
while (g_x % drawn_x_grid) ++ g_x;
|
while (g_x % drawn_x_grid) ++ g_x;
|
||||||
int g_y = (int)ceil(r.y());
|
auto g_y = (int)ceil(r.y());
|
||||||
while (g_y % drawn_y_grid) ++ g_y;
|
while (g_y % drawn_y_grid) ++ g_y;
|
||||||
|
|
||||||
for (int gx = g_x ; gx < limite_x ; gx += drawn_x_grid) {
|
for (int gx = g_x ; gx < limite_x ; gx += drawn_x_grid) {
|
||||||
|
|||||||
@@ -44,9 +44,9 @@ EllipseEditor::EllipseEditor(QETElementEditor *editor, PartEllipse *ellipse, QWi
|
|||||||
h->setRange(-5000, 5000);
|
h->setRange(-5000, 5000);
|
||||||
v->setRange(-5000, 5000);
|
v->setRange(-5000, 5000);
|
||||||
|
|
||||||
QVBoxLayout *v_layout = new QVBoxLayout(this);
|
auto *v_layout = new QVBoxLayout(this);
|
||||||
|
|
||||||
QGridLayout *grid = new QGridLayout();
|
auto *grid = new QGridLayout();
|
||||||
grid -> addWidget(new QLabel(tr("Centre : ")), 0, 0);
|
grid -> addWidget(new QLabel(tr("Centre : ")), 0, 0);
|
||||||
grid -> addWidget(new QLabel("x"), 1, 0, Qt::AlignRight);
|
grid -> addWidget(new QLabel("x"), 1, 0, Qt::AlignRight);
|
||||||
grid -> addWidget(x, 1, 1);
|
grid -> addWidget(x, 1, 1);
|
||||||
@@ -88,7 +88,7 @@ bool EllipseEditor::setPart(CustomElementPart *new_part)
|
|||||||
style_ -> setPart(nullptr);
|
style_ -> setPart(nullptr);
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
if (PartEllipse *part_ellipse = dynamic_cast<PartEllipse *>(new_part))
|
if (auto *part_ellipse = dynamic_cast<PartEllipse *>(new_part))
|
||||||
{
|
{
|
||||||
if (part == part_ellipse) return true;
|
if (part == part_ellipse) return true;
|
||||||
if (part)
|
if (part)
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ bool PartArc::sceneEventFilter(QGraphicsItem *watched, QEvent *event)
|
|||||||
//Watched must be an handler
|
//Watched must be an handler
|
||||||
if(watched->type() == QetGraphicsHandlerItem::Type)
|
if(watched->type() == QetGraphicsHandlerItem::Type)
|
||||||
{
|
{
|
||||||
QetGraphicsHandlerItem *qghi = qgraphicsitem_cast<QetGraphicsHandlerItem *>(watched);
|
auto *qghi = qgraphicsitem_cast<QetGraphicsHandlerItem *>(watched);
|
||||||
|
|
||||||
if(m_handler_vector.contains(qghi)) //Handler must be in m_vector_index, then we can start resize
|
if(m_handler_vector.contains(qghi)) //Handler must be in m_vector_index, then we can start resize
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ bool PartEllipse::sceneEventFilter(QGraphicsItem *watched, QEvent *event)
|
|||||||
//Watched must be an handler
|
//Watched must be an handler
|
||||||
if(watched->type() == QetGraphicsHandlerItem::Type)
|
if(watched->type() == QetGraphicsHandlerItem::Type)
|
||||||
{
|
{
|
||||||
QetGraphicsHandlerItem *qghi = qgraphicsitem_cast<QetGraphicsHandlerItem *>(watched);
|
auto *qghi = qgraphicsitem_cast<QetGraphicsHandlerItem *>(watched);
|
||||||
|
|
||||||
if(m_handler_vector.contains(qghi)) //Handler must be in m_vector_index, then we can start resize
|
if(m_handler_vector.contains(qghi)) //Handler must be in m_vector_index, then we can start resize
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ bool PartLine::sceneEventFilter(QGraphicsItem *watched, QEvent *event)
|
|||||||
//Watched must be an handler
|
//Watched must be an handler
|
||||||
if(watched->type() == QetGraphicsHandlerItem::Type)
|
if(watched->type() == QetGraphicsHandlerItem::Type)
|
||||||
{
|
{
|
||||||
QetGraphicsHandlerItem *qghi = qgraphicsitem_cast<QetGraphicsHandlerItem *>(watched);
|
auto *qghi = qgraphicsitem_cast<QetGraphicsHandlerItem *>(watched);
|
||||||
|
|
||||||
if(m_handler_vector.contains(qghi)) //Handler must be in m_vector_index, then we can start resize
|
if(m_handler_vector.contains(qghi)) //Handler must be in m_vector_index, then we can start resize
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ bool PartPolygon::sceneEventFilter(QGraphicsItem *watched, QEvent *event)
|
|||||||
//Watched must be an handler
|
//Watched must be an handler
|
||||||
if(watched->type() == QetGraphicsHandlerItem::Type)
|
if(watched->type() == QetGraphicsHandlerItem::Type)
|
||||||
{
|
{
|
||||||
QetGraphicsHandlerItem *qghi = qgraphicsitem_cast<QetGraphicsHandlerItem *>(watched);
|
auto *qghi = qgraphicsitem_cast<QetGraphicsHandlerItem *>(watched);
|
||||||
|
|
||||||
if(m_handler_vector.contains(qghi)) //Handler must be in m_vector_index, then we can start resize
|
if(m_handler_vector.contains(qghi)) //Handler must be in m_vector_index, then we can start resize
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -322,7 +322,7 @@ bool PartRectangle::sceneEventFilter(QGraphicsItem *watched, QEvent *event)
|
|||||||
//Watched must be an handler
|
//Watched must be an handler
|
||||||
if(watched->type() == QetGraphicsHandlerItem::Type)
|
if(watched->type() == QetGraphicsHandlerItem::Type)
|
||||||
{
|
{
|
||||||
QetGraphicsHandlerItem *qghi = qgraphicsitem_cast<QetGraphicsHandlerItem *>(watched);
|
auto *qghi = qgraphicsitem_cast<QetGraphicsHandlerItem *>(watched);
|
||||||
|
|
||||||
if(m_handler_vector.contains(qghi)) //Handler must be in m_vector_index, then we can start resize
|
if(m_handler_vector.contains(qghi)) //Handler must be in m_vector_index, then we can start resize
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ LineEditor::LineEditor(QETElementEditor *editor, PartLine *line, QWidget *parent
|
|||||||
end1_length = new QDoubleSpinBox();
|
end1_length = new QDoubleSpinBox();
|
||||||
end2_length = new QDoubleSpinBox();
|
end2_length = new QDoubleSpinBox();
|
||||||
|
|
||||||
QGridLayout *grid = new QGridLayout();
|
auto *grid = new QGridLayout();
|
||||||
grid -> addWidget(new QLabel("x1"), 0, 0);
|
grid -> addWidget(new QLabel("x1"), 0, 0);
|
||||||
grid -> addWidget(x1, 0, 1);
|
grid -> addWidget(x1, 0, 1);
|
||||||
grid -> addWidget(new QLabel("y1"), 0, 2);
|
grid -> addWidget(new QLabel("y1"), 0, 2);
|
||||||
@@ -72,7 +72,7 @@ LineEditor::LineEditor(QETElementEditor *editor, PartLine *line, QWidget *parent
|
|||||||
grid -> addWidget(new QLabel("y2"), 1, 2);
|
grid -> addWidget(new QLabel("y2"), 1, 2);
|
||||||
grid -> addWidget(y2, 1, 3);
|
grid -> addWidget(y2, 1, 3);
|
||||||
|
|
||||||
QGridLayout *grid2 = new QGridLayout();
|
auto *grid2 = new QGridLayout();
|
||||||
grid2 -> addWidget(new QLabel(tr("Fin 1")), 0, 0);
|
grid2 -> addWidget(new QLabel(tr("Fin 1")), 0, 0);
|
||||||
grid2 -> addWidget(end1_type, 0, 1);
|
grid2 -> addWidget(end1_type, 0, 1);
|
||||||
grid2 -> addWidget(end1_length, 0, 2);
|
grid2 -> addWidget(end1_length, 0, 2);
|
||||||
@@ -80,7 +80,7 @@ LineEditor::LineEditor(QETElementEditor *editor, PartLine *line, QWidget *parent
|
|||||||
grid2 -> addWidget(end2_type, 1, 1);
|
grid2 -> addWidget(end2_type, 1, 1);
|
||||||
grid2 -> addWidget(end2_length, 1, 2);
|
grid2 -> addWidget(end2_length, 1, 2);
|
||||||
|
|
||||||
QVBoxLayout *v_layout = new QVBoxLayout(this);
|
auto *v_layout = new QVBoxLayout(this);
|
||||||
v_layout -> addWidget(style_);
|
v_layout -> addWidget(style_);
|
||||||
v_layout -> addLayout(grid);
|
v_layout -> addLayout(grid);
|
||||||
v_layout -> addLayout(grid2);
|
v_layout -> addLayout(grid2);
|
||||||
@@ -115,7 +115,7 @@ bool LineEditor::setPart(CustomElementPart *new_part)
|
|||||||
style_ -> setPart(nullptr);
|
style_ -> setPart(nullptr);
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
if (PartLine *part_line = dynamic_cast<PartLine *>(new_part))
|
if (auto *part_line = dynamic_cast<PartLine *>(new_part))
|
||||||
{
|
{
|
||||||
if (part == part_line) return true;
|
if (part == part_line) return true;
|
||||||
if (part)
|
if (part)
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ PolygonEditor::PolygonEditor(QETElementEditor *editor, PartPolygon *p, QWidget *
|
|||||||
updateForm();
|
updateForm();
|
||||||
|
|
||||||
// layout
|
// layout
|
||||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
auto *layout = new QVBoxLayout(this);
|
||||||
layout -> addWidget(style_);
|
layout -> addWidget(style_);
|
||||||
layout -> addWidget(new QLabel(tr("Points du polygone :")));
|
layout -> addWidget(new QLabel(tr("Points du polygone :")));
|
||||||
layout -> addWidget(&points_list);
|
layout -> addWidget(&points_list);
|
||||||
@@ -106,7 +106,7 @@ void PolygonEditor::updateForm() {
|
|||||||
point = part -> mapToScene(point);
|
point = part -> mapToScene(point);
|
||||||
QStringList qsl;
|
QStringList qsl;
|
||||||
qsl << QString("%1").arg(point.x()) << QString("%1").arg(point.y());
|
qsl << QString("%1").arg(point.x()) << QString("%1").arg(point.y());
|
||||||
QTreeWidgetItem *qtwi = new QTreeWidgetItem(qsl);
|
auto *qtwi = new QTreeWidgetItem(qsl);
|
||||||
qtwi -> setFlags(Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable);
|
qtwi -> setFlags(Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable);
|
||||||
points_list.addTopLevelItem(qtwi);
|
points_list.addTopLevelItem(qtwi);
|
||||||
}
|
}
|
||||||
@@ -135,7 +135,7 @@ bool PolygonEditor::setPart(CustomElementPart *new_part)
|
|||||||
style_ -> setPart(nullptr);
|
style_ -> setPart(nullptr);
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
if (PartPolygon *part_polygon = dynamic_cast<PartPolygon *>(new_part))
|
if (auto *part_polygon = dynamic_cast<PartPolygon *>(new_part))
|
||||||
{
|
{
|
||||||
if (part == part_polygon) return true;
|
if (part == part_polygon) return true;
|
||||||
if (part)
|
if (part)
|
||||||
|
|||||||
@@ -537,7 +537,7 @@ void QETElementEditor::setupInterface()
|
|||||||
m_undo_dock -> setFeatures(QDockWidget::AllDockWidgetFeatures);
|
m_undo_dock -> setFeatures(QDockWidget::AllDockWidgetFeatures);
|
||||||
m_undo_dock -> setMinimumWidth(290);
|
m_undo_dock -> setMinimumWidth(290);
|
||||||
addDockWidget(Qt::RightDockWidgetArea, m_undo_dock);
|
addDockWidget(Qt::RightDockWidgetArea, m_undo_dock);
|
||||||
QUndoView* undo_view = new QUndoView(&(m_elmt_scene -> undoStack()), this);
|
auto* undo_view = new QUndoView(&(m_elmt_scene -> undoStack()), this);
|
||||||
undo_view -> setEmptyLabel(tr("Aucune modification"));
|
undo_view -> setEmptyLabel(tr("Aucune modification"));
|
||||||
m_undo_dock -> setWidget(undo_view);
|
m_undo_dock -> setWidget(undo_view);
|
||||||
|
|
||||||
@@ -596,7 +596,7 @@ void QETElementEditor::slot_updateInformations()
|
|||||||
style_editable = true;
|
style_editable = true;
|
||||||
foreach (QGraphicsItem *qgi, selected_qgis)
|
foreach (QGraphicsItem *qgi, selected_qgis)
|
||||||
{
|
{
|
||||||
if (CustomElementPart *cep = dynamic_cast<CustomElementPart *>(qgi))
|
if (auto *cep = dynamic_cast<CustomElementPart *>(qgi))
|
||||||
cep_list << cep;
|
cep_list << cep;
|
||||||
else
|
else
|
||||||
style_editable = false;
|
style_editable = false;
|
||||||
@@ -609,11 +609,11 @@ void QETElementEditor::slot_updateInformations()
|
|||||||
if(selected_qgis.size() == 1)
|
if(selected_qgis.size() == 1)
|
||||||
{
|
{
|
||||||
QGraphicsItem *qgi = selected_qgis.first();
|
QGraphicsItem *qgi = selected_qgis.first();
|
||||||
if (CustomElementPart *selection = dynamic_cast<CustomElementPart *>(qgi))
|
if (auto *selection = dynamic_cast<CustomElementPart *>(qgi))
|
||||||
{
|
{
|
||||||
if (QWidget *widget = m_tools_dock_stack->widget(1))
|
if (QWidget *widget = m_tools_dock_stack->widget(1))
|
||||||
{
|
{
|
||||||
if (ElementItemEditor *editor = dynamic_cast<ElementItemEditor *>(widget))
|
if (auto *editor = dynamic_cast<ElementItemEditor *>(widget))
|
||||||
{
|
{
|
||||||
if(editor->currentPart() == selection)
|
if(editor->currentPart() == selection)
|
||||||
return;
|
return;
|
||||||
@@ -626,11 +626,11 @@ void QETElementEditor::slot_updateInformations()
|
|||||||
if (selected_qgis.size() == 1)
|
if (selected_qgis.size() == 1)
|
||||||
{
|
{
|
||||||
QGraphicsItem *qgi = selected_qgis.first();
|
QGraphicsItem *qgi = selected_qgis.first();
|
||||||
if (CustomElementPart *selection = dynamic_cast<CustomElementPart *>(qgi))
|
if (auto *selection = dynamic_cast<CustomElementPart *>(qgi))
|
||||||
{
|
{
|
||||||
//The current editor already edit the selected part
|
//The current editor already edit the selected part
|
||||||
if (QWidget *widget = m_tools_dock_stack->widget(1))
|
if (QWidget *widget = m_tools_dock_stack->widget(1))
|
||||||
if (ElementItemEditor *editor = dynamic_cast<ElementItemEditor *>(widget))
|
if (auto *editor = dynamic_cast<ElementItemEditor *>(widget))
|
||||||
if(editor->currentPart() == selection)
|
if(editor->currentPart() == selection)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -1065,7 +1065,7 @@ QString program = (QDir::homePath() + "/.qet/DXFtoQET.app");
|
|||||||
QString program = (QDir::homePath() + "/.qet/DXFtoQET");
|
QString program = (QDir::homePath() + "/.qet/DXFtoQET");
|
||||||
#endif
|
#endif
|
||||||
QStringList arguments;
|
QStringList arguments;
|
||||||
QProcess *DXF = new QProcess(qApp);
|
auto *DXF = new QProcess(qApp);
|
||||||
DXF->start(program,arguments);
|
DXF->start(program,arguments);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1336,9 +1336,9 @@ void QETElementEditor::slot_createPartsList() {
|
|||||||
if (qgis.count() <= QET_MAX_PARTS_IN_ELEMENT_EDITOR_LIST) {
|
if (qgis.count() <= QET_MAX_PARTS_IN_ELEMENT_EDITOR_LIST) {
|
||||||
for (int j = qgis.count() - 1 ; j >= 0 ; -- j) {
|
for (int j = qgis.count() - 1 ; j >= 0 ; -- j) {
|
||||||
QGraphicsItem *qgi = qgis[j];
|
QGraphicsItem *qgi = qgis[j];
|
||||||
if (CustomElementPart *cep = dynamic_cast<CustomElementPart *>(qgi)) {
|
if (auto *cep = dynamic_cast<CustomElementPart *>(qgi)) {
|
||||||
QString part_desc = cep -> name();
|
QString part_desc = cep -> name();
|
||||||
QListWidgetItem *qlwi = new QListWidgetItem(part_desc);
|
auto *qlwi = new QListWidgetItem(part_desc);
|
||||||
QVariant v;
|
QVariant v;
|
||||||
v.setValue<QGraphicsItem *>(qgi);
|
v.setValue<QGraphicsItem *>(qgi);
|
||||||
qlwi -> setData(42, v);
|
qlwi -> setData(42, v);
|
||||||
@@ -1382,7 +1382,7 @@ void QETElementEditor::slot_updateSelectionFromPartsList() {
|
|||||||
m_parts_list -> blockSignals(true);
|
m_parts_list -> blockSignals(true);
|
||||||
for (int i = 0 ; i < m_parts_list -> count() ; ++ i) {
|
for (int i = 0 ; i < m_parts_list -> count() ; ++ i) {
|
||||||
QListWidgetItem *qlwi = m_parts_list -> item(i);
|
QListWidgetItem *qlwi = m_parts_list -> item(i);
|
||||||
QGraphicsItem *qgi = qlwi -> data(42).value<QGraphicsItem *>();
|
auto *qgi = qlwi -> data(42).value<QGraphicsItem *>();
|
||||||
if (qgi) {
|
if (qgi) {
|
||||||
qgi -> setSelected(qlwi -> isSelected());
|
qgi -> setSelected(qlwi -> isSelected());
|
||||||
}
|
}
|
||||||
@@ -1578,7 +1578,7 @@ void QETElementEditor::updateCurrentPartEditor() {
|
|||||||
if (!m_tools_dock_stack -> currentIndex()) return;
|
if (!m_tools_dock_stack -> currentIndex()) return;
|
||||||
|
|
||||||
// s'il y a un widget d'edition affiche, on le met a jour
|
// s'il y a un widget d'edition affiche, on le met a jour
|
||||||
if (ElementItemEditor *current_editor = dynamic_cast<ElementItemEditor *>(m_tools_dock_stack->widget(1))) {
|
if (auto *current_editor = dynamic_cast<ElementItemEditor *>(m_tools_dock_stack->widget(1))) {
|
||||||
current_editor -> updateForm();
|
current_editor -> updateForm();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ StyleEditor::StyleEditor(QETElementEditor *editor, CustomElementGraphicPart *p,
|
|||||||
|
|
||||||
main_layout -> addWidget(new QLabel("<u>" + tr("Apparence :") + "</u> "));
|
main_layout -> addWidget(new QLabel("<u>" + tr("Apparence :") + "</u> "));
|
||||||
|
|
||||||
QHBoxLayout *color_layout = new QHBoxLayout();
|
auto *color_layout = new QHBoxLayout();
|
||||||
color_layout -> addWidget(new QLabel(tr("Contour :")), 0, Qt::AlignRight);
|
color_layout -> addWidget(new QLabel(tr("Contour :")), 0, Qt::AlignRight);
|
||||||
color_layout -> addWidget(outline_color);
|
color_layout -> addWidget(outline_color);
|
||||||
color_layout -> addSpacing(10);
|
color_layout -> addSpacing(10);
|
||||||
@@ -106,7 +106,7 @@ StyleEditor::StyleEditor(QETElementEditor *editor, CustomElementGraphicPart *p,
|
|||||||
color_layout -> addWidget(filling_color);
|
color_layout -> addWidget(filling_color);
|
||||||
main_layout -> addLayout(color_layout);
|
main_layout -> addLayout(color_layout);
|
||||||
|
|
||||||
QHBoxLayout *style_layout = new QHBoxLayout();
|
auto *style_layout = new QHBoxLayout();
|
||||||
style_layout -> addWidget(new QLabel(tr("Style : ")), 0, Qt::AlignRight);
|
style_layout -> addWidget(new QLabel(tr("Style : ")), 0, Qt::AlignRight);
|
||||||
style_layout -> addWidget(line_style);
|
style_layout -> addWidget(line_style);
|
||||||
style_layout -> addSpacing(10);
|
style_layout -> addSpacing(10);
|
||||||
@@ -205,7 +205,7 @@ bool StyleEditor::setPart(CustomElementPart *new_part) {
|
|||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CustomElementGraphicPart *part_graphic = dynamic_cast<CustomElementGraphicPart *>(new_part))
|
if (auto *part_graphic = dynamic_cast<CustomElementGraphicPart *>(new_part))
|
||||||
{
|
{
|
||||||
part = part_graphic;
|
part = part_graphic;
|
||||||
updateForm();
|
updateForm();
|
||||||
@@ -237,7 +237,7 @@ bool StyleEditor::setParts(QList<CustomElementPart *> part_list)
|
|||||||
|
|
||||||
foreach (CustomElementPart *cep, part_list)
|
foreach (CustomElementPart *cep, part_list)
|
||||||
{
|
{
|
||||||
if (CustomElementGraphicPart *cegp = dynamic_cast<CustomElementGraphicPart *>(cep))
|
if (auto *cegp = dynamic_cast<CustomElementGraphicPart *>(cep))
|
||||||
m_part_list << cegp;
|
m_part_list << cegp;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -48,17 +48,17 @@ TerminalEditor::TerminalEditor(QETElementEditor *editor, PartTerminal *term, QWi
|
|||||||
orientation -> addItem(QET::Icons::South, tr("Sud"), Qet::South);
|
orientation -> addItem(QET::Icons::South, tr("Sud"), Qet::South);
|
||||||
orientation -> addItem(QET::Icons::West, tr("Ouest"), Qet::West);
|
orientation -> addItem(QET::Icons::West, tr("Ouest"), Qet::West);
|
||||||
|
|
||||||
QVBoxLayout *main_layout = new QVBoxLayout();
|
auto *main_layout = new QVBoxLayout();
|
||||||
main_layout -> addWidget(new QLabel(tr("Position : ")));
|
main_layout -> addWidget(new QLabel(tr("Position : ")));
|
||||||
|
|
||||||
QHBoxLayout *position = new QHBoxLayout();
|
auto *position = new QHBoxLayout();
|
||||||
position -> addWidget(new QLabel(tr("x : ")));
|
position -> addWidget(new QLabel(tr("x : ")));
|
||||||
position -> addWidget(qle_x );
|
position -> addWidget(qle_x );
|
||||||
position -> addWidget(new QLabel(tr("y : ")));
|
position -> addWidget(new QLabel(tr("y : ")));
|
||||||
position -> addWidget(qle_y );
|
position -> addWidget(qle_y );
|
||||||
main_layout -> addLayout(position);
|
main_layout -> addLayout(position);
|
||||||
|
|
||||||
QHBoxLayout *ori = new QHBoxLayout();
|
auto *ori = new QHBoxLayout();
|
||||||
ori -> addWidget(new QLabel(tr("Orientation : ")));
|
ori -> addWidget(new QLabel(tr("Orientation : ")));
|
||||||
ori -> addWidget(orientation );
|
ori -> addWidget(orientation );
|
||||||
main_layout -> addLayout(ori);
|
main_layout -> addLayout(ori);
|
||||||
@@ -91,7 +91,7 @@ bool TerminalEditor::setPart(CustomElementPart *new_part)
|
|||||||
part = nullptr;
|
part = nullptr;
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
if (PartTerminal *part_terminal = dynamic_cast<PartTerminal *>(new_part))
|
if (auto *part_terminal = dynamic_cast<PartTerminal *>(new_part))
|
||||||
{
|
{
|
||||||
if(part == part_terminal) return true;
|
if(part == part_terminal) return true;
|
||||||
if (part)
|
if (part)
|
||||||
|
|||||||
@@ -51,33 +51,33 @@ TextEditor::TextEditor(QETElementEditor *editor, PartText *text, QWidget *parent
|
|||||||
qle_x -> setRange(-5000, 5000);
|
qle_x -> setRange(-5000, 5000);
|
||||||
qle_y -> setRange(-5000, 5000);
|
qle_y -> setRange(-5000, 5000);
|
||||||
|
|
||||||
QVBoxLayout *main_layout = new QVBoxLayout();
|
auto *main_layout = new QVBoxLayout();
|
||||||
main_layout -> addWidget(new QLabel(tr("Position : ")));
|
main_layout -> addWidget(new QLabel(tr("Position : ")));
|
||||||
|
|
||||||
QHBoxLayout *position = new QHBoxLayout();
|
auto *position = new QHBoxLayout();
|
||||||
position -> addWidget(new QLabel(tr("x : ")));
|
position -> addWidget(new QLabel(tr("x : ")));
|
||||||
position -> addWidget(qle_x );
|
position -> addWidget(qle_x );
|
||||||
position -> addWidget(new QLabel(tr("y : ")));
|
position -> addWidget(new QLabel(tr("y : ")));
|
||||||
position -> addWidget(qle_y );
|
position -> addWidget(qle_y );
|
||||||
main_layout -> addLayout(position);
|
main_layout -> addLayout(position);
|
||||||
|
|
||||||
QHBoxLayout *fs = new QHBoxLayout();
|
auto *fs = new QHBoxLayout();
|
||||||
fs -> addWidget(new QLabel(tr("Taille : ")));
|
fs -> addWidget(new QLabel(tr("Taille : ")));
|
||||||
fs -> addWidget(font_size);
|
fs -> addWidget(font_size);
|
||||||
main_layout -> addLayout(fs);
|
main_layout -> addLayout(fs);
|
||||||
|
|
||||||
QHBoxLayout *color_layout = new QHBoxLayout();
|
auto *color_layout = new QHBoxLayout();
|
||||||
color_layout -> addWidget(new QLabel(tr("Couleur : ")));
|
color_layout -> addWidget(new QLabel(tr("Couleur : ")));
|
||||||
color_layout -> addWidget(black_color_);
|
color_layout -> addWidget(black_color_);
|
||||||
color_layout -> addWidget(white_color_);
|
color_layout -> addWidget(white_color_);
|
||||||
color_layout -> addStretch();
|
color_layout -> addStretch();
|
||||||
main_layout -> addLayout(color_layout);
|
main_layout -> addLayout(color_layout);
|
||||||
|
|
||||||
QHBoxLayout *t = new QHBoxLayout();
|
auto *t = new QHBoxLayout();
|
||||||
t -> addWidget(new QLabel(tr("Texte : ")));
|
t -> addWidget(new QLabel(tr("Texte : ")));
|
||||||
t -> addWidget(qle_text);
|
t -> addWidget(qle_text);
|
||||||
|
|
||||||
QHBoxLayout *rotation_angle_layout = new QHBoxLayout();
|
auto *rotation_angle_layout = new QHBoxLayout();
|
||||||
rotation_angle_layout -> addWidget(rotation_angle_label);
|
rotation_angle_layout -> addWidget(rotation_angle_label);
|
||||||
rotation_angle_layout -> addWidget(rotation_angle_);
|
rotation_angle_layout -> addWidget(rotation_angle_);
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@ bool TextEditor::setPart(CustomElementPart *new_part)
|
|||||||
part = nullptr;
|
part = nullptr;
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
if (PartText *part_text = dynamic_cast<PartText *>(new_part))
|
if (auto *part_text = dynamic_cast<PartText *>(new_part))
|
||||||
{
|
{
|
||||||
if (part == part_text) return true;
|
if (part == part_text) return true;
|
||||||
part = part_text;
|
part = part_text;
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ void DynamicTextFieldEditor::on_m_frame_cb_clicked()
|
|||||||
|
|
||||||
void DynamicTextFieldEditor::on_m_width_sb_editingFinished()
|
void DynamicTextFieldEditor::on_m_width_sb_editingFinished()
|
||||||
{
|
{
|
||||||
qreal width = (qreal)ui->m_width_sb->value();
|
auto width = (qreal)ui->m_width_sb->value();
|
||||||
|
|
||||||
if(width != m_text_field.data()->textWidth())
|
if(width != m_text_field.data()->textWidth())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ void ElementPropertiesEditorWidget::populateTree()
|
|||||||
|
|
||||||
for(const QString& key : keys)
|
for(const QString& key : keys)
|
||||||
{
|
{
|
||||||
QTreeWidgetItem *qtwi = new QTreeWidgetItem(ui->m_tree);
|
auto *qtwi = new QTreeWidgetItem(ui->m_tree);
|
||||||
qtwi->setFlags(Qt::ItemIsEnabled | Qt::ItemIsEditable);
|
qtwi->setFlags(Qt::ItemIsEnabled | Qt::ItemIsEditable);
|
||||||
qtwi->setData(0, Qt::DisplayRole, QETApp::elementTranslatedInfoKey(key));
|
qtwi->setData(0, Qt::DisplayRole, QETApp::elementTranslatedInfoKey(key));
|
||||||
qtwi->setData(0, Qt::UserRole, key);
|
qtwi->setData(0, Qt::UserRole, key);
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ bool RectangleEditor::setPart(CustomElementPart *part)
|
|||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PartRectangle *part_rectangle = dynamic_cast<PartRectangle *>(part))
|
if (auto *part_rectangle = dynamic_cast<PartRectangle *>(part))
|
||||||
{
|
{
|
||||||
if (m_part == part_rectangle) {
|
if (m_part == part_rectangle) {
|
||||||
return true;
|
return true;
|
||||||
@@ -147,7 +147,7 @@ void RectangleEditor::editingFinished()
|
|||||||
}
|
}
|
||||||
m_locked = true;
|
m_locked = true;
|
||||||
|
|
||||||
QUndoCommand *undo = new QUndoCommand();
|
auto *undo = new QUndoCommand();
|
||||||
undo->setText(tr("Modifier un rectangle"));
|
undo->setText(tr("Modifier un rectangle"));
|
||||||
|
|
||||||
QRectF rect(editedTopLeft(), QSizeF(ui->m_width_sb->value(), ui->m_height_sb->value()));
|
QRectF rect(editedTopLeft(), QSizeF(ui->m_width_sb->value(), ui->m_height_sb->value()));
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ void ElementDialog::setUpWidget()
|
|||||||
setWindowFlags(Qt::Sheet);
|
setWindowFlags(Qt::Sheet);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
auto *layout = new QVBoxLayout(this);
|
||||||
|
|
||||||
QString title_, label_;
|
QString title_, label_;
|
||||||
switch (m_mode)
|
switch (m_mode)
|
||||||
@@ -142,7 +142,7 @@ void ElementDialog::setUpConnection()
|
|||||||
*/
|
*/
|
||||||
void ElementDialog::indexClicked(const QModelIndex &index)
|
void ElementDialog::indexClicked(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
ElementCollectionItem *eci = static_cast<ElementCollectionItem*> (m_model->itemFromIndex(index));
|
auto *eci = static_cast<ElementCollectionItem*> (m_model->itemFromIndex(index));
|
||||||
m_location = ElementsLocation(eci->collectionPath());
|
m_location = ElementsLocation(eci->collectionPath());
|
||||||
checkCurrentLocation();
|
checkCurrentLocation();
|
||||||
}
|
}
|
||||||
@@ -300,7 +300,7 @@ ElementsLocation ElementDialog::getSaveElementLocation(QWidget *parentWidget) {
|
|||||||
*/
|
*/
|
||||||
ElementsLocation ElementDialog::execConfiguredDialog(int mode, QWidget *parentWidget)
|
ElementsLocation ElementDialog::execConfiguredDialog(int mode, QWidget *parentWidget)
|
||||||
{
|
{
|
||||||
ElementDialog *element_dialog = new ElementDialog(mode, parentWidget);
|
auto *element_dialog = new ElementDialog(mode, parentWidget);
|
||||||
element_dialog->exec();
|
element_dialog->exec();
|
||||||
ElementsLocation location = element_dialog->location();
|
ElementsLocation location = element_dialog->location();
|
||||||
delete element_dialog;
|
delete element_dialog;
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ ElementsLocation ElementsCategoryEditor::createdLocation() const
|
|||||||
*/
|
*/
|
||||||
void ElementsCategoryEditor::setUpWidget()
|
void ElementsCategoryEditor::setUpWidget()
|
||||||
{
|
{
|
||||||
QVBoxLayout *editor_layout = new QVBoxLayout();
|
auto *editor_layout = new QVBoxLayout();
|
||||||
setLayout(editor_layout);
|
setLayout(editor_layout);
|
||||||
|
|
||||||
m_names_list = new NamesListWidget();
|
m_names_list = new NamesListWidget();
|
||||||
@@ -109,7 +109,7 @@ void ElementsCategoryEditor::setUpWidget()
|
|||||||
m_buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
m_buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||||
connect(m_buttons, SIGNAL(rejected()), this, SLOT(reject()));
|
connect(m_buttons, SIGNAL(rejected()), this, SLOT(reject()));
|
||||||
|
|
||||||
QHBoxLayout *internal_name_layout = new QHBoxLayout();
|
auto *internal_name_layout = new QHBoxLayout();
|
||||||
internal_name_layout -> addWidget(m_file_name);
|
internal_name_layout -> addWidget(m_file_name);
|
||||||
internal_name_layout -> addWidget(m_file_line_edit);
|
internal_name_layout -> addWidget(m_file_line_edit);
|
||||||
|
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ void ElementsMover::endMovement()
|
|||||||
if (!movement_running_) return;
|
if (!movement_running_) return;
|
||||||
|
|
||||||
//empty command to be used has parent of commands below
|
//empty command to be used has parent of commands below
|
||||||
QUndoCommand *undo_object = new QUndoCommand();
|
auto *undo_object = new QUndoCommand();
|
||||||
|
|
||||||
//Create undo move if there is a movement
|
//Create undo move if there is a movement
|
||||||
if (!current_movement_.isNull()) {
|
if (!current_movement_.isNull()) {
|
||||||
@@ -151,7 +151,7 @@ void ElementsMover::endMovement()
|
|||||||
{
|
{
|
||||||
QPair <Terminal *, Terminal *> pair = elmt -> AlignedFreeTerminals().takeFirst();
|
QPair <Terminal *, Terminal *> pair = elmt -> AlignedFreeTerminals().takeFirst();
|
||||||
|
|
||||||
Conductor *conductor = new Conductor(pair.first, pair.second);
|
auto *conductor = new Conductor(pair.first, pair.second);
|
||||||
|
|
||||||
//Create an undo object for each new auto conductor, with undo_object for parent
|
//Create an undo object for each new auto conductor, with undo_object for parent
|
||||||
new AddItemCommand<Conductor *>(conductor, diagram_, QPointF(), undo_object);
|
new AddItemCommand<Conductor *>(conductor, diagram_, QPointF(), undo_object);
|
||||||
|
|||||||
@@ -98,11 +98,11 @@ void ElementsPanel::startDrag(Qt::DropActions supportedActions) {
|
|||||||
void ElementsPanel::startTitleBlockTemplateDrag(const TitleBlockTemplateLocation &location) {
|
void ElementsPanel::startTitleBlockTemplateDrag(const TitleBlockTemplateLocation &location) {
|
||||||
QString location_string = location.toString();
|
QString location_string = location.toString();
|
||||||
|
|
||||||
QMimeData *mime_data = new QMimeData();
|
auto *mime_data = new QMimeData();
|
||||||
mime_data -> setText(location_string);
|
mime_data -> setText(location_string);
|
||||||
mime_data -> setData("application/x-qet-titleblock-uri", location_string.toLatin1());
|
mime_data -> setData("application/x-qet-titleblock-uri", location_string.toLatin1());
|
||||||
|
|
||||||
QDrag *drag = new QDrag(this);
|
auto *drag = new QDrag(this);
|
||||||
drag -> setMimeData(mime_data);
|
drag -> setMimeData(mime_data);
|
||||||
drag -> setPixmap(QET::Icons::TitleBlock.pixmap(22, 16));
|
drag -> setPixmap(QET::Icons::TitleBlock.pixmap(22, 16));
|
||||||
drag -> start(Qt::CopyAction);
|
drag -> start(Qt::CopyAction);
|
||||||
@@ -232,10 +232,10 @@ void ElementsPanel::reload(bool reload_collections) {
|
|||||||
void ElementsPanel::slot_doubleClick(QTreeWidgetItem *qtwi, int) {
|
void ElementsPanel::slot_doubleClick(QTreeWidgetItem *qtwi, int) {
|
||||||
int qtwi_type = qtwi -> type();
|
int qtwi_type = qtwi -> type();
|
||||||
if (qtwi_type == QET::Project) {
|
if (qtwi_type == QET::Project) {
|
||||||
QETProject *project = valueForItem<QETProject *>(qtwi);
|
auto *project = valueForItem<QETProject *>(qtwi);
|
||||||
emit(requestForProject(project));
|
emit(requestForProject(project));
|
||||||
} else if (qtwi_type == QET::Diagram) {
|
} else if (qtwi_type == QET::Diagram) {
|
||||||
Diagram *diagram = valueForItem<Diagram *>(qtwi);
|
auto *diagram = valueForItem<Diagram *>(qtwi);
|
||||||
emit(requestForDiagram(diagram));
|
emit(requestForDiagram(diagram));
|
||||||
} else if (qtwi_type == QET::TitleBlockTemplate) {
|
} else if (qtwi_type == QET::TitleBlockTemplate) {
|
||||||
TitleBlockTemplateLocation tbt = valueForItem<TitleBlockTemplateLocation>(qtwi);
|
TitleBlockTemplateLocation tbt = valueForItem<TitleBlockTemplateLocation>(qtwi);
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ ElementsPanelWidget::ElementsPanelWidget(QWidget *parent) : QWidget(parent) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// disposition verticale
|
// disposition verticale
|
||||||
QVBoxLayout *vlayout = new QVBoxLayout(this);
|
auto *vlayout = new QVBoxLayout(this);
|
||||||
vlayout -> setMargin(0);
|
vlayout -> setMargin(0);
|
||||||
vlayout -> setSpacing(0);
|
vlayout -> setSpacing(0);
|
||||||
vlayout -> addWidget(filter_textfield);
|
vlayout -> addWidget(filter_textfield);
|
||||||
|
|||||||
@@ -238,7 +238,7 @@ void ImportElementTextPattern::apply(QString name) const
|
|||||||
//Add the texts to element
|
//Add the texts to element
|
||||||
for(const QDomElement& text : texts)
|
for(const QDomElement& text : texts)
|
||||||
{
|
{
|
||||||
DynamicElementTextItem *deti = new DynamicElementTextItem(m_element);
|
auto *deti = new DynamicElementTextItem(m_element);
|
||||||
undo_stack.push(new AddElementTextCommand(m_element, deti));
|
undo_stack.push(new AddElementTextCommand(m_element, deti));
|
||||||
deti->fromXml(text);
|
deti->fromXml(text);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ void ElementTextsMover::endMovement()
|
|||||||
|
|
||||||
for (QGraphicsItem *qgi : m_items_hash.keys())
|
for (QGraphicsItem *qgi : m_items_hash.keys())
|
||||||
{
|
{
|
||||||
if(QObject *object = dynamic_cast<QObject *>(qgi))
|
if(auto *object = dynamic_cast<QObject *>(qgi))
|
||||||
{
|
{
|
||||||
QPropertyUndoCommand *child_undo = new QPropertyUndoCommand(object, "pos", m_items_hash.value(qgi), qgi->pos(), undo);
|
QPropertyUndoCommand *child_undo = new QPropertyUndoCommand(object, "pos", m_items_hash.value(qgi), qgi->pos(), undo);
|
||||||
child_undo->enableAnimation();
|
child_undo->enableAnimation();
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ ExportDialog::ExportDialog(QETProject *project, QWidget *parent) : QDialog(paren
|
|||||||
|
|
||||||
// disposition des elements
|
// disposition des elements
|
||||||
|
|
||||||
QHBoxLayout *hLayout = new QHBoxLayout();
|
auto *hLayout = new QHBoxLayout();
|
||||||
hLayout -> addWidget(new QLabel(tr("Choisissez les folios que vous désirez exporter ainsi que leurs dimensions :")));
|
hLayout -> addWidget(new QLabel(tr("Choisissez les folios que vous désirez exporter ainsi que leurs dimensions :")));
|
||||||
selectAll = new QPushButton();
|
selectAll = new QPushButton();
|
||||||
deSelectAll = new QPushButton();
|
deSelectAll = new QPushButton();
|
||||||
@@ -83,7 +83,7 @@ ExportDialog::ExportDialog(QETProject *project, QWidget *parent) : QDialog(paren
|
|||||||
connect(deSelectAll, SIGNAL(clicked()), this, SLOT(slot_deSelectAllClicked()));
|
connect(deSelectAll, SIGNAL(clicked()), this, SLOT(slot_deSelectAllClicked()));
|
||||||
|
|
||||||
|
|
||||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
auto *layout = new QVBoxLayout(this);
|
||||||
layout -> addLayout(hLayout);
|
layout -> addLayout(hLayout);
|
||||||
layout -> addWidget(initDiagramsListPart(), 1);
|
layout -> addWidget(initDiagramsListPart(), 1);
|
||||||
layout -> addWidget(epw);
|
layout -> addWidget(epw);
|
||||||
@@ -177,7 +177,7 @@ QWidget *ExportDialog::initDiagramsListPart() {
|
|||||||
QWidget *widget_diagrams_list = new QWidget();
|
QWidget *widget_diagrams_list = new QWidget();
|
||||||
widget_diagrams_list -> setLayout(diagrams_list_layout_);
|
widget_diagrams_list -> setLayout(diagrams_list_layout_);
|
||||||
|
|
||||||
QScrollArea *scroll_diagrams_list = new QScrollArea();
|
auto *scroll_diagrams_list = new QScrollArea();
|
||||||
scroll_diagrams_list -> setWidget(widget_diagrams_list);
|
scroll_diagrams_list -> setWidget(widget_diagrams_list);
|
||||||
|
|
||||||
return(scroll_diagrams_list);
|
return(scroll_diagrams_list);
|
||||||
@@ -426,7 +426,7 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
|
|||||||
//QList<QRectF *> list_ellipses;
|
//QList<QRectF *> list_ellipses;
|
||||||
QList <QetShapeItem *> list_shapes;
|
QList <QetShapeItem *> list_shapes;
|
||||||
|
|
||||||
DiagramFolioList *ptr = dynamic_cast<DiagramFolioList *>(diagram);
|
auto *ptr = dynamic_cast<DiagramFolioList *>(diagram);
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
list_lines = ptr -> lines();
|
list_lines = ptr -> lines();
|
||||||
list_rectangles = ptr -> rectangles();
|
list_rectangles = ptr -> rectangles();
|
||||||
@@ -469,15 +469,15 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
|
|||||||
} else {
|
} else {
|
||||||
// Determine les elements a "XMLiser"
|
// Determine les elements a "XMLiser"
|
||||||
foreach(QGraphicsItem *qgi, diagram -> items()) {
|
foreach(QGraphicsItem *qgi, diagram -> items()) {
|
||||||
if (Element *elmt = qgraphicsitem_cast<Element *>(qgi)) {
|
if (auto *elmt = qgraphicsitem_cast<Element *>(qgi)) {
|
||||||
list_elements << elmt;
|
list_elements << elmt;
|
||||||
} else if (Conductor *f = qgraphicsitem_cast<Conductor *>(qgi)) {
|
} else if (auto *f = qgraphicsitem_cast<Conductor *>(qgi)) {
|
||||||
list_conductors << f;
|
list_conductors << f;
|
||||||
} else if (IndependentTextItem *iti = qgraphicsitem_cast<IndependentTextItem *>(qgi)) {
|
} else if (auto *iti = qgraphicsitem_cast<IndependentTextItem *>(qgi)) {
|
||||||
list_texts << iti;
|
list_texts << iti;
|
||||||
} else if (DiagramImageItem *dii = qgraphicsitem_cast<DiagramImageItem *>(qgi)) {
|
} else if (auto *dii = qgraphicsitem_cast<DiagramImageItem *>(qgi)) {
|
||||||
list_images << dii;
|
list_images << dii;
|
||||||
} else if (QetShapeItem *dii = qgraphicsitem_cast<QetShapeItem *>(qgi)) {
|
} else if (auto *dii = qgraphicsitem_cast<QetShapeItem *>(qgi)) {
|
||||||
list_shapes << dii;
|
list_shapes << dii;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -909,14 +909,14 @@ void ExportDialog::slot_previewDiagram(int diagram_id) {
|
|||||||
preview_dialog.setWindowTitle(tr("Aperçu"));
|
preview_dialog.setWindowTitle(tr("Aperçu"));
|
||||||
preview_dialog.setWindowState(preview_dialog.windowState() | Qt::WindowMaximized);
|
preview_dialog.setWindowState(preview_dialog.windowState() | Qt::WindowMaximized);
|
||||||
|
|
||||||
QGraphicsScene *preview_scene = new QGraphicsScene();
|
auto *preview_scene = new QGraphicsScene();
|
||||||
preview_scene -> setBackgroundBrush(Qt::lightGray);
|
preview_scene -> setBackgroundBrush(Qt::lightGray);
|
||||||
QGraphicsView *preview_view = new QGraphicsView(preview_scene);
|
auto *preview_view = new QGraphicsView(preview_scene);
|
||||||
preview_view -> setDragMode(QGraphicsView::ScrollHandDrag);
|
preview_view -> setDragMode(QGraphicsView::ScrollHandDrag);
|
||||||
QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok);
|
QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok);
|
||||||
connect(buttons, SIGNAL(accepted()), &preview_dialog, SLOT(accept()));
|
connect(buttons, SIGNAL(accepted()), &preview_dialog, SLOT(accept()));
|
||||||
|
|
||||||
QVBoxLayout *vboxlayout1 = new QVBoxLayout();
|
auto *vboxlayout1 = new QVBoxLayout();
|
||||||
vboxlayout1 -> addWidget(preview_view);
|
vboxlayout1 -> addWidget(preview_view);
|
||||||
vboxlayout1 -> addWidget(buttons);
|
vboxlayout1 -> addWidget(buttons);
|
||||||
preview_dialog.setLayout(vboxlayout1);
|
preview_dialog.setLayout(vboxlayout1);
|
||||||
@@ -1050,7 +1050,7 @@ ExportDialog::ExportDiagramLine::~ExportDiagramLine() {
|
|||||||
taille d'un schema avant son export.
|
taille d'un schema avant son export.
|
||||||
*/
|
*/
|
||||||
QBoxLayout *ExportDialog::ExportDiagramLine::sizeLayout() {
|
QBoxLayout *ExportDialog::ExportDiagramLine::sizeLayout() {
|
||||||
QHBoxLayout *layout = new QHBoxLayout();
|
auto *layout = new QHBoxLayout();
|
||||||
layout -> addWidget(width);
|
layout -> addWidget(width);
|
||||||
layout -> addWidget(x_label);
|
layout -> addWidget(x_label);
|
||||||
layout -> addWidget(height);
|
layout -> addWidget(height);
|
||||||
|
|||||||
@@ -118,14 +118,14 @@ void ExportPropertiesWidget::slot_chooseADirectory() {
|
|||||||
*/
|
*/
|
||||||
void ExportPropertiesWidget::build() {
|
void ExportPropertiesWidget::build() {
|
||||||
// le dialogue est un empilement vertical d'elements
|
// le dialogue est un empilement vertical d'elements
|
||||||
QVBoxLayout *vboxLayout = new QVBoxLayout();
|
auto *vboxLayout = new QVBoxLayout();
|
||||||
vboxLayout -> setContentsMargins(0, 0, 0, 0);
|
vboxLayout -> setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
/* le dialogue comprend une ligne permettant d'indiquer un chemin de dossier (hboxLayout) */
|
/* le dialogue comprend une ligne permettant d'indiquer un chemin de dossier (hboxLayout) */
|
||||||
QHBoxLayout *hboxLayout = new QHBoxLayout();
|
auto *hboxLayout = new QHBoxLayout();
|
||||||
dirpath_label = new QLabel(tr("Dossier cible :"), this);
|
dirpath_label = new QLabel(tr("Dossier cible :"), this);
|
||||||
dirpath = new QLineEdit(this);
|
dirpath = new QLineEdit(this);
|
||||||
QCompleter *completer = new QCompleter(this);
|
auto *completer = new QCompleter(this);
|
||||||
completer -> setModel(new QDirModel(completer));
|
completer -> setModel(new QDirModel(completer));
|
||||||
dirpath -> setCompleter(completer);
|
dirpath -> setCompleter(completer);
|
||||||
button_browse = new QPushButton(tr("Parcourir"), this);
|
button_browse = new QPushButton(tr("Parcourir"), this);
|
||||||
@@ -137,7 +137,7 @@ void ExportPropertiesWidget::build() {
|
|||||||
vboxLayout -> addLayout(hboxLayout);
|
vboxLayout -> addLayout(hboxLayout);
|
||||||
|
|
||||||
/* une ligne permettant de choisir le format (hboxLayout1) */
|
/* une ligne permettant de choisir le format (hboxLayout1) */
|
||||||
QHBoxLayout *hboxLayout1 = new QHBoxLayout();
|
auto *hboxLayout1 = new QHBoxLayout();
|
||||||
format_label = new QLabel(tr("Format :"), this);
|
format_label = new QLabel(tr("Format :"), this);
|
||||||
hboxLayout1 -> addWidget(format_label);
|
hboxLayout1 -> addWidget(format_label);
|
||||||
hboxLayout1 -> addWidget(format = new QComboBox(this));
|
hboxLayout1 -> addWidget(format = new QComboBox(this));
|
||||||
@@ -152,7 +152,7 @@ void ExportPropertiesWidget::build() {
|
|||||||
|
|
||||||
/* un cadre permettant de specifier les options de l'image finale */
|
/* un cadre permettant de specifier les options de l'image finale */
|
||||||
QGroupBox *groupbox_options = new QGroupBox(tr("Options de rendu", "groupbox title"));
|
QGroupBox *groupbox_options = new QGroupBox(tr("Options de rendu", "groupbox title"));
|
||||||
QGridLayout *optionshlayout = new QGridLayout(groupbox_options);
|
auto *optionshlayout = new QGridLayout(groupbox_options);
|
||||||
|
|
||||||
// Choix de la zone du schema a exporter
|
// Choix de la zone du schema a exporter
|
||||||
exported_content_choices = new QButtonGroup(groupbox_options);
|
exported_content_choices = new QButtonGroup(groupbox_options);
|
||||||
|
|||||||
@@ -579,7 +579,7 @@ void GenericPanel::projectDiagramsOrderChanged(QETProject *project, int from, in
|
|||||||
QTreeWidgetItem *qtwi_diagram = qtwi_project -> child(i);
|
QTreeWidgetItem *qtwi_diagram = qtwi_project -> child(i);
|
||||||
if (!qtwi_diagram) continue;
|
if (!qtwi_diagram) continue;
|
||||||
|
|
||||||
Diagram *diagram = valueForItem<Diagram *>(qtwi_diagram);
|
auto *diagram = valueForItem<Diagram *>(qtwi_diagram);
|
||||||
if (diagram)
|
if (diagram)
|
||||||
updateDiagramItem(qtwi_diagram, diagram);
|
updateDiagramItem(qtwi_diagram, diagram);
|
||||||
}
|
}
|
||||||
@@ -665,7 +665,7 @@ QIcon GenericPanel::defaultIcon(QET::ItemType type) {
|
|||||||
@return the create QTreeWidgetItem
|
@return the create QTreeWidgetItem
|
||||||
*/
|
*/
|
||||||
QTreeWidgetItem *GenericPanel::makeItem(QET::ItemType type, QTreeWidgetItem *parent, const QString &label, const QIcon &icon) {
|
QTreeWidgetItem *GenericPanel::makeItem(QET::ItemType type, QTreeWidgetItem *parent, const QString &label, const QIcon &icon) {
|
||||||
QTreeWidgetItem *qtwi = new QTreeWidgetItem(parent, type);
|
auto *qtwi = new QTreeWidgetItem(parent, type);
|
||||||
qtwi -> setText(0, label.isEmpty() ? defaultText(type) : label);
|
qtwi -> setText(0, label.isEmpty() ? defaultText(type) : label);
|
||||||
qtwi -> setIcon(0, icon.isNull() ? defaultIcon(type) : icon);
|
qtwi -> setIcon(0, icon.isNull() ? defaultIcon(type) : icon);
|
||||||
return(qtwi);
|
return(qtwi);
|
||||||
@@ -745,7 +745,7 @@ template<typename T>
|
|||||||
void GenericPanel::removeObsoleteItems(const QList<T> &expected_items, QTreeWidgetItem *item, QET::ItemType type, bool recursive) {
|
void GenericPanel::removeObsoleteItems(const QList<T> &expected_items, QTreeWidgetItem *item, QET::ItemType type, bool recursive) {
|
||||||
// remove items not found in expected_items
|
// remove items not found in expected_items
|
||||||
foreach (QTreeWidgetItem *child_item, childItems(item, type, recursive)) {
|
foreach (QTreeWidgetItem *child_item, childItems(item, type, recursive)) {
|
||||||
T child_value = valueForItem<T>(child_item);
|
auto child_value = valueForItem<T>(child_item);
|
||||||
if (!expected_items.contains(child_value)) {
|
if (!expected_items.contains(child_value)) {
|
||||||
deleteItem(child_item);
|
deleteItem(child_item);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
@param parent QWidget parent de la liste de noms
|
@param parent QWidget parent de la liste de noms
|
||||||
*/
|
*/
|
||||||
NamesListWidget::NamesListWidget(QWidget *parent) : QWidget(parent), read_only(false) {
|
NamesListWidget::NamesListWidget(QWidget *parent) : QWidget(parent), read_only(false) {
|
||||||
QVBoxLayout *names_list_layout = new QVBoxLayout();
|
auto *names_list_layout = new QVBoxLayout();
|
||||||
setLayout(names_list_layout);
|
setLayout(names_list_layout);
|
||||||
|
|
||||||
tree_names = new QTreeWidget();
|
tree_names = new QTreeWidget();
|
||||||
@@ -70,7 +70,7 @@ NamesListWidget::~NamesListWidget() {
|
|||||||
void NamesListWidget::addLine() {
|
void NamesListWidget::addLine() {
|
||||||
clean();
|
clean();
|
||||||
if (read_only) return;
|
if (read_only) return;
|
||||||
QTreeWidgetItem *qtwi = new QTreeWidgetItem();
|
auto *qtwi = new QTreeWidgetItem();
|
||||||
qtwi -> setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
qtwi -> setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
||||||
tree_names -> addTopLevelItem(qtwi);
|
tree_names -> addTopLevelItem(qtwi);
|
||||||
tree_names -> setCurrentItem(qtwi);
|
tree_names -> setCurrentItem(qtwi);
|
||||||
@@ -137,7 +137,7 @@ void NamesListWidget::setNames(const NamesList &provided_names) {
|
|||||||
QString value = provided_names[lang];
|
QString value = provided_names[lang];
|
||||||
QStringList values;
|
QStringList values;
|
||||||
values << lang << value;
|
values << lang << value;
|
||||||
QTreeWidgetItem *qtwi = new QTreeWidgetItem(values);
|
auto *qtwi = new QTreeWidgetItem(values);
|
||||||
if (!read_only) qtwi -> setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
if (!read_only) qtwi -> setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
||||||
tree_names -> addTopLevelItem(qtwi);
|
tree_names -> addTopLevelItem(qtwi);
|
||||||
tree_names -> sortItems(0, Qt::AscendingOrder);
|
tree_names -> sortItems(0, Qt::AscendingOrder);
|
||||||
|
|||||||
@@ -74,11 +74,11 @@ void NewElementWizard::preselectedLocation(const ElementsLocation &location)
|
|||||||
*/
|
*/
|
||||||
QWizardPage *NewElementWizard::buildStep1()
|
QWizardPage *NewElementWizard::buildStep1()
|
||||||
{
|
{
|
||||||
QWizardPage *page = new QWizardPage();
|
auto *page = new QWizardPage();
|
||||||
page -> setProperty("WizardState", Category);
|
page -> setProperty("WizardState", Category);
|
||||||
page -> setTitle(tr("Étape 1/3 : Catégorie parente", "wizard page title"));
|
page -> setTitle(tr("Étape 1/3 : Catégorie parente", "wizard page title"));
|
||||||
page -> setSubTitle(tr("Sélectionnez une catégorie dans laquelle enregistrer le nouvel élément.", "wizard page subtitle"));
|
page -> setSubTitle(tr("Sélectionnez une catégorie dans laquelle enregistrer le nouvel élément.", "wizard page subtitle"));
|
||||||
QVBoxLayout *layout = new QVBoxLayout();
|
auto *layout = new QVBoxLayout();
|
||||||
|
|
||||||
m_tree_view = new QTreeView(this);
|
m_tree_view = new QTreeView(this);
|
||||||
|
|
||||||
@@ -100,11 +100,11 @@ QWizardPage *NewElementWizard::buildStep1()
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
QWizardPage *NewElementWizard::buildStep2() {
|
QWizardPage *NewElementWizard::buildStep2() {
|
||||||
QWizardPage *page = new QWizardPage();
|
auto *page = new QWizardPage();
|
||||||
page -> setProperty("WizardState", Filename);
|
page -> setProperty("WizardState", Filename);
|
||||||
page -> setTitle(tr("Étape 2/3 : Nom du fichier", "wizard page title"));
|
page -> setTitle(tr("Étape 2/3 : Nom du fichier", "wizard page title"));
|
||||||
page -> setSubTitle(tr("Indiquez le nom du fichier dans lequel enregistrer le nouvel élément.", "wizard page subtitle"));
|
page -> setSubTitle(tr("Indiquez le nom du fichier dans lequel enregistrer le nouvel élément.", "wizard page subtitle"));
|
||||||
QVBoxLayout *layout = new QVBoxLayout();
|
auto *layout = new QVBoxLayout();
|
||||||
|
|
||||||
m_qle_filename = new QFileNameEdit(tr("nouvel_element"));
|
m_qle_filename = new QFileNameEdit(tr("nouvel_element"));
|
||||||
m_qle_filename -> selectAll();
|
m_qle_filename -> selectAll();
|
||||||
@@ -124,11 +124,11 @@ QWizardPage *NewElementWizard::buildStep2() {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
QWizardPage *NewElementWizard::buildStep3() {
|
QWizardPage *NewElementWizard::buildStep3() {
|
||||||
QWizardPage *page = new QWizardPage();
|
auto *page = new QWizardPage();
|
||||||
page -> setProperty("WizardState", Names);
|
page -> setProperty("WizardState", Names);
|
||||||
page -> setTitle(tr("Étape 3/3 : Noms de l'élément", "wizard page title"));
|
page -> setTitle(tr("Étape 3/3 : Noms de l'élément", "wizard page title"));
|
||||||
page -> setSubTitle(tr("Indiquez le ou les noms de l'élément.", "wizard page subtitle"));
|
page -> setSubTitle(tr("Indiquez le ou les noms de l'élément.", "wizard page subtitle"));
|
||||||
QVBoxLayout *layout = new QVBoxLayout();
|
auto *layout = new QVBoxLayout();
|
||||||
|
|
||||||
m_names_list = new NamesListWidget();
|
m_names_list = new NamesListWidget();
|
||||||
NamesList hash_name;
|
NamesList hash_name;
|
||||||
@@ -170,7 +170,7 @@ bool NewElementWizard::validStep1()
|
|||||||
QModelIndex index = m_tree_view->currentIndex();
|
QModelIndex index = m_tree_view->currentIndex();
|
||||||
if (index.isValid()) {
|
if (index.isValid()) {
|
||||||
|
|
||||||
ElementCollectionItem *eci = static_cast<ElementCollectionItem*>(m_model->itemFromIndex(index));
|
auto *eci = static_cast<ElementCollectionItem*>(m_model->itemFromIndex(index));
|
||||||
if (eci && eci->isDir()) {
|
if (eci && eci->isDir()) {
|
||||||
ElementsLocation loc(eci->collectionPath());
|
ElementsLocation loc(eci->collectionPath());
|
||||||
if (loc.exist()) {
|
if (loc.exist()) {
|
||||||
@@ -226,7 +226,7 @@ bool NewElementWizard::validStep2() {
|
|||||||
* Lauch an element editor for create the new element
|
* Lauch an element editor for create the new element
|
||||||
*/
|
*/
|
||||||
void NewElementWizard::createNewElement() {
|
void NewElementWizard::createNewElement() {
|
||||||
QETElementEditor *edit_new_element = new QETElementEditor(parentWidget());
|
auto *edit_new_element = new QETElementEditor(parentWidget());
|
||||||
edit_new_element -> setNames(m_names_list -> names());
|
edit_new_element -> setNames(m_names_list -> names());
|
||||||
|
|
||||||
ElementsLocation loc_ = m_chosen_location;
|
ElementsLocation loc_ = m_chosen_location;
|
||||||
|
|||||||
@@ -179,8 +179,8 @@ void ProjectMainConfigPage::initWidgets() {
|
|||||||
Initialize the layout of this page.
|
Initialize the layout of this page.
|
||||||
*/
|
*/
|
||||||
void ProjectMainConfigPage::initLayout() {
|
void ProjectMainConfigPage::initLayout() {
|
||||||
QVBoxLayout *main_layout0 = new QVBoxLayout();
|
auto *main_layout0 = new QVBoxLayout();
|
||||||
QHBoxLayout *title_layout0 = new QHBoxLayout();
|
auto *title_layout0 = new QHBoxLayout();
|
||||||
title_layout0 -> addWidget(title_label_);
|
title_layout0 -> addWidget(title_label_);
|
||||||
title_layout0 -> addWidget(title_value_);
|
title_layout0 -> addWidget(title_value_);
|
||||||
main_layout0 -> addLayout(title_layout0);
|
main_layout0 -> addLayout(title_layout0);
|
||||||
@@ -255,7 +255,7 @@ void ProjectAutoNumConfigPage::applyProjectConf() {}
|
|||||||
*/
|
*/
|
||||||
void ProjectAutoNumConfigPage::initWidgets()
|
void ProjectAutoNumConfigPage::initWidgets()
|
||||||
{
|
{
|
||||||
QTabWidget *tab_widget = new QTabWidget(this);
|
auto *tab_widget = new QTabWidget(this);
|
||||||
|
|
||||||
//Management tab
|
//Management tab
|
||||||
m_amw = new AutoNumberingManagementW(project());
|
m_amw = new AutoNumberingManagementW(project());
|
||||||
@@ -277,7 +277,7 @@ void ProjectAutoNumConfigPage::initWidgets()
|
|||||||
m_faw = new FolioAutonumberingW(project());
|
m_faw = new FolioAutonumberingW(project());
|
||||||
tab_widget->addTab(m_faw, tr("Folio autonumérotation"));
|
tab_widget->addTab(m_faw, tr("Folio autonumérotation"));
|
||||||
|
|
||||||
QHBoxLayout *main_layout = new QHBoxLayout();
|
auto *main_layout = new QHBoxLayout();
|
||||||
main_layout->addWidget(tab_widget);
|
main_layout->addWidget(tab_widget);
|
||||||
setLayout(main_layout);
|
setLayout(main_layout);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -348,7 +348,7 @@ void ProjectView::addNewDiagram() {
|
|||||||
if (m_project -> isReadOnly()) return;
|
if (m_project -> isReadOnly()) return;
|
||||||
|
|
||||||
Diagram *new_diagram = m_project -> addNewDiagram();
|
Diagram *new_diagram = m_project -> addNewDiagram();
|
||||||
DiagramView *new_diagram_view = new DiagramView(new_diagram);
|
auto *new_diagram_view = new DiagramView(new_diagram);
|
||||||
addDiagram(new_diagram_view);
|
addDiagram(new_diagram_view);
|
||||||
|
|
||||||
if (m_project -> diagrams().size() % 58 == 1 && m_project -> getFolioSheetsQuantity() != 0)
|
if (m_project -> diagrams().size() % 58 == 1 && m_project -> getFolioSheetsQuantity() != 0)
|
||||||
@@ -365,7 +365,7 @@ void ProjectView::addNewDiagramFolioList() {
|
|||||||
int i = 1; //< Each new diagram is added to the end of the project.
|
int i = 1; //< Each new diagram is added to the end of the project.
|
||||||
//< We use @i to move the folio list at second position in the project
|
//< We use @i to move the folio list at second position in the project
|
||||||
foreach (Diagram *d, m_project -> addNewDiagramFolioList()) {
|
foreach (Diagram *d, m_project -> addNewDiagramFolioList()) {
|
||||||
DiagramView *new_diagram_view = new DiagramView(d);
|
auto *new_diagram_view = new DiagramView(d);
|
||||||
addDiagram(new_diagram_view);
|
addDiagram(new_diagram_view);
|
||||||
showDiagram(new_diagram_view);
|
showDiagram(new_diagram_view);
|
||||||
m_tab->tabBar()->moveTab(diagram_views().size()-1, i);
|
m_tab->tabBar()->moveTab(diagram_views().size()-1, i);
|
||||||
@@ -751,7 +751,7 @@ int ProjectView::cleanProject() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
clean_dialog.setWindowTitle(tr("Nettoyer le projet", "window title"));
|
clean_dialog.setWindowTitle(tr("Nettoyer le projet", "window title"));
|
||||||
QVBoxLayout *clean_dialog_layout = new QVBoxLayout();
|
auto *clean_dialog_layout = new QVBoxLayout();
|
||||||
clean_dialog_layout -> addWidget(clean_tbt);
|
clean_dialog_layout -> addWidget(clean_tbt);
|
||||||
clean_dialog_layout -> addWidget(clean_elements);
|
clean_dialog_layout -> addWidget(clean_elements);
|
||||||
clean_dialog_layout -> addWidget(clean_categories);
|
clean_dialog_layout -> addWidget(clean_categories);
|
||||||
@@ -807,7 +807,7 @@ void ProjectView::initWidgets() {
|
|||||||
m_tab = new QTabWidget(this);
|
m_tab = new QTabWidget(this);
|
||||||
m_tab -> setMovable(true);
|
m_tab -> setMovable(true);
|
||||||
|
|
||||||
QToolButton *add_new_diagram_button = new QToolButton;
|
auto *add_new_diagram_button = new QToolButton;
|
||||||
add_new_diagram_button -> setDefaultAction(add_new_diagram_);
|
add_new_diagram_button -> setDefaultAction(add_new_diagram_);
|
||||||
add_new_diagram_button -> setAutoRaise(true);
|
add_new_diagram_button -> setAutoRaise(true);
|
||||||
m_tab -> setCornerWidget(add_new_diagram_button, Qt::TopRightCorner);
|
m_tab -> setCornerWidget(add_new_diagram_button, Qt::TopRightCorner);
|
||||||
@@ -824,7 +824,7 @@ void ProjectView::initWidgets() {
|
|||||||
Initialize layout for this widget.
|
Initialize layout for this widget.
|
||||||
*/
|
*/
|
||||||
void ProjectView::initLayout() {
|
void ProjectView::initLayout() {
|
||||||
QVBoxLayout *fallback_widget_layout_ = new QVBoxLayout(fallback_widget_);
|
auto *fallback_widget_layout_ = new QVBoxLayout(fallback_widget_);
|
||||||
fallback_widget_layout_ -> addWidget(fallback_label_);
|
fallback_widget_layout_ -> addWidget(fallback_label_);
|
||||||
|
|
||||||
layout_ = new QVBoxLayout(this);
|
layout_ = new QVBoxLayout(this);
|
||||||
@@ -868,7 +868,7 @@ void ProjectView::loadDiagrams()
|
|||||||
dialog->setProgressBar(dialog->progressBarValue()+1);
|
dialog->setProgressBar(dialog->progressBarValue()+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
DiagramView *sv = new DiagramView(diagram);
|
auto *sv = new DiagramView(diagram);
|
||||||
addDiagram(sv);
|
addDiagram(sv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -626,7 +626,7 @@ QET::QetCollection QET::qetCollectionFromString(const QString &str)
|
|||||||
*/
|
*/
|
||||||
QActionGroup *QET::depthActionGroup(QObject *parent)
|
QActionGroup *QET::depthActionGroup(QObject *parent)
|
||||||
{
|
{
|
||||||
QActionGroup *action_group = new QActionGroup(parent);
|
auto *action_group = new QActionGroup(parent);
|
||||||
|
|
||||||
QAction *edit_forward = new QAction(QET::Icons::BringForward, QObject::tr("Amener au premier plan"), action_group);
|
QAction *edit_forward = new QAction(QET::Icons::BringForward, QObject::tr("Amener au premier plan"), action_group);
|
||||||
QAction *edit_raise = new QAction(QET::Icons::Raise, QObject::tr("Rapprocher"), action_group);
|
QAction *edit_raise = new QAction(QET::Icons::Raise, QObject::tr("Rapprocher"), action_group);
|
||||||
|
|||||||
@@ -440,7 +440,7 @@ TitleBlockTemplatesCollection *QETApp::titleBlockTemplatesCollection(const QStri
|
|||||||
@return le nom de l'utilisateur courant
|
@return le nom de l'utilisateur courant
|
||||||
*/
|
*/
|
||||||
QString QETApp::userName() {
|
QString QETApp::userName() {
|
||||||
QProcess * process = new QProcess();
|
auto * process = new QProcess();
|
||||||
QString str;
|
QString str;
|
||||||
#ifndef Q_OS_WIN32
|
#ifndef Q_OS_WIN32
|
||||||
// return(QString(getenv("USER")));
|
// return(QString(getenv("USER")));
|
||||||
@@ -907,7 +907,7 @@ QList<QETTitleBlockTemplateEditor *> QETApp::titleBlockTemplateEditors(QETProjec
|
|||||||
@see QTextOrientationSpinBoxWidget
|
@see QTextOrientationSpinBoxWidget
|
||||||
*/
|
*/
|
||||||
QTextOrientationSpinBoxWidget *QETApp::createTextOrientationSpinBoxWidget() {
|
QTextOrientationSpinBoxWidget *QETApp::createTextOrientationSpinBoxWidget() {
|
||||||
QTextOrientationSpinBoxWidget *widget = new QTextOrientationSpinBoxWidget();
|
auto *widget = new QTextOrientationSpinBoxWidget();
|
||||||
widget -> orientationWidget() -> setFont(QETApp::diagramTextsFont());
|
widget -> orientationWidget() -> setFont(QETApp::diagramTextsFont());
|
||||||
widget -> orientationWidget() -> setUsableTexts(QList<QString>()
|
widget -> orientationWidget() -> setUsableTexts(QList<QString>()
|
||||||
<< QETApp::tr("Q", "Single-letter example text - translate length, not meaning")
|
<< QETApp::tr("Q", "Single-letter example text - translate length, not meaning")
|
||||||
@@ -924,7 +924,7 @@ QTextOrientationSpinBoxWidget *QETApp::createTextOrientationSpinBoxWidget() {
|
|||||||
*/
|
*/
|
||||||
TitleBlockTemplate *QETApp::defaultTitleBlockTemplate() {
|
TitleBlockTemplate *QETApp::defaultTitleBlockTemplate() {
|
||||||
if (!QETApp::default_titleblock_template_) {
|
if (!QETApp::default_titleblock_template_) {
|
||||||
TitleBlockTemplate *titleblock_template = new TitleBlockTemplate(QETApp::instance());
|
auto *titleblock_template = new TitleBlockTemplate(QETApp::instance());
|
||||||
if (titleblock_template -> loadFromXmlFile(":/titleblocks/default.titleblock")) {
|
if (titleblock_template -> loadFromXmlFile(":/titleblocks/default.titleblock")) {
|
||||||
QETApp::default_titleblock_template_ = titleblock_template;
|
QETApp::default_titleblock_template_ = titleblock_template;
|
||||||
}
|
}
|
||||||
@@ -1034,7 +1034,7 @@ void QETApp::setMainWindowVisible(QMainWindow *window, bool visible) {
|
|||||||
@param window fenetre a afficher / cacher
|
@param window fenetre a afficher / cacher
|
||||||
*/
|
*/
|
||||||
void QETApp::invertMainWindowVisibility(QWidget *window) {
|
void QETApp::invertMainWindowVisibility(QWidget *window) {
|
||||||
if (QMainWindow *w = qobject_cast<QMainWindow *>(window)) setMainWindowVisible(w, !w -> isVisible());
|
if (auto *w = qobject_cast<QMainWindow *>(window)) setMainWindowVisible(w, !w -> isVisible());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1206,7 +1206,7 @@ void QETApp::openElementFiles(const QStringList &files_list) {
|
|||||||
}
|
}
|
||||||
if (!already_opened_in_existing_element_editor) {
|
if (!already_opened_in_existing_element_editor) {
|
||||||
// ce fichier n'est ouvert dans aucun editeur
|
// ce fichier n'est ouvert dans aucun editeur
|
||||||
QETElementEditor *element_editor = new QETElementEditor();
|
auto *element_editor = new QETElementEditor();
|
||||||
element_editor -> fromFile(element_file);
|
element_editor -> fromFile(element_file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1238,7 +1238,7 @@ void QETApp::openElementLocations(const QList<ElementsLocation> &locations_list)
|
|||||||
}
|
}
|
||||||
if (!already_opened_in_existing_element_editor) {
|
if (!already_opened_in_existing_element_editor) {
|
||||||
// cet emplacement n'est ouvert dans aucun editeur
|
// cet emplacement n'est ouvert dans aucun editeur
|
||||||
QETElementEditor *element_editor = new QETElementEditor();
|
auto *element_editor = new QETElementEditor();
|
||||||
element_editor -> fromLocation(element_location);
|
element_editor -> fromLocation(element_location);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1253,7 +1253,7 @@ void QETApp::openElementLocations(const QList<ElementsLocation> &locations_list)
|
|||||||
@see QETTitleBlockTemplateEditor::setOpenForDuplication()
|
@see QETTitleBlockTemplateEditor::setOpenForDuplication()
|
||||||
*/
|
*/
|
||||||
void QETApp::openTitleBlockTemplate(const TitleBlockTemplateLocation &location, bool duplicate) {
|
void QETApp::openTitleBlockTemplate(const TitleBlockTemplateLocation &location, bool duplicate) {
|
||||||
QETTitleBlockTemplateEditor *qet_template_editor = new QETTitleBlockTemplateEditor();
|
auto *qet_template_editor = new QETTitleBlockTemplateEditor();
|
||||||
qet_template_editor -> setOpenForDuplication(duplicate);
|
qet_template_editor -> setOpenForDuplication(duplicate);
|
||||||
qet_template_editor -> edit(location);
|
qet_template_editor -> edit(location);
|
||||||
qet_template_editor -> show();
|
qet_template_editor -> show();
|
||||||
@@ -1264,7 +1264,7 @@ void QETApp::openTitleBlockTemplate(const TitleBlockTemplateLocation &location,
|
|||||||
@param filepath Path of the .titleblock file to be opened
|
@param filepath Path of the .titleblock file to be opened
|
||||||
*/
|
*/
|
||||||
void QETApp::openTitleBlockTemplate(const QString &filepath) {
|
void QETApp::openTitleBlockTemplate(const QString &filepath) {
|
||||||
QETTitleBlockTemplateEditor *qet_template_editor = new QETTitleBlockTemplateEditor();
|
auto *qet_template_editor = new QETTitleBlockTemplateEditor();
|
||||||
qet_template_editor -> edit(filepath);
|
qet_template_editor -> edit(filepath);
|
||||||
qet_template_editor -> show();
|
qet_template_editor -> show();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ void QETDiagramEditor::setUpElementsCollectionWidget()
|
|||||||
*/
|
*/
|
||||||
void QETDiagramEditor::setUpUndoStack() {
|
void QETDiagramEditor::setUpUndoStack() {
|
||||||
|
|
||||||
QUndoView *undo_view = new QUndoView(&undo_group, this);
|
auto *undo_view = new QUndoView(&undo_group, this);
|
||||||
|
|
||||||
undo_view -> setEmptyLabel (tr("Aucune modification"));
|
undo_view -> setEmptyLabel (tr("Aucune modification"));
|
||||||
undo_view -> setStatusTip (tr("Cliquez sur une action pour revenir en arrière dans l'édition de votre schéma", "Status tip"));
|
undo_view -> setStatusTip (tr("Cliquez sur une action pour revenir en arrière dans l'édition de votre schéma", "Status tip"));
|
||||||
@@ -849,7 +849,7 @@ void QETDiagramEditor::saveAs() {
|
|||||||
*/
|
*/
|
||||||
bool QETDiagramEditor::newProject() {
|
bool QETDiagramEditor::newProject() {
|
||||||
// create new project without diagram
|
// create new project without diagram
|
||||||
QETProject *new_project = new QETProject(0);
|
auto *new_project = new QETProject(0);
|
||||||
|
|
||||||
// Set default properties for new diagram
|
// Set default properties for new diagram
|
||||||
new_project -> setDefaultBorderProperties (BorderProperties:: defaultProperties());
|
new_project -> setDefaultBorderProperties (BorderProperties:: defaultProperties());
|
||||||
@@ -1009,7 +1009,7 @@ bool QETDiagramEditor::openAndAddProject(const QString &filepath, bool interacti
|
|||||||
//Create the project
|
//Create the project
|
||||||
DialogWaiting::instance(this);
|
DialogWaiting::instance(this);
|
||||||
|
|
||||||
QETProject *project = new QETProject(filepath);
|
auto *project = new QETProject(filepath);
|
||||||
if (project -> state() != QETProject::Ok)
|
if (project -> state() != QETProject::Ok)
|
||||||
{
|
{
|
||||||
if (interactive && project -> state() != QETProject::FileOpenDiscard)
|
if (interactive && project -> state() != QETProject::FileOpenDiscard)
|
||||||
@@ -1048,7 +1048,7 @@ bool QETDiagramEditor::addProject(QETProject *project, bool update_panel) {
|
|||||||
QETApp::registerProject(project);
|
QETApp::registerProject(project);
|
||||||
|
|
||||||
// cree un ProjectView pour visualiser le projet
|
// cree un ProjectView pour visualiser le projet
|
||||||
ProjectView *project_view = new ProjectView(project);
|
auto *project_view = new ProjectView(project);
|
||||||
addProjectView(project_view);
|
addProjectView(project_view);
|
||||||
|
|
||||||
undo_group.addStack(project -> undoStack());
|
undo_group.addStack(project -> undoStack());
|
||||||
@@ -1072,7 +1072,7 @@ QList<ProjectView *> QETDiagramEditor::openedProjects() const {
|
|||||||
QList<ProjectView *> result;
|
QList<ProjectView *> result;
|
||||||
QList<QMdiSubWindow *> window_list(m_workspace.subWindowList());
|
QList<QMdiSubWindow *> window_list(m_workspace.subWindowList());
|
||||||
foreach(QMdiSubWindow *window, window_list) {
|
foreach(QMdiSubWindow *window, window_list) {
|
||||||
if (ProjectView *project_view = qobject_cast<ProjectView *>(window -> widget())) {
|
if (auto *project_view = qobject_cast<ProjectView *>(window -> widget())) {
|
||||||
result << project_view;
|
result << project_view;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1090,7 +1090,7 @@ ProjectView *QETDiagramEditor::currentProjectView() const {
|
|||||||
QWidget *current_widget = current_window -> widget();
|
QWidget *current_widget = current_window -> widget();
|
||||||
if (!current_widget) return(nullptr);
|
if (!current_widget) return(nullptr);
|
||||||
|
|
||||||
if (ProjectView *project_view = qobject_cast<ProjectView *>(current_widget)) {
|
if (auto *project_view = qobject_cast<ProjectView *>(current_widget)) {
|
||||||
return(project_view);
|
return(project_view);
|
||||||
}
|
}
|
||||||
return(nullptr);
|
return(nullptr);
|
||||||
@@ -1284,7 +1284,7 @@ void QETDiagramEditor::addItemGroupTriggered(QAction *action)
|
|||||||
diagram_event = new DiagramEventAddShape (d, QetShapeItem::Polygon);
|
diagram_event = new DiagramEventAddShape (d, QetShapeItem::Polygon);
|
||||||
else if (value == "image")
|
else if (value == "image")
|
||||||
{
|
{
|
||||||
DiagramEventAddImage *deai = new DiagramEventAddImage(d);
|
auto *deai = new DiagramEventAddImage(d);
|
||||||
if (deai->isNull())
|
if (deai->isNull())
|
||||||
{
|
{
|
||||||
delete deai;
|
delete deai;
|
||||||
@@ -1326,7 +1326,7 @@ void QETDiagramEditor::selectionGroupTriggered(QAction *action)
|
|||||||
}
|
}
|
||||||
else if (value == "rotate_selection")
|
else if (value == "rotate_selection")
|
||||||
{
|
{
|
||||||
RotateSelectionCommand *c = new RotateSelectionCommand(diagram);
|
auto *c = new RotateSelectionCommand(diagram);
|
||||||
if(c->isValid())
|
if(c->isValid())
|
||||||
diagram->undoStack().push(c);
|
diagram->undoStack().push(c);
|
||||||
}
|
}
|
||||||
@@ -1697,7 +1697,7 @@ ProjectView *QETDiagramEditor::acessCurrentProject (){
|
|||||||
QWidget *current_widget = current_window -> widget();
|
QWidget *current_widget = current_window -> widget();
|
||||||
if (!current_widget) return(nullptr);
|
if (!current_widget) return(nullptr);
|
||||||
|
|
||||||
if (ProjectView *project_view = qobject_cast<ProjectView *>(current_widget)) {
|
if (auto *project_view = qobject_cast<ProjectView *>(current_widget)) {
|
||||||
return(project_view);
|
return(project_view);
|
||||||
}
|
}
|
||||||
return(nullptr);
|
return(nullptr);
|
||||||
@@ -1752,7 +1752,7 @@ void QETDiagramEditor::slot_updateWindowsMenu() {
|
|||||||
m_previous_window -> setEnabled(windows.count() > 1);
|
m_previous_window -> setEnabled(windows.count() > 1);
|
||||||
|
|
||||||
if (!windows.isEmpty()) windows_menu -> addSeparator();
|
if (!windows.isEmpty()) windows_menu -> addSeparator();
|
||||||
QActionGroup *windows_actions = new QActionGroup(this);
|
auto *windows_actions = new QActionGroup(this);
|
||||||
foreach(ProjectView *project_view, windows) {
|
foreach(ProjectView *project_view, windows) {
|
||||||
QString pv_title = project_view -> windowTitle();
|
QString pv_title = project_view -> windowTitle();
|
||||||
QAction *action = windows_menu -> addAction(pv_title);
|
QAction *action = windows_menu -> addAction(pv_title);
|
||||||
@@ -2072,7 +2072,7 @@ void QETDiagramEditor::removeDiagramFromProject() {
|
|||||||
// remove one (last) folio sheet.
|
// remove one (last) folio sheet.
|
||||||
} else if (current_project -> diagram_views().size() % 58 == 0) {
|
} else if (current_project -> diagram_views().size() % 58 == 0) {
|
||||||
foreach (DiagramView *diag, current_project -> diagram_views()) {
|
foreach (DiagramView *diag, current_project -> diagram_views()) {
|
||||||
DiagramFolioList *ptr = dynamic_cast<DiagramFolioList *>(diag -> diagram());
|
auto *ptr = dynamic_cast<DiagramFolioList *>(diag -> diagram());
|
||||||
if (ptr && ptr -> getId() == current_project -> project() -> getFolioSheetsQuantity() - 1) {
|
if (ptr && ptr -> getId() == current_project -> project() -> getFolioSheetsQuantity() - 1) {
|
||||||
current_project -> removeDiagram(diag);
|
current_project -> removeDiagram(diag);
|
||||||
}
|
}
|
||||||
@@ -2170,7 +2170,7 @@ void QETDiagramEditor::selectionChanged()
|
|||||||
void QETDiagramEditor::generateTerminalBlock()
|
void QETDiagramEditor::generateTerminalBlock()
|
||||||
{
|
{
|
||||||
bool success;
|
bool success;
|
||||||
QProcess *process = new QProcess(qApp);
|
auto *process = new QProcess(qApp);
|
||||||
|
|
||||||
// If launched under control:
|
// If launched under control:
|
||||||
//connect(process, SIGNAL(errorOcurred(int error)), this, SLOT(slot_generateTerminalBlock_error()));
|
//connect(process, SIGNAL(errorOcurred(int error)), this, SLOT(slot_generateTerminalBlock_error()));
|
||||||
|
|||||||
@@ -696,7 +696,7 @@ bool Conductor::sceneEventFilter(QGraphicsItem *watched, QEvent *event)
|
|||||||
//Watched must be an handler
|
//Watched must be an handler
|
||||||
if(watched->type() == QetGraphicsHandlerItem::Type)
|
if(watched->type() == QetGraphicsHandlerItem::Type)
|
||||||
{
|
{
|
||||||
QetGraphicsHandlerItem *qghi = qgraphicsitem_cast<QetGraphicsHandlerItem *>(watched);
|
auto *qghi = qgraphicsitem_cast<QetGraphicsHandlerItem *>(watched);
|
||||||
|
|
||||||
if(m_handler_vector.contains(qghi)) //Handler must be in m_vector_index, then we can start resize
|
if(m_handler_vector.contains(qghi)) //Handler must be in m_vector_index, then we can start resize
|
||||||
{
|
{
|
||||||
@@ -1352,7 +1352,7 @@ void Conductor::saveProfile(bool undo) {
|
|||||||
conductor_profiles[current_path_type].fromConductor(this);
|
conductor_profiles[current_path_type].fromConductor(this);
|
||||||
Diagram *dia = diagram();
|
Diagram *dia = diagram();
|
||||||
if (undo && dia) {
|
if (undo && dia) {
|
||||||
ChangeConductorCommand *undo_object = new ChangeConductorCommand(
|
auto *undo_object = new ChangeConductorCommand(
|
||||||
this,
|
this,
|
||||||
old_profile,
|
old_profile,
|
||||||
conductor_profiles[current_path_type],
|
conductor_profiles[current_path_type],
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ void ConductorTextItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) {
|
|||||||
|
|
||||||
if (!applied_movement.isNull()) {
|
if (!applied_movement.isNull()) {
|
||||||
//Create an undo object
|
//Create an undo object
|
||||||
MoveConductorsTextsCommand *undo_object = new MoveConductorsTextsCommand(diagram_ptr);
|
auto *undo_object = new MoveConductorsTextsCommand(diagram_ptr);
|
||||||
undo_object -> addTextMovement(this, before_mov_pos_, pos(), moved_by_user_);
|
undo_object -> addTextMovement(this, before_mov_pos_, pos(), moved_by_user_);
|
||||||
|
|
||||||
moved_by_user_ = true;
|
moved_by_user_ = true;
|
||||||
|
|||||||
@@ -370,7 +370,7 @@ bool CustomElement::parseLine(QDomElement &e, QPainter &qp, bool addtolist) {
|
|||||||
|
|
||||||
if (addtolist){
|
if (addtolist){
|
||||||
//Add line to the list
|
//Add line to the list
|
||||||
QLineF *newLine = new QLineF(line);
|
auto *newLine = new QLineF(line);
|
||||||
m_lines << newLine;
|
m_lines << newLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -475,7 +475,7 @@ bool CustomElement::parseRect(QDomElement &e, QPainter &qp, bool addtolist)
|
|||||||
|
|
||||||
if (addtolist){
|
if (addtolist){
|
||||||
//Add rectangle to the list
|
//Add rectangle to the list
|
||||||
QRectF *rect = new QRectF(rect_x, rect_y, rect_w, rect_h);
|
auto *rect = new QRectF(rect_x, rect_y, rect_w, rect_h);
|
||||||
m_rectangles << rect;
|
m_rectangles << rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -516,7 +516,7 @@ bool CustomElement::parseCircle(QDomElement &e, QPainter &qp, bool addtolist) {
|
|||||||
|
|
||||||
if (addtolist){
|
if (addtolist){
|
||||||
// Add circle to list
|
// Add circle to list
|
||||||
QRectF *circle = new QRectF(circle_bounding_rect);
|
auto *circle = new QRectF(circle_bounding_rect);
|
||||||
m_circles << circle;
|
m_circles << circle;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -549,7 +549,7 @@ bool CustomElement::parseEllipse(QDomElement &e, QPainter &qp, bool addtolist) {
|
|||||||
setPainterStyle(e, qp);
|
setPainterStyle(e, qp);
|
||||||
|
|
||||||
if (addtolist){
|
if (addtolist){
|
||||||
QVector<qreal> *arc = new QVector<qreal>;
|
auto *arc = new QVector<qreal>;
|
||||||
arc -> push_back(ellipse_x);
|
arc -> push_back(ellipse_x);
|
||||||
arc -> push_back(ellipse_y);
|
arc -> push_back(ellipse_y);
|
||||||
arc -> push_back(ellipse_l);
|
arc -> push_back(ellipse_l);
|
||||||
@@ -592,7 +592,7 @@ bool CustomElement::parseArc(QDomElement &e, QPainter &qp, bool addtolist) {
|
|||||||
setPainterStyle(e, qp);
|
setPainterStyle(e, qp);
|
||||||
|
|
||||||
if (addtolist){
|
if (addtolist){
|
||||||
QVector<qreal> *arc = new QVector<qreal>;
|
auto *arc = new QVector<qreal>;
|
||||||
arc -> push_back(arc_x);
|
arc -> push_back(arc_x);
|
||||||
arc -> push_back(arc_y);
|
arc -> push_back(arc_y);
|
||||||
arc -> push_back(arc_l);
|
arc -> push_back(arc_l);
|
||||||
@@ -647,7 +647,7 @@ bool CustomElement::parsePolygon(QDomElement &e, QPainter &qp, bool addtolist) {
|
|||||||
}
|
}
|
||||||
if (addtolist){
|
if (addtolist){
|
||||||
// Add to list of polygons.
|
// Add to list of polygons.
|
||||||
QVector<QPointF> *poly = new QVector<QPointF>(points);
|
auto *poly = new QVector<QPointF>(points);
|
||||||
m_polygons << poly;
|
m_polygons << poly;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -743,7 +743,7 @@ bool CustomElement::parseInput(QDomElement &dom_element) {
|
|||||||
) return(false);
|
) return(false);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DynamicElementTextItem *deti = new DynamicElementTextItem(this);
|
auto *deti = new DynamicElementTextItem(this);
|
||||||
deti->setText(dom_element.attribute("text", "_"));
|
deti->setText(dom_element.attribute("text", "_"));
|
||||||
deti->setFontSize(dom_element.attribute("size", QString::number(9)).toInt());
|
deti->setFontSize(dom_element.attribute("size", QString::number(9)).toInt());
|
||||||
deti->setRotation(dom_element.attribute("rotation", QString::number(0)).toDouble());
|
deti->setRotation(dom_element.attribute("rotation", QString::number(0)).toDouble());
|
||||||
@@ -782,7 +782,7 @@ bool CustomElement::parseInput(QDomElement &dom_element) {
|
|||||||
*/
|
*/
|
||||||
DynamicElementTextItem *CustomElement::parseDynamicText(QDomElement &dom_element)
|
DynamicElementTextItem *CustomElement::parseDynamicText(QDomElement &dom_element)
|
||||||
{
|
{
|
||||||
DynamicElementTextItem *deti = new DynamicElementTextItem(this);
|
auto *deti = new DynamicElementTextItem(this);
|
||||||
//Because the xml description of a .elmt file is the same as how a dynamic text field is save to xml in a .qet file
|
//Because the xml description of a .elmt file is the same as how a dynamic text field is save to xml in a .qet file
|
||||||
//wa call fromXml, we just change the tagg name (.elmt = dynamic_text, .qet = dynamic_elmt_text)
|
//wa call fromXml, we just change the tagg name (.elmt = dynamic_text, .qet = dynamic_elmt_text)
|
||||||
//and the uuid (because the uuid, is the uuid of the descritpion and not the uuid of instantiated dynamic text field)
|
//and the uuid (because the uuid, is the uuid of the descritpion and not the uuid of instantiated dynamic text field)
|
||||||
@@ -817,7 +817,7 @@ Terminal *CustomElement::parseTerminal(QDomElement &e) {
|
|||||||
else if (e.attribute("orientation") == "e") terminalo = Qet::East;
|
else if (e.attribute("orientation") == "e") terminalo = Qet::East;
|
||||||
else if (e.attribute("orientation") == "w") terminalo = Qet::West;
|
else if (e.attribute("orientation") == "w") terminalo = Qet::West;
|
||||||
else return(nullptr);
|
else return(nullptr);
|
||||||
Terminal *new_terminal = new Terminal(terminalx, terminaly, terminalo, this);
|
auto *new_terminal = new Terminal(terminalx, terminaly, terminalo, this);
|
||||||
m_terminals << new_terminal;
|
m_terminals << new_terminal;
|
||||||
|
|
||||||
//Sort from top to bottom and left to rigth
|
//Sort from top to bottom and left to rigth
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ ElementTextItemGroup *DynamicElementTextItem::parentGroup() const
|
|||||||
{
|
{
|
||||||
if(parentItem())
|
if(parentItem())
|
||||||
{
|
{
|
||||||
if(ElementTextItemGroup *grp = dynamic_cast<ElementTextItemGroup *>(parentItem()))
|
if(auto *grp = dynamic_cast<ElementTextItemGroup *>(parentItem()))
|
||||||
return grp;
|
return grp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ Element::Element(QGraphicsItem *parent) :
|
|||||||
connect(this, &Element::rotationChanged, [this]() {
|
connect(this, &Element::rotationChanged, [this]() {
|
||||||
for(QGraphicsItem *qgi : childItems())
|
for(QGraphicsItem *qgi : childItems())
|
||||||
{
|
{
|
||||||
if (Terminal *t = qgraphicsitem_cast<Terminal *>(qgi))
|
if (auto *t = qgraphicsitem_cast<Terminal *>(qgi))
|
||||||
t->updateConductor();
|
t->updateConductor();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -96,7 +96,7 @@ void Element::editProperty()
|
|||||||
{
|
{
|
||||||
if (diagram() && !diagram()->isReadOnly())
|
if (diagram() && !diagram()->isReadOnly())
|
||||||
{
|
{
|
||||||
ElementPropertiesWidget *epw = new ElementPropertiesWidget(this);
|
auto *epw = new ElementPropertiesWidget(this);
|
||||||
PropertiesEditorDialog dialog(epw, QApplication::activeWindow());
|
PropertiesEditorDialog dialog(epw, QApplication::activeWindow());
|
||||||
connect(epw, &ElementPropertiesWidget::findEditClicked, &dialog, &QDialog::reject);
|
connect(epw, &ElementPropertiesWidget::findEditClicked, &dialog, &QDialog::reject);
|
||||||
//Must be windowModal, else when user do a drag and drop
|
//Must be windowModal, else when user do a drag and drop
|
||||||
@@ -370,7 +370,7 @@ bool Element::fromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr, bool
|
|||||||
QHash<int, Terminal *> priv_id_adr;
|
QHash<int, Terminal *> priv_id_adr;
|
||||||
int terminals_non_trouvees = 0;
|
int terminals_non_trouvees = 0;
|
||||||
foreach(QGraphicsItem *qgi, childItems()) {
|
foreach(QGraphicsItem *qgi, childItems()) {
|
||||||
if (Terminal *p = qgraphicsitem_cast<Terminal *>(qgi)) {
|
if (auto *p = qgraphicsitem_cast<Terminal *>(qgi)) {
|
||||||
bool terminal_trouvee = false;
|
bool terminal_trouvee = false;
|
||||||
foreach(QDomElement qde, liste_terminals) {
|
foreach(QDomElement qde, liste_terminals) {
|
||||||
if (p -> fromXml(qde)) {
|
if (p -> fromXml(qde)) {
|
||||||
@@ -454,7 +454,7 @@ bool Element::fromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr, bool
|
|||||||
//************************//
|
//************************//
|
||||||
for (const QDomElement& qde : QET::findInDomElement(e, "dynamic_texts", DynamicElementTextItem::xmlTaggName()))
|
for (const QDomElement& qde : QET::findInDomElement(e, "dynamic_texts", DynamicElementTextItem::xmlTaggName()))
|
||||||
{
|
{
|
||||||
DynamicElementTextItem *deti = new DynamicElementTextItem(this);
|
auto *deti = new DynamicElementTextItem(this);
|
||||||
addDynamicTextItem(deti);
|
addDynamicTextItem(deti);
|
||||||
deti->fromXml(qde);
|
deti->fromXml(qde);
|
||||||
}
|
}
|
||||||
@@ -856,7 +856,7 @@ void Element::addDynamicTextItem(DynamicElementTextItem *deti)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DynamicElementTextItem *text = new DynamicElementTextItem(this);
|
auto *text = new DynamicElementTextItem(this);
|
||||||
m_dynamic_text_list.append(text);
|
m_dynamic_text_list.append(text);
|
||||||
emit textAdded(text);
|
emit textAdded(text);
|
||||||
}
|
}
|
||||||
@@ -911,7 +911,7 @@ ElementTextItemGroup *Element::addTextGroup(const QString &name)
|
|||||||
{
|
{
|
||||||
if(m_texts_group.isEmpty())
|
if(m_texts_group.isEmpty())
|
||||||
{
|
{
|
||||||
ElementTextItemGroup *group = new ElementTextItemGroup(name, this);
|
auto *group = new ElementTextItemGroup(name, this);
|
||||||
m_texts_group << group;
|
m_texts_group << group;
|
||||||
emit textsGroupAdded(group);
|
emit textsGroupAdded(group);
|
||||||
return group;
|
return group;
|
||||||
@@ -927,7 +927,7 @@ ElementTextItemGroup *Element::addTextGroup(const QString &name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Create the group
|
//Create the group
|
||||||
ElementTextItemGroup *group = new ElementTextItemGroup(rename, this);
|
auto *group = new ElementTextItemGroup(rename, this);
|
||||||
m_texts_group << group;
|
m_texts_group << group;
|
||||||
emit textsGroupAdded(group);
|
emit textsGroupAdded(group);
|
||||||
return group;
|
return group;
|
||||||
@@ -966,7 +966,7 @@ void Element::removeTextGroup(ElementTextItemGroup *group)
|
|||||||
{
|
{
|
||||||
if(qgi->type() == DynamicElementTextItem::Type)
|
if(qgi->type() == DynamicElementTextItem::Type)
|
||||||
{
|
{
|
||||||
DynamicElementTextItem *deti = static_cast<DynamicElementTextItem *>(qgi);
|
auto *deti = static_cast<DynamicElementTextItem *>(qgi);
|
||||||
removeTextFromGroup(deti, group);
|
removeTextFromGroup(deti, group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ void ElementTextItemGroup::addToGroup(QGraphicsItem *item)
|
|||||||
QGraphicsItemGroup::addToGroup(item);
|
QGraphicsItemGroup::addToGroup(item);
|
||||||
updateAlignment();
|
updateAlignment();
|
||||||
|
|
||||||
DynamicElementTextItem *deti = qgraphicsitem_cast<DynamicElementTextItem *>(item);
|
auto *deti = qgraphicsitem_cast<DynamicElementTextItem *>(item);
|
||||||
connect(deti, &DynamicElementTextItem::fontSizeChanged, this, &ElementTextItemGroup::updateAlignment);
|
connect(deti, &DynamicElementTextItem::fontSizeChanged, this, &ElementTextItemGroup::updateAlignment);
|
||||||
connect(deti, &DynamicElementTextItem::textChanged, this, &ElementTextItemGroup::updateAlignment);
|
connect(deti, &DynamicElementTextItem::textChanged, this, &ElementTextItemGroup::updateAlignment);
|
||||||
connect(deti, &DynamicElementTextItem::textFromChanged, this, &ElementTextItemGroup::updateAlignment);
|
connect(deti, &DynamicElementTextItem::textFromChanged, this, &ElementTextItemGroup::updateAlignment);
|
||||||
@@ -96,7 +96,7 @@ void ElementTextItemGroup::removeFromGroup(QGraphicsItem *item)
|
|||||||
item->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
item->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||||
updateAlignment();
|
updateAlignment();
|
||||||
|
|
||||||
if(DynamicElementTextItem *deti = qgraphicsitem_cast<DynamicElementTextItem *>(item))
|
if(auto *deti = qgraphicsitem_cast<DynamicElementTextItem *>(item))
|
||||||
{
|
{
|
||||||
disconnect(deti, &DynamicElementTextItem::fontSizeChanged, this, &ElementTextItemGroup::updateAlignment);
|
disconnect(deti, &DynamicElementTextItem::fontSizeChanged, this, &ElementTextItemGroup::updateAlignment);
|
||||||
disconnect(deti, &DynamicElementTextItem::textChanged, this, &ElementTextItemGroup::updateAlignment);
|
disconnect(deti, &DynamicElementTextItem::textChanged, this, &ElementTextItemGroup::updateAlignment);
|
||||||
@@ -780,7 +780,7 @@ void ElementTextItemGroup::autoPos()
|
|||||||
if(!diagram())
|
if(!diagram())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
MasterElement *master = static_cast<MasterElement *>(m_parent_element);
|
auto *master = static_cast<MasterElement *>(m_parent_element);
|
||||||
XRefProperties xrp = diagram()->project()->defaultXRefProperties(master->kindInformations()["type"].toString());
|
XRefProperties xrp = diagram()->project()->defaultXRefProperties(master->kindInformations()["type"].toString());
|
||||||
if(xrp.snapTo() == XRefProperties::Bottom)
|
if(xrp.snapTo() == XRefProperties::Bottom)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -408,7 +408,7 @@ bool QetShapeItem::sceneEventFilter(QGraphicsItem *watched, QEvent *event)
|
|||||||
//Watched must be an handler
|
//Watched must be an handler
|
||||||
if(watched->type() == QetGraphicsHandlerItem::Type)
|
if(watched->type() == QetGraphicsHandlerItem::Type)
|
||||||
{
|
{
|
||||||
QetGraphicsHandlerItem *qghi = qgraphicsitem_cast<QetGraphicsHandlerItem *>(watched);
|
auto *qghi = qgraphicsitem_cast<QetGraphicsHandlerItem *>(watched);
|
||||||
|
|
||||||
if(m_handler_vector.contains(qghi)) //Handler must be in m_vector_index, then we can start resize
|
if(m_handler_vector.contains(qghi)) //Handler must be in m_vector_index, then we can start resize
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ Terminal::~Terminal() {
|
|||||||
@return L'orientation actuelle de la Terminal.
|
@return L'orientation actuelle de la Terminal.
|
||||||
*/
|
*/
|
||||||
Qet::Orientation Terminal::orientation() const {
|
Qet::Orientation Terminal::orientation() const {
|
||||||
if (Element *elt = qgraphicsitem_cast<Element *>(parentItem())) {
|
if (auto *elt = qgraphicsitem_cast<Element *>(parentItem())) {
|
||||||
// orientations actuelle et par defaut de l'element
|
// orientations actuelle et par defaut de l'element
|
||||||
int ori_cur = elt -> orientation();
|
int ori_cur = elt -> orientation();
|
||||||
if (ori_cur == 0) return(ori_);
|
if (ori_cur == 0) return(ori_);
|
||||||
@@ -431,7 +431,7 @@ Terminal* Terminal::alignedWithTerminal() const
|
|||||||
QList <Terminal *> available_terminals;
|
QList <Terminal *> available_terminals;
|
||||||
foreach (QGraphicsItem *qgi, qgi_list)
|
foreach (QGraphicsItem *qgi, qgi_list)
|
||||||
{
|
{
|
||||||
if (Terminal *tt = qgraphicsitem_cast <Terminal *> (qgi))
|
if (auto *tt = qgraphicsitem_cast <Terminal *> (qgi))
|
||||||
{
|
{
|
||||||
//Call QET::lineContainsPoint to be sure the line intersect
|
//Call QET::lineContainsPoint to be sure the line intersect
|
||||||
//the dock point and not an other part of terminal
|
//the dock point and not an other part of terminal
|
||||||
@@ -539,7 +539,7 @@ void Terminal::mouseMoveEvent(QGraphicsSceneMouseEvent *e) {
|
|||||||
// sinon on prend le deuxieme element de la liste et on verifie s'il s'agit d'une borne
|
// sinon on prend le deuxieme element de la liste et on verifie s'il s'agit d'une borne
|
||||||
QGraphicsItem *qgi = qgis.at(1);
|
QGraphicsItem *qgi = qgis.at(1);
|
||||||
// si le qgi est une borne...
|
// si le qgi est une borne...
|
||||||
Terminal *other_terminal = qgraphicsitem_cast<Terminal *>(qgi);
|
auto *other_terminal = qgraphicsitem_cast<Terminal *>(qgi);
|
||||||
if (!other_terminal) return;
|
if (!other_terminal) return;
|
||||||
previous_terminal_ = other_terminal;
|
previous_terminal_ = other_terminal;
|
||||||
|
|
||||||
@@ -576,7 +576,7 @@ void Terminal::mouseReleaseEvent(QGraphicsSceneMouseEvent *e)
|
|||||||
if (!qgi) return;
|
if (!qgi) return;
|
||||||
|
|
||||||
//Element must be a terminal
|
//Element must be a terminal
|
||||||
Terminal *other_terminal = qgraphicsitem_cast<Terminal *>(qgi);
|
auto *other_terminal = qgraphicsitem_cast<Terminal *>(qgi);
|
||||||
if (!other_terminal) return;
|
if (!other_terminal) return;
|
||||||
|
|
||||||
other_terminal -> hovered_color_ = neutralColor;
|
other_terminal -> hovered_color_ = neutralColor;
|
||||||
@@ -586,7 +586,7 @@ void Terminal::mouseReleaseEvent(QGraphicsSceneMouseEvent *e)
|
|||||||
if (!canBeLinkedTo(other_terminal)) return;
|
if (!canBeLinkedTo(other_terminal)) return;
|
||||||
|
|
||||||
//Create conductor
|
//Create conductor
|
||||||
Conductor *new_conductor = new Conductor(this, other_terminal);
|
auto *new_conductor = new Conductor(this, other_terminal);
|
||||||
|
|
||||||
//Get all conductors at the same potential of new conductors
|
//Get all conductors at the same potential of new conductors
|
||||||
QSet <Conductor *> conductors_list = new_conductor->relatedPotentialConductors();
|
QSet <Conductor *> conductors_list = new_conductor->relatedPotentialConductors();
|
||||||
@@ -606,7 +606,7 @@ void Terminal::mouseReleaseEvent(QGraphicsSceneMouseEvent *e)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QUndoCommand *undo = new QUndoCommand();
|
auto *undo = new QUndoCommand();
|
||||||
QUndoCommand *aic = new AddItemCommand<Conductor *>(new_conductor, diagram(), QPointF(), undo);
|
QUndoCommand *aic = new AddItemCommand<Conductor *>(new_conductor, diagram(), QPointF(), undo);
|
||||||
undo->setText(aic->text());
|
undo->setText(aic->text());
|
||||||
|
|
||||||
|
|||||||
@@ -392,7 +392,7 @@ void QETPrintPreviewDialog::setPrintOptionsVisible(bool display) {
|
|||||||
void QETPrintPreviewDialog::updateZoomList() {
|
void QETPrintPreviewDialog::updateZoomList() {
|
||||||
// recupere le zooom courant
|
// recupere le zooom courant
|
||||||
qreal current_zoom = preview_ -> zoomFactor();
|
qreal current_zoom = preview_ -> zoomFactor();
|
||||||
bool current_zoom_is_not_null = bool(int(current_zoom * 100.0));
|
auto current_zoom_is_not_null = bool(int(current_zoom * 100.0));
|
||||||
|
|
||||||
// liste des zooms par defaut
|
// liste des zooms par defaut
|
||||||
QList<qreal> zooms_real;
|
QList<qreal> zooms_real;
|
||||||
|
|||||||
@@ -817,7 +817,7 @@ QDomDocument QETProject::toXml() {
|
|||||||
for(Diagram *diagram : diagrams_list)
|
for(Diagram *diagram : diagrams_list)
|
||||||
{
|
{
|
||||||
// Write the diagram to XML only if it is not of type DiagramFolioList.
|
// Write the diagram to XML only if it is not of type DiagramFolioList.
|
||||||
DiagramFolioList *ptr = dynamic_cast<DiagramFolioList *>(diagram);
|
auto *ptr = dynamic_cast<DiagramFolioList *>(diagram);
|
||||||
if ( !ptr )
|
if ( !ptr )
|
||||||
{
|
{
|
||||||
qDebug() << qPrintable(QString("QETProject::toXml() : exporting diagram \"%1\"").arg(diagram -> title())) << "[" << diagram << "]";
|
qDebug() << qPrintable(QString("QETProject::toXml() : exporting diagram \"%1\"").arg(diagram -> title())) << "[" << diagram << "]";
|
||||||
@@ -1099,7 +1099,7 @@ Diagram *QETProject::addNewDiagram() {
|
|||||||
if (isReadOnly()) return(nullptr);
|
if (isReadOnly()) return(nullptr);
|
||||||
|
|
||||||
// cree un nouveau schema
|
// cree un nouveau schema
|
||||||
Diagram *diagram = new Diagram(this);
|
auto *diagram = new Diagram(this);
|
||||||
|
|
||||||
// lui transmet les parametres par defaut
|
// lui transmet les parametres par defaut
|
||||||
diagram -> border_and_titleblock.importBorder(defaultBorderProperties());
|
diagram -> border_and_titleblock.importBorder(defaultBorderProperties());
|
||||||
@@ -1325,7 +1325,7 @@ void QETProject::readDiagramsXml(QDomDocument &xml_project)
|
|||||||
if (diagram_nodes.at(i).isElement())
|
if (diagram_nodes.at(i).isElement())
|
||||||
{
|
{
|
||||||
QDomElement diagram_xml_element = diagram_nodes.at(i).toElement();
|
QDomElement diagram_xml_element = diagram_nodes.at(i).toElement();
|
||||||
Diagram *diagram = new Diagram(this);
|
auto *diagram = new Diagram(this);
|
||||||
bool diagram_loading = diagram -> initFromXml(diagram_xml_element);
|
bool diagram_loading = diagram -> initFromXml(diagram_xml_element);
|
||||||
if (diagram_loading)
|
if (diagram_loading)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ void QTextOrientationSpinBoxWidget::build() {
|
|||||||
connect(spin_box_, SIGNAL(editingFinished()), this, SLOT(emitChangeSignals()));
|
connect(spin_box_, SIGNAL(editingFinished()), this, SLOT(emitChangeSignals()));
|
||||||
|
|
||||||
// dispose les widgets : le QTextOrientationWidget a gauche, le SpinBox a droite
|
// dispose les widgets : le QTextOrientationWidget a gauche, le SpinBox a droite
|
||||||
QHBoxLayout *main_layout = new QHBoxLayout();
|
auto *main_layout = new QHBoxLayout();
|
||||||
main_layout -> addWidget(orientation_widget_);
|
main_layout -> addWidget(orientation_widget_);
|
||||||
main_layout -> addWidget(spin_box_);
|
main_layout -> addWidget(spin_box_);
|
||||||
main_layout -> addStretch();
|
main_layout -> addStretch();
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ void RecentFiles::buildMenu() {
|
|||||||
// remplit le menu
|
// remplit le menu
|
||||||
foreach (QString filepath, list_) {
|
foreach (QString filepath, list_) {
|
||||||
// creee une nouvelle action pour le fichier
|
// creee une nouvelle action pour le fichier
|
||||||
QAction *action = new QAction(filepath, this);
|
auto *action = new QAction(filepath, this);
|
||||||
if (!files_icon_.isNull()) {
|
if (!files_icon_.isNull()) {
|
||||||
action -> setIcon(files_icon_);
|
action -> setIcon(files_icon_);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -417,7 +417,7 @@ static QAction *createCheckableAction(const QIcon &icon, const QString &text,
|
|||||||
QObject *receiver, const char *slot,
|
QObject *receiver, const char *slot,
|
||||||
QObject *parent = nullptr)
|
QObject *parent = nullptr)
|
||||||
{
|
{
|
||||||
QAction *result = new QAction(parent);
|
auto *result = new QAction(parent);
|
||||||
result->setIcon(icon);
|
result->setIcon(icon);
|
||||||
result->setText(text);
|
result->setText(text);
|
||||||
result->setCheckable(true);
|
result->setCheckable(true);
|
||||||
@@ -471,7 +471,7 @@ RichTextEditorToolBar::RichTextEditorToolBar(RichTextEditor *editor,
|
|||||||
|
|
||||||
// Left, center, right and justified alignment buttons
|
// Left, center, right and justified alignment buttons
|
||||||
|
|
||||||
QActionGroup *alignment_group = new QActionGroup(this);
|
auto *alignment_group = new QActionGroup(this);
|
||||||
connect(alignment_group, SIGNAL(triggered(QAction*)),
|
connect(alignment_group, SIGNAL(triggered(QAction*)),
|
||||||
SLOT(alignmentActionTriggered(QAction*)));
|
SLOT(alignmentActionTriggered(QAction*)));
|
||||||
|
|
||||||
@@ -767,12 +767,12 @@ RichTextEditorDialog::RichTextEditorDialog(QWidget *parent) :
|
|||||||
tool_bar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
|
tool_bar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||||
|
|
||||||
QWidget *rich_edit = new QWidget;
|
QWidget *rich_edit = new QWidget;
|
||||||
QVBoxLayout *rich_edit_layout = new QVBoxLayout(rich_edit);
|
auto *rich_edit_layout = new QVBoxLayout(rich_edit);
|
||||||
rich_edit_layout->addWidget(tool_bar);
|
rich_edit_layout->addWidget(tool_bar);
|
||||||
rich_edit_layout->addWidget(m_editor);
|
rich_edit_layout->addWidget(m_editor);
|
||||||
|
|
||||||
QWidget *plain_edit = new QWidget;
|
QWidget *plain_edit = new QWidget;
|
||||||
QVBoxLayout *plain_edit_layout = new QVBoxLayout(plain_edit);
|
auto *plain_edit_layout = new QVBoxLayout(plain_edit);
|
||||||
plain_edit_layout->addWidget(m_text_edit);
|
plain_edit_layout->addWidget(m_text_edit);
|
||||||
|
|
||||||
m_tab_widget->setTabPosition(QTabWidget::South);
|
m_tab_widget->setTabPosition(QTabWidget::South);
|
||||||
@@ -789,7 +789,7 @@ RichTextEditorDialog::RichTextEditorDialog(QWidget *parent) :
|
|||||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(on_buttonBox_accepted()));
|
connect(buttonBox, SIGNAL(accepted()), this, SLOT(on_buttonBox_accepted()));
|
||||||
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||||
|
|
||||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
auto *layout = new QVBoxLayout(this);
|
||||||
layout->addWidget(m_tab_widget);
|
layout->addWidget(m_tab_widget);
|
||||||
layout->addWidget(buttonBox);
|
layout->addWidget(buttonBox);
|
||||||
|
|
||||||
|
|||||||
@@ -145,10 +145,10 @@ void TitleBlockDimensionWidget::initWidgets() {
|
|||||||
Initialize the layout of the dialog.
|
Initialize the layout of the dialog.
|
||||||
*/
|
*/
|
||||||
void TitleBlockDimensionWidget::initLayouts() {
|
void TitleBlockDimensionWidget::initLayouts() {
|
||||||
QHBoxLayout *hlayout0 = new QHBoxLayout();
|
auto *hlayout0 = new QHBoxLayout();
|
||||||
hlayout0 -> addWidget(spinbox_label_);
|
hlayout0 -> addWidget(spinbox_label_);
|
||||||
hlayout0 -> addWidget(spinbox_);
|
hlayout0 -> addWidget(spinbox_);
|
||||||
QVBoxLayout *vlayout0 = new QVBoxLayout();
|
auto *vlayout0 = new QVBoxLayout();
|
||||||
vlayout0 -> addLayout(hlayout0);
|
vlayout0 -> addLayout(hlayout0);
|
||||||
if (complete_) {
|
if (complete_) {
|
||||||
vlayout0 -> addWidget(absolute_button_);
|
vlayout0 -> addWidget(absolute_button_);
|
||||||
|
|||||||
@@ -246,7 +246,7 @@ bool QETTitleBlockTemplateEditor::edit(QETProject *project, const QString &templ
|
|||||||
*/
|
*/
|
||||||
bool QETTitleBlockTemplateEditor::edit(const QString &file_path) {
|
bool QETTitleBlockTemplateEditor::edit(const QString &file_path) {
|
||||||
// get title block template object from the file, edit it
|
// get title block template object from the file, edit it
|
||||||
TitleBlockTemplate *tbt = new TitleBlockTemplate();
|
auto *tbt = new TitleBlockTemplate();
|
||||||
bool loading = tbt -> loadFromXmlFile(file_path);
|
bool loading = tbt -> loadFromXmlFile(file_path);
|
||||||
if (!loading) {
|
if (!loading) {
|
||||||
/// TODO the file opening failed, warn the user?
|
/// TODO the file opening failed, warn the user?
|
||||||
@@ -301,7 +301,7 @@ void QETTitleBlockTemplateEditor::editLogos() {
|
|||||||
logo_manager_ -> layout() -> setContentsMargins(0, 0, 0, 0);
|
logo_manager_ -> layout() -> setContentsMargins(0, 0, 0, 0);
|
||||||
QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Close);
|
QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Close);
|
||||||
|
|
||||||
QVBoxLayout *vlayout0 = new QVBoxLayout();
|
auto *vlayout0 = new QVBoxLayout();
|
||||||
vlayout0 -> addWidget(logo_manager_);
|
vlayout0 -> addWidget(logo_manager_);
|
||||||
vlayout0 -> addWidget(buttons);
|
vlayout0 -> addWidget(buttons);
|
||||||
|
|
||||||
@@ -320,7 +320,7 @@ void QETTitleBlockTemplateEditor::editLogos() {
|
|||||||
Launch a new title block template editor.
|
Launch a new title block template editor.
|
||||||
*/
|
*/
|
||||||
void QETTitleBlockTemplateEditor::newTemplate() {
|
void QETTitleBlockTemplateEditor::newTemplate() {
|
||||||
QETTitleBlockTemplateEditor *qet_template_editor = new QETTitleBlockTemplateEditor();
|
auto *qet_template_editor = new QETTitleBlockTemplateEditor();
|
||||||
qet_template_editor -> edit(TitleBlockTemplateLocation());
|
qet_template_editor -> edit(TitleBlockTemplateLocation());
|
||||||
qet_template_editor -> show();
|
qet_template_editor -> show();
|
||||||
}
|
}
|
||||||
@@ -882,7 +882,7 @@ TitleBlockTemplateLocation QETTitleBlockTemplateEditor::getTitleBlockTemplateLoc
|
|||||||
}
|
}
|
||||||
QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||||
|
|
||||||
QVBoxLayout *dialog_layout = new QVBoxLayout();
|
auto *dialog_layout = new QVBoxLayout();
|
||||||
dialog_layout -> addWidget(widget);
|
dialog_layout -> addWidget(widget);
|
||||||
dialog_layout -> addWidget(buttons);
|
dialog_layout -> addWidget(buttons);
|
||||||
|
|
||||||
@@ -932,7 +932,7 @@ void QETTitleBlockTemplateEditor::editTemplateInformation() {
|
|||||||
#endif
|
#endif
|
||||||
dialog_author.setMinimumSize(400, 260);
|
dialog_author.setMinimumSize(400, 260);
|
||||||
dialog_author.setWindowTitle(tr("Éditer les informations complémentaires", "window title"));
|
dialog_author.setWindowTitle(tr("Éditer les informations complémentaires", "window title"));
|
||||||
QVBoxLayout *dialog_layout = new QVBoxLayout(&dialog_author);
|
auto *dialog_layout = new QVBoxLayout(&dialog_author);
|
||||||
|
|
||||||
// explanation label
|
// explanation label
|
||||||
QLabel *information_label = new QLabel(tr("Vous pouvez utiliser ce champ libre pour mentionner les auteurs du cartouche, sa licence, ou tout autre renseignement que vous jugerez utile."));
|
QLabel *information_label = new QLabel(tr("Vous pouvez utiliser ce champ libre pour mentionner les auteurs du cartouche, sa licence, ou tout autre renseignement que vous jugerez utile."));
|
||||||
@@ -941,7 +941,7 @@ void QETTitleBlockTemplateEditor::editTemplateInformation() {
|
|||||||
dialog_layout -> addWidget(information_label);
|
dialog_layout -> addWidget(information_label);
|
||||||
|
|
||||||
// add a QTextEdit to the dialog
|
// add a QTextEdit to the dialog
|
||||||
QTextEdit *text_field = new QTextEdit();
|
auto *text_field = new QTextEdit();
|
||||||
text_field -> setAcceptRichText(false);
|
text_field -> setAcceptRichText(false);
|
||||||
text_field -> setPlainText(tb_template_ -> information());
|
text_field -> setPlainText(tb_template_ -> information());
|
||||||
text_field -> setReadOnly(read_only_);
|
text_field -> setReadOnly(read_only_);
|
||||||
|
|||||||
@@ -96,11 +96,11 @@ void TitleBlockTemplateCellWidget::initWidgets() {
|
|||||||
font_adjust_input_ = new QCheckBox(tr("Ajuster la taille de police si besoin"));
|
font_adjust_input_ = new QCheckBox(tr("Ajuster la taille de police si besoin"));
|
||||||
|
|
||||||
// layout
|
// layout
|
||||||
QHBoxLayout *label_edition = new QHBoxLayout();
|
auto *label_edition = new QHBoxLayout();
|
||||||
label_edition -> addWidget(label_input_);
|
label_edition -> addWidget(label_input_);
|
||||||
label_edition -> addWidget(label_edit_);
|
label_edition -> addWidget(label_edit_);
|
||||||
|
|
||||||
QHBoxLayout *value_edition = new QHBoxLayout();
|
auto *value_edition = new QHBoxLayout();
|
||||||
value_edition -> addWidget(value_input_);
|
value_edition -> addWidget(value_input_);
|
||||||
value_edition -> addWidget(value_edit_);
|
value_edition -> addWidget(value_edit_);
|
||||||
|
|
||||||
@@ -375,7 +375,7 @@ bool TitleBlockTemplateCellWidget::isReadOnly() const {
|
|||||||
@param title Title of the dialog window
|
@param title Title of the dialog window
|
||||||
*/
|
*/
|
||||||
void TitleBlockTemplateCellWidget::editTranslatableValue(NamesList &names, const QString &attribute, const QString &title) const {
|
void TitleBlockTemplateCellWidget::editTranslatableValue(NamesList &names, const QString &attribute, const QString &title) const {
|
||||||
NamesListWidget *names_widget = new NamesListWidget();
|
auto *names_widget = new NamesListWidget();
|
||||||
names_widget -> setNames(names);
|
names_widget -> setNames(names);
|
||||||
QDialogButtonBox * buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
QDialogButtonBox * buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||||
|
|
||||||
@@ -386,7 +386,7 @@ void TitleBlockTemplateCellWidget::editTranslatableValue(NamesList &names, const
|
|||||||
QLabel *def_var_label = new QLabel(defaultVariablesString());
|
QLabel *def_var_label = new QLabel(defaultVariablesString());
|
||||||
def_var_label -> setTextFormat(Qt::RichText);
|
def_var_label -> setTextFormat(Qt::RichText);
|
||||||
|
|
||||||
QVBoxLayout *editor_layout = new QVBoxLayout();
|
auto *editor_layout = new QVBoxLayout();
|
||||||
editor_layout -> addWidget(information);
|
editor_layout -> addWidget(information);
|
||||||
editor_layout -> addWidget(names_widget);
|
editor_layout -> addWidget(names_widget);
|
||||||
editor_layout -> addWidget(def_var_label);
|
editor_layout -> addWidget(def_var_label);
|
||||||
@@ -416,7 +416,7 @@ void TitleBlockTemplateCellWidget::emitModification(const QString &attribute, co
|
|||||||
// avoid creating a QUndoCommand object when no modification was actually done
|
// avoid creating a QUndoCommand object when no modification was actually done
|
||||||
if (edited_cell_ -> attribute(attribute) == new_value) return;
|
if (edited_cell_ -> attribute(attribute) == new_value) return;
|
||||||
|
|
||||||
ModifyTitleBlockCellCommand *command = new ModifyTitleBlockCellCommand(edited_cell_);
|
auto *command = new ModifyTitleBlockCellCommand(edited_cell_);
|
||||||
command -> addModification(attribute, new_value);
|
command -> addModification(attribute, new_value);
|
||||||
command -> setText(
|
command -> setText(
|
||||||
tr("Édition d'une cellule : %1", "label of and undo command when editing a cell")
|
tr("Édition d'une cellule : %1", "label of and undo command when editing a cell")
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ int ModifyTitleBlockCellCommand::id() const {
|
|||||||
@return true on success, false otherwise
|
@return true on success, false otherwise
|
||||||
*/
|
*/
|
||||||
bool ModifyTitleBlockCellCommand::mergeWith(const QUndoCommand *command) {
|
bool ModifyTitleBlockCellCommand::mergeWith(const QUndoCommand *command) {
|
||||||
const ModifyTitleBlockCellCommand *other = static_cast<const ModifyTitleBlockCellCommand *>(command);
|
const auto *other = static_cast<const ModifyTitleBlockCellCommand *>(command);
|
||||||
if (other) {
|
if (other) {
|
||||||
if (other -> modified_cell_ == modified_cell_) {
|
if (other -> modified_cell_ == modified_cell_) {
|
||||||
if (other -> new_values_.keys() == new_values_.keys()) {
|
if (other -> new_values_.keys() == new_values_.keys()) {
|
||||||
@@ -226,7 +226,7 @@ ModifyTemplateGridCommand *ModifyTemplateGridCommand::addRow(TitleBlockTemplate
|
|||||||
if (!tbtemplate) return(nullptr);
|
if (!tbtemplate) return(nullptr);
|
||||||
|
|
||||||
// create the command itself
|
// create the command itself
|
||||||
ModifyTemplateGridCommand *add_row_command = new ModifyTemplateGridCommand(tbtemplate);
|
auto *add_row_command = new ModifyTemplateGridCommand(tbtemplate);
|
||||||
add_row_command -> setInsertion(true);
|
add_row_command -> setInsertion(true);
|
||||||
add_row_command -> setType(true);
|
add_row_command -> setType(true);
|
||||||
add_row_command -> setCells(tbtemplate -> createRow());
|
add_row_command -> setCells(tbtemplate -> createRow());
|
||||||
@@ -247,7 +247,7 @@ ModifyTemplateGridCommand *ModifyTemplateGridCommand::addColumn(TitleBlockTempla
|
|||||||
if (!tbtemplate) return(nullptr);
|
if (!tbtemplate) return(nullptr);
|
||||||
|
|
||||||
// create the command itself
|
// create the command itself
|
||||||
ModifyTemplateGridCommand *add_column_command = new ModifyTemplateGridCommand(tbtemplate);
|
auto *add_column_command = new ModifyTemplateGridCommand(tbtemplate);
|
||||||
add_column_command -> setInsertion(true);
|
add_column_command -> setInsertion(true);
|
||||||
add_column_command -> setType(false);
|
add_column_command -> setType(false);
|
||||||
add_column_command -> setCells(tbtemplate -> createColumn());
|
add_column_command -> setCells(tbtemplate -> createColumn());
|
||||||
@@ -268,7 +268,7 @@ ModifyTemplateGridCommand *ModifyTemplateGridCommand::deleteRow(TitleBlockTempla
|
|||||||
if (!tbtemplate) return(nullptr);
|
if (!tbtemplate) return(nullptr);
|
||||||
|
|
||||||
// create the command itself
|
// create the command itself
|
||||||
ModifyTemplateGridCommand *del_row_command = new ModifyTemplateGridCommand(tbtemplate);
|
auto *del_row_command = new ModifyTemplateGridCommand(tbtemplate);
|
||||||
del_row_command -> setInsertion(false);
|
del_row_command -> setInsertion(false);
|
||||||
del_row_command -> setType(true);
|
del_row_command -> setType(true);
|
||||||
del_row_command -> setIndex(index);
|
del_row_command -> setIndex(index);
|
||||||
@@ -287,7 +287,7 @@ ModifyTemplateGridCommand *ModifyTemplateGridCommand::deleteColumn(TitleBlockTem
|
|||||||
if (!tbtemplate) return(nullptr);
|
if (!tbtemplate) return(nullptr);
|
||||||
|
|
||||||
// create the command itself
|
// create the command itself
|
||||||
ModifyTemplateGridCommand *del_column_command = new ModifyTemplateGridCommand(tbtemplate);
|
auto *del_column_command = new ModifyTemplateGridCommand(tbtemplate);
|
||||||
del_column_command -> setInsertion(false);
|
del_column_command -> setInsertion(false);
|
||||||
del_column_command -> setType(false);
|
del_column_command -> setType(false);
|
||||||
del_column_command -> setIndex(index);
|
del_column_command -> setIndex(index);
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ void TitleBlockTemplateLogoManager::fillView() {
|
|||||||
current_icon = QIcon(*svg_pixmap);
|
current_icon = QIcon(*svg_pixmap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QListWidgetItem *qlwi = new QListWidgetItem(current_icon, logo_name);
|
auto *qlwi = new QListWidgetItem(current_icon, logo_name);
|
||||||
qlwi -> setTextAlignment(Qt::AlignBottom | Qt::AlignHCenter);
|
qlwi -> setTextAlignment(Qt::AlignBottom | Qt::AlignHCenter);
|
||||||
logos_view_ -> insertItem(0, qlwi);
|
logos_view_ -> insertItem(0, qlwi);
|
||||||
}
|
}
|
||||||
@@ -192,18 +192,18 @@ QString TitleBlockTemplateLogoManager::confirmLogoName(const QString &initial_na
|
|||||||
rd_label = new QLabel();
|
rd_label = new QLabel();
|
||||||
rd_label -> setWordWrap(true);
|
rd_label -> setWordWrap(true);
|
||||||
rd_input = new QLineEdit();
|
rd_input = new QLineEdit();
|
||||||
QDialogButtonBox *rd_buttons = new QDialogButtonBox();
|
auto *rd_buttons = new QDialogButtonBox();
|
||||||
QPushButton *replace_button = rd_buttons -> addButton(tr("Remplacer"), QDialogButtonBox::YesRole);
|
QPushButton *replace_button = rd_buttons -> addButton(tr("Remplacer"), QDialogButtonBox::YesRole);
|
||||||
QPushButton *rename_button = rd_buttons -> addButton(tr("Renommer"), QDialogButtonBox::NoRole);
|
QPushButton *rename_button = rd_buttons -> addButton(tr("Renommer"), QDialogButtonBox::NoRole);
|
||||||
QPushButton *cancel_button = rd_buttons -> addButton(QDialogButtonBox::Cancel);
|
QPushButton *cancel_button = rd_buttons -> addButton(QDialogButtonBox::Cancel);
|
||||||
|
|
||||||
QVBoxLayout *rd_vlayout0 = new QVBoxLayout();
|
auto *rd_vlayout0 = new QVBoxLayout();
|
||||||
rd_vlayout0 -> addWidget(rd_label);
|
rd_vlayout0 -> addWidget(rd_label);
|
||||||
rd_vlayout0 -> addWidget(rd_input);
|
rd_vlayout0 -> addWidget(rd_input);
|
||||||
rd_vlayout0 -> addWidget(rd_buttons);
|
rd_vlayout0 -> addWidget(rd_buttons);
|
||||||
rename_dialog -> setLayout(rd_vlayout0);
|
rename_dialog -> setLayout(rd_vlayout0);
|
||||||
|
|
||||||
QSignalMapper *signal_mapper = new QSignalMapper(rename_dialog);
|
auto *signal_mapper = new QSignalMapper(rename_dialog);
|
||||||
signal_mapper -> setMapping(replace_button, QDialogButtonBox::YesRole);
|
signal_mapper -> setMapping(replace_button, QDialogButtonBox::YesRole);
|
||||||
signal_mapper -> setMapping(rename_button, QDialogButtonBox::NoRole);
|
signal_mapper -> setMapping(rename_button, QDialogButtonBox::NoRole);
|
||||||
signal_mapper -> setMapping(cancel_button, QDialogButtonBox::RejectRole);
|
signal_mapper -> setMapping(cancel_button, QDialogButtonBox::RejectRole);
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ TitleBlockTemplate *TitleBlockTemplatesProjectCollection::getTemplate(const QStr
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ok, we have its XML description, we have to generate a TitleBlockTemplate object
|
// Ok, we have its XML description, we have to generate a TitleBlockTemplate object
|
||||||
TitleBlockTemplate *titleblock_template = new TitleBlockTemplate(this);
|
auto *titleblock_template = new TitleBlockTemplate(this);
|
||||||
if (titleblock_template -> loadFromXmlElement(titleblock_templates_xml_[template_name])) {
|
if (titleblock_template -> loadFromXmlElement(titleblock_templates_xml_[template_name])) {
|
||||||
titleblock_templates_.insert(template_name, titleblock_template);
|
titleblock_templates_.insert(template_name, titleblock_template);
|
||||||
return(titleblock_template);
|
return(titleblock_template);
|
||||||
@@ -403,7 +403,7 @@ QStringList TitleBlockTemplatesFilesCollection::templates() {
|
|||||||
TitleBlockTemplate *TitleBlockTemplatesFilesCollection::getTemplate(const QString &template_name) {
|
TitleBlockTemplate *TitleBlockTemplatesFilesCollection::getTemplate(const QString &template_name) {
|
||||||
if (!templates().contains(template_name)) return(nullptr);
|
if (!templates().contains(template_name)) return(nullptr);
|
||||||
|
|
||||||
TitleBlockTemplate *tbtemplate = new TitleBlockTemplate();
|
auto *tbtemplate = new TitleBlockTemplate();
|
||||||
QString tbt_file_path = path(template_name);
|
QString tbt_file_path = path(template_name);
|
||||||
|
|
||||||
bool loading = tbtemplate -> loadFromXmlFile(tbt_file_path);
|
bool loading = tbtemplate -> loadFromXmlFile(tbt_file_path);
|
||||||
@@ -431,7 +431,7 @@ QDomElement TitleBlockTemplatesFilesCollection::getTemplateXmlDescription(const
|
|||||||
return(QDomElement());
|
return(QDomElement());
|
||||||
}
|
}
|
||||||
|
|
||||||
QDomDocument *xml_document = new QDomDocument();
|
auto *xml_document = new QDomDocument();
|
||||||
bool xml_parsing = xml_document -> setContent(&xml_file);
|
bool xml_parsing = xml_document -> setContent(&xml_file);
|
||||||
if (!xml_parsing) {
|
if (!xml_parsing) {
|
||||||
delete xml_document;
|
delete xml_document;
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ QList<TitleBlockCell *> TitleBlockTemplateView::cut() {
|
|||||||
QList<TitleBlockCell *> copied_cells = copy();
|
QList<TitleBlockCell *> copied_cells = copy();
|
||||||
|
|
||||||
if (!copied_cells.isEmpty()) {
|
if (!copied_cells.isEmpty()) {
|
||||||
CutTemplateCellsCommand *cut_command = new CutTemplateCellsCommand(tbtemplate_);
|
auto *cut_command = new CutTemplateCellsCommand(tbtemplate_);
|
||||||
cut_command -> setCutCells(copied_cells);
|
cut_command -> setCutCells(copied_cells);
|
||||||
requestGridModification(cut_command);
|
requestGridModification(cut_command);
|
||||||
}
|
}
|
||||||
@@ -247,7 +247,7 @@ void TitleBlockTemplateView::paste() {
|
|||||||
// change num_row and num_col attributes of pasted cells so they get positionned relatively to selected_cell
|
// change num_row and num_col attributes of pasted cells so they get positionned relatively to selected_cell
|
||||||
normalizeCells(pasted_cells, erased_cell -> num_row, erased_cell -> num_col);
|
normalizeCells(pasted_cells, erased_cell -> num_row, erased_cell -> num_col);
|
||||||
|
|
||||||
PasteTemplateCellsCommand *paste_command = new PasteTemplateCellsCommand(tbtemplate_);
|
auto *paste_command = new PasteTemplateCellsCommand(tbtemplate_);
|
||||||
foreach (TitleBlockCell cell, pasted_cells) {
|
foreach (TitleBlockCell cell, pasted_cells) {
|
||||||
TitleBlockCell *erased_cell = tbtemplate_ -> cell(cell.num_row, cell.num_col);
|
TitleBlockCell *erased_cell = tbtemplate_ -> cell(cell.num_row, cell.num_col);
|
||||||
if (!erased_cell) continue;
|
if (!erased_cell) continue;
|
||||||
@@ -334,7 +334,7 @@ void TitleBlockTemplateView::editColumn(HelperCell *cell) {
|
|||||||
dialog.setValue(dimension_before);
|
dialog.setValue(dimension_before);
|
||||||
int user_answer = dialog.exec();
|
int user_answer = dialog.exec();
|
||||||
if (!read_only_ && user_answer == QDialog::Accepted) {
|
if (!read_only_ && user_answer == QDialog::Accepted) {
|
||||||
ModifyTemplateDimension *command = new ModifyTemplateDimension(tbtemplate_);
|
auto *command = new ModifyTemplateDimension(tbtemplate_);
|
||||||
command -> setType(false);
|
command -> setType(false);
|
||||||
command -> setIndex(index);
|
command -> setIndex(index);
|
||||||
command -> setDimensionBefore(dimension_before);
|
command -> setDimensionBefore(dimension_before);
|
||||||
@@ -360,7 +360,7 @@ void TitleBlockTemplateView::editRow(HelperCell *cell) {
|
|||||||
dialog.setValue(dimension_before);
|
dialog.setValue(dimension_before);
|
||||||
int user_answer = dialog.exec();
|
int user_answer = dialog.exec();
|
||||||
if (!read_only_ && user_answer == QDialog::Accepted) {
|
if (!read_only_ && user_answer == QDialog::Accepted) {
|
||||||
ModifyTemplateDimension *command = new ModifyTemplateDimension(tbtemplate_);
|
auto *command = new ModifyTemplateDimension(tbtemplate_);
|
||||||
command -> setType(true);
|
command -> setType(true);
|
||||||
command -> setIndex(index);
|
command -> setIndex(index);
|
||||||
command -> setDimensionBefore(dimension_before);
|
command -> setDimensionBefore(dimension_before);
|
||||||
@@ -394,7 +394,7 @@ void TitleBlockTemplateView::mergeSelectedCells() {
|
|||||||
// retrieve the selected cells
|
// retrieve the selected cells
|
||||||
TitleBlockTemplateCellsSet selected_cells = selectedCellsSet();
|
TitleBlockTemplateCellsSet selected_cells = selectedCellsSet();
|
||||||
|
|
||||||
MergeCellsCommand *merge_command = new MergeCellsCommand(selected_cells, tbtemplate_);
|
auto *merge_command = new MergeCellsCommand(selected_cells, tbtemplate_);
|
||||||
if (merge_command -> isValid()) requestGridModification(merge_command);
|
if (merge_command -> isValid()) requestGridModification(merge_command);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -405,7 +405,7 @@ void TitleBlockTemplateView::splitSelectedCell() {
|
|||||||
// retrieve the selected cells
|
// retrieve the selected cells
|
||||||
TitleBlockTemplateCellsSet selected_cells = selectedCellsSet();
|
TitleBlockTemplateCellsSet selected_cells = selectedCellsSet();
|
||||||
|
|
||||||
SplitCellsCommand *split_command = new SplitCellsCommand(selected_cells, tbtemplate_);
|
auto *split_command = new SplitCellsCommand(selected_cells, tbtemplate_);
|
||||||
if (split_command -> isValid()) requestGridModification(split_command);
|
if (split_command -> isValid()) requestGridModification(split_command);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -578,7 +578,7 @@ void TitleBlockTemplateView::applyColumnsWidths(bool animate) {
|
|||||||
// no animation on first call
|
// no animation on first call
|
||||||
tbgrid_ -> setColumnFixedWidth(COL_OFFSET + i, widths.at(i));
|
tbgrid_ -> setColumnFixedWidth(COL_OFFSET + i, widths.at(i));
|
||||||
} else {
|
} else {
|
||||||
GridLayoutAnimation *animation = new GridLayoutAnimation(tbgrid_, form_);
|
auto *animation = new GridLayoutAnimation(tbgrid_, form_);
|
||||||
animation -> setIndex(COL_OFFSET + i);
|
animation -> setIndex(COL_OFFSET + i);
|
||||||
animation -> setActsOnRows(false);
|
animation -> setActsOnRows(false);
|
||||||
animation -> setStartValue(QVariant(tbgrid_ -> columnMinimumWidth(COL_OFFSET + i)));
|
animation -> setStartValue(QVariant(tbgrid_ -> columnMinimumWidth(COL_OFFSET + i)));
|
||||||
@@ -643,7 +643,7 @@ void TitleBlockTemplateView::applyRowsHeights(bool animate) {
|
|||||||
// no animation on first call
|
// no animation on first call
|
||||||
tbgrid_ -> setRowFixedHeight(ROW_OFFSET + i, heights.at(i));
|
tbgrid_ -> setRowFixedHeight(ROW_OFFSET + i, heights.at(i));
|
||||||
} else {
|
} else {
|
||||||
GridLayoutAnimation *animation = new GridLayoutAnimation(tbgrid_, form_);
|
auto *animation = new GridLayoutAnimation(tbgrid_, form_);
|
||||||
animation -> setIndex(ROW_OFFSET + i);
|
animation -> setIndex(ROW_OFFSET + i);
|
||||||
animation -> setActsOnRows(true);
|
animation -> setActsOnRows(true);
|
||||||
animation -> setStartValue(QVariant(tbgrid_ -> rowMinimumHeight(ROW_OFFSET + i)));
|
animation -> setStartValue(QVariant(tbgrid_ -> rowMinimumHeight(ROW_OFFSET + i)));
|
||||||
@@ -665,7 +665,7 @@ void TitleBlockTemplateView::updateRowsHelperCells() {
|
|||||||
int row_count = tbtemplate_ -> rowsCount();
|
int row_count = tbtemplate_ -> rowsCount();
|
||||||
QList<int> heights = tbtemplate_ -> rowsHeights();
|
QList<int> heights = tbtemplate_ -> rowsHeights();
|
||||||
for (int i = 0 ; i < row_count ; ++ i) {
|
for (int i = 0 ; i < row_count ; ++ i) {
|
||||||
HelperCell *current_row_cell = static_cast<HelperCell *>(tbgrid_ -> itemAt(ROW_OFFSET + i, 0));
|
auto *current_row_cell = static_cast<HelperCell *>(tbgrid_ -> itemAt(ROW_OFFSET + i, 0));
|
||||||
if (current_row_cell) {
|
if (current_row_cell) {
|
||||||
current_row_cell -> setType(QET::Absolute); // rows always have absolute heights
|
current_row_cell -> setType(QET::Absolute); // rows always have absolute heights
|
||||||
current_row_cell -> setLabel(QString(tr("%1px", "format displayed in rows helper cells")).arg(heights.at(i)));
|
current_row_cell -> setLabel(QString(tr("%1px", "format displayed in rows helper cells")).arg(heights.at(i)));
|
||||||
@@ -680,7 +680,7 @@ void TitleBlockTemplateView::updateColumnsHelperCells() {
|
|||||||
int col_count = tbtemplate_ -> columnsCount();
|
int col_count = tbtemplate_ -> columnsCount();
|
||||||
for (int i = 0 ; i < col_count ; ++ i) {
|
for (int i = 0 ; i < col_count ; ++ i) {
|
||||||
TitleBlockDimension current_col_dim = tbtemplate_ -> columnDimension(i);
|
TitleBlockDimension current_col_dim = tbtemplate_ -> columnDimension(i);
|
||||||
HelperCell *current_col_cell = static_cast<HelperCell *>(tbgrid_ -> itemAt(1, COL_OFFSET + i));
|
auto *current_col_cell = static_cast<HelperCell *>(tbgrid_ -> itemAt(1, COL_OFFSET + i));
|
||||||
if (current_col_cell) {
|
if (current_col_cell) {
|
||||||
current_col_cell -> setType(current_col_dim.type);
|
current_col_cell -> setType(current_col_dim.type);
|
||||||
current_col_cell -> setLabel(current_col_dim.toString());
|
current_col_cell -> setLabel(current_col_dim.toString());
|
||||||
@@ -714,7 +714,7 @@ void TitleBlockTemplateView::addCells() {
|
|||||||
// we add one cell per column to show their respective width
|
// we add one cell per column to show their respective width
|
||||||
for (int i = 0 ; i < col_count ; ++ i) {
|
for (int i = 0 ; i < col_count ; ++ i) {
|
||||||
TitleBlockDimension current_col_dim = tbtemplate_ -> columnDimension(i);
|
TitleBlockDimension current_col_dim = tbtemplate_ -> columnDimension(i);
|
||||||
HelperCell *current_col_cell = new HelperCell();
|
auto *current_col_cell = new HelperCell();
|
||||||
current_col_cell -> setType(current_col_dim.type);
|
current_col_cell -> setType(current_col_dim.type);
|
||||||
current_col_cell -> setLabel(current_col_dim.toString());
|
current_col_cell -> setLabel(current_col_dim.toString());
|
||||||
current_col_cell -> setActions(columnsActions());
|
current_col_cell -> setActions(columnsActions());
|
||||||
@@ -728,7 +728,7 @@ void TitleBlockTemplateView::addCells() {
|
|||||||
// we add one cell per row to show their respective height
|
// we add one cell per row to show their respective height
|
||||||
QList<int> heights = tbtemplate_ -> rowsHeights();
|
QList<int> heights = tbtemplate_ -> rowsHeights();
|
||||||
for (int i = 0 ; i < row_count ; ++ i) {
|
for (int i = 0 ; i < row_count ; ++ i) {
|
||||||
HelperCell *current_row_cell = new HelperCell();
|
auto *current_row_cell = new HelperCell();
|
||||||
current_row_cell -> setType(QET::Absolute); // rows always have absolute heights
|
current_row_cell -> setType(QET::Absolute); // rows always have absolute heights
|
||||||
current_row_cell -> setLabel(QString(tr("%1px")).arg(heights.at(i)));
|
current_row_cell -> setLabel(QString(tr("%1px")).arg(heights.at(i)));
|
||||||
current_row_cell -> orientation = Qt::Vertical;
|
current_row_cell -> orientation = Qt::Vertical;
|
||||||
@@ -744,7 +744,7 @@ void TitleBlockTemplateView::addCells() {
|
|||||||
for (int j = 0 ; j < row_count ; ++ j) {
|
for (int j = 0 ; j < row_count ; ++ j) {
|
||||||
TitleBlockCell *cell = tbtemplate_ -> cell(j, i);
|
TitleBlockCell *cell = tbtemplate_ -> cell(j, i);
|
||||||
if (cell -> spanner_cell) continue;
|
if (cell -> spanner_cell) continue;
|
||||||
TitleBlockTemplateVisualCell *cell_item = new TitleBlockTemplateVisualCell();
|
auto *cell_item = new TitleBlockTemplateVisualCell();
|
||||||
cell_item -> setTemplateCell(tbtemplate_, cell);
|
cell_item -> setTemplateCell(tbtemplate_, cell);
|
||||||
|
|
||||||
int row_span = 0, col_span = 0;
|
int row_span = 0, col_span = 0;
|
||||||
@@ -768,7 +768,7 @@ void TitleBlockTemplateView::refresh() {
|
|||||||
for (int i = 0 ; i < col_count ; ++ i) {
|
for (int i = 0 ; i < col_count ; ++ i) {
|
||||||
for (int j = 0 ; j < row_count ; ++ j) {
|
for (int j = 0 ; j < row_count ; ++ j) {
|
||||||
if (QGraphicsLayoutItem *item = tbgrid_ -> itemAt(ROW_OFFSET + j, COL_OFFSET + i)) {
|
if (QGraphicsLayoutItem *item = tbgrid_ -> itemAt(ROW_OFFSET + j, COL_OFFSET + i)) {
|
||||||
if (QGraphicsItem *qgi = dynamic_cast<QGraphicsItem *>(item)) {
|
if (auto *qgi = dynamic_cast<QGraphicsItem *>(item)) {
|
||||||
qgi -> update();
|
qgi -> update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -800,7 +800,7 @@ void TitleBlockTemplateView::fillWithEmptyCells() {
|
|||||||
for (int i = 0 ; i < col_count ; ++ i) {
|
for (int i = 0 ; i < col_count ; ++ i) {
|
||||||
for (int j = 0 ; j < row_count ; ++ j) {
|
for (int j = 0 ; j < row_count ; ++ j) {
|
||||||
if (tbgrid_ -> itemAt(ROW_OFFSET + j, COL_OFFSET + i)) continue;
|
if (tbgrid_ -> itemAt(ROW_OFFSET + j, COL_OFFSET + i)) continue;
|
||||||
TitleBlockTemplateVisualCell *cell_item = new TitleBlockTemplateVisualCell();
|
auto *cell_item = new TitleBlockTemplateVisualCell();
|
||||||
if (TitleBlockCell *target_cell = tbtemplate_ -> cell(j, i)) {
|
if (TitleBlockCell *target_cell = tbtemplate_ -> cell(j, i)) {
|
||||||
qDebug() << Q_FUNC_INFO << "target_cell" << target_cell;
|
qDebug() << Q_FUNC_INFO << "target_cell" << target_cell;
|
||||||
cell_item -> setTemplateCell(tbtemplate_, target_cell);
|
cell_item -> setTemplateCell(tbtemplate_, target_cell);
|
||||||
@@ -1057,7 +1057,7 @@ void TitleBlockTemplateView::removeItem(QGraphicsLayoutItem *item) {
|
|||||||
TitleBlockTemplateCellsSet TitleBlockTemplateView::makeCellsSetFromGraphicsItems(const QList<QGraphicsItem *> &items) const {
|
TitleBlockTemplateCellsSet TitleBlockTemplateView::makeCellsSetFromGraphicsItems(const QList<QGraphicsItem *> &items) const {
|
||||||
TitleBlockTemplateCellsSet set(this);
|
TitleBlockTemplateCellsSet set(this);
|
||||||
foreach (QGraphicsItem *item, items) {
|
foreach (QGraphicsItem *item, items) {
|
||||||
if (TitleBlockTemplateVisualCell *cell_view = dynamic_cast<TitleBlockTemplateVisualCell *>(item)) {
|
if (auto *cell_view = dynamic_cast<TitleBlockTemplateVisualCell *>(item)) {
|
||||||
if (cell_view -> cell() && cell_view -> cell() -> num_row != -1) {
|
if (cell_view -> cell() && cell_view -> cell() -> num_row != -1) {
|
||||||
set << cell_view;
|
set << cell_view;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ void TitleBlockTemplate::exportCellToXml(TitleBlockCell *cell, QDomElement &xml_
|
|||||||
cells are duplicated too and associated with their parent template).
|
cells are duplicated too and associated with their parent template).
|
||||||
*/
|
*/
|
||||||
TitleBlockTemplate *TitleBlockTemplate::clone() const {
|
TitleBlockTemplate *TitleBlockTemplate::clone() const {
|
||||||
TitleBlockTemplate *copy = new TitleBlockTemplate();
|
auto *copy = new TitleBlockTemplate();
|
||||||
copy -> name_ = name_;
|
copy -> name_ = name_;
|
||||||
copy -> information_ = information_;
|
copy -> information_ = information_;
|
||||||
|
|
||||||
@@ -1030,7 +1030,7 @@ bool TitleBlockTemplate::addLogo(const QString &logo_name, QByteArray *logo_data
|
|||||||
// we can now create our image object from the byte array
|
// we can now create our image object from the byte array
|
||||||
if (logo_type == "svg") {
|
if (logo_type == "svg") {
|
||||||
// SVG format is handled by the QSvgRenderer class
|
// SVG format is handled by the QSvgRenderer class
|
||||||
QSvgRenderer *svg = new QSvgRenderer();
|
auto *svg = new QSvgRenderer();
|
||||||
if (!svg -> load(*logo_data)) {
|
if (!svg -> load(*logo_data)) {
|
||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ void ConductorPropertiesDialog::PropertiesDialog(Conductor *conductor, QWidget *
|
|||||||
old_value.setValue(conductor->properties());
|
old_value.setValue(conductor->properties());
|
||||||
new_value.setValue(cpd.properties());
|
new_value.setValue(cpd.properties());
|
||||||
|
|
||||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(conductor, "properties", old_value, new_value);
|
auto *undo = new QPropertyUndoCommand(conductor, "properties", old_value, new_value);
|
||||||
undo->setText(tr("Modifier les propriétés d'un conducteur", "undo caption"));
|
undo->setText(tr("Modifier les propriétés d'un conducteur", "undo caption"));
|
||||||
|
|
||||||
if (!conductor->relatedPotentialConductors().isEmpty() && cpd.applyAll())
|
if (!conductor->relatedPotentialConductors().isEmpty() && cpd.applyAll())
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ DiagramPropertiesDialog::DiagramPropertiesDialog(Diagram *diagram, QWidget *pare
|
|||||||
setWindowTitle(tr("Propriétés du folio", "window title"));
|
setWindowTitle(tr("Propriétés du folio", "window title"));
|
||||||
|
|
||||||
//Border widget
|
//Border widget
|
||||||
BorderPropertiesWidget *border_infos = new BorderPropertiesWidget(border, this);
|
auto *border_infos = new BorderPropertiesWidget(border, this);
|
||||||
border_infos -> setReadOnly(diagram_is_read_only);
|
border_infos -> setReadOnly(diagram_is_read_only);
|
||||||
|
|
||||||
//Title block widget
|
//Title block widget
|
||||||
@@ -78,7 +78,7 @@ DiagramPropertiesDialog::DiagramPropertiesDialog(Diagram *diagram, QWidget *pare
|
|||||||
connect(&boutons, SIGNAL(accepted()), this, SLOT(accept()));
|
connect(&boutons, SIGNAL(accepted()), this, SLOT(accept()));
|
||||||
connect(&boutons, SIGNAL(rejected()), this, SLOT(reject()));
|
connect(&boutons, SIGNAL(rejected()), this, SLOT(reject()));
|
||||||
|
|
||||||
QGridLayout *glayout = new QGridLayout;
|
auto *glayout = new QGridLayout;
|
||||||
glayout->addWidget(border_infos,0,0);
|
glayout->addWidget(border_infos,0,0);
|
||||||
glayout->addWidget(titleblock_infos, 1, 0);
|
glayout->addWidget(titleblock_infos, 1, 0);
|
||||||
glayout->addWidget(m_cpw, 0, 1, 0, 1);
|
glayout->addWidget(m_cpw, 0, 1, 0, 1);
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ void DiagramPropertiesEditorDockWidget::selectionChanged()
|
|||||||
}
|
}
|
||||||
case DynamicElementTextItem::Type:
|
case DynamicElementTextItem::Type:
|
||||||
{
|
{
|
||||||
DynamicElementTextItem *deti = static_cast<DynamicElementTextItem *>(item);
|
auto *deti = static_cast<DynamicElementTextItem *>(item);
|
||||||
|
|
||||||
//For dynamic element text, we open the element editor to edit it
|
//For dynamic element text, we open the element editor to edit it
|
||||||
//If we already edit an element, just update the editor with a new element
|
//If we already edit an element, just update the editor with a new element
|
||||||
@@ -144,7 +144,7 @@ void DiagramPropertiesEditorDockWidget::selectionChanged()
|
|||||||
}
|
}
|
||||||
case QGraphicsItemGroup::Type:
|
case QGraphicsItemGroup::Type:
|
||||||
{
|
{
|
||||||
if(ElementTextItemGroup *group = dynamic_cast<ElementTextItemGroup *>(item))
|
if(auto *group = dynamic_cast<ElementTextItemGroup *>(item))
|
||||||
{
|
{
|
||||||
//For element text item group, we open the element editor to edit it
|
//For element text item group, we open the element editor to edit it
|
||||||
//If we already edit an element, just update the editor with a new element
|
//If we already edit an element, just update the editor with a new element
|
||||||
|
|||||||
@@ -62,8 +62,8 @@ void diagramselection::load_TableDiagram() {
|
|||||||
|
|
||||||
// List Diagrams
|
// List Diagrams
|
||||||
for(int i=0,j=0; i<list_diagram_.count(); i++,j++){
|
for(int i=0,j=0; i<list_diagram_.count(); i++,j++){
|
||||||
QTableWidgetItem *item_Name = new QTableWidgetItem();
|
auto *item_Name = new QTableWidgetItem();
|
||||||
QTableWidgetItem *item_State = new QTableWidgetItem();
|
auto *item_State = new QTableWidgetItem();
|
||||||
|
|
||||||
QString diagram_title = list_diagram_.at(i) -> title();
|
QString diagram_title = list_diagram_.at(i) -> title();
|
||||||
if (diagram_title.isEmpty()) diagram_title = tr("Folio sans titre");
|
if (diagram_title.isEmpty()) diagram_title = tr("Folio sans titre");
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ void DynamicElementTextItemEditor::apply()
|
|||||||
|
|
||||||
if (undo->childCount() == 1)
|
if (undo->childCount() == 1)
|
||||||
{
|
{
|
||||||
QPropertyUndoCommand *quc = new QPropertyUndoCommand(static_cast<const QPropertyUndoCommand *>(undo->child(0)));
|
auto *quc = new QPropertyUndoCommand(static_cast<const QPropertyUndoCommand *>(undo->child(0)));
|
||||||
if (quc->text().isEmpty())
|
if (quc->text().isEmpty())
|
||||||
quc->setText(undo->text());
|
quc->setText(undo->text());
|
||||||
undo_list << quc;
|
undo_list << quc;
|
||||||
@@ -105,7 +105,7 @@ void DynamicElementTextItemEditor::apply()
|
|||||||
|
|
||||||
if (undo->childCount() == 1)
|
if (undo->childCount() == 1)
|
||||||
{
|
{
|
||||||
QPropertyUndoCommand *quc = new QPropertyUndoCommand(static_cast<const QPropertyUndoCommand *>(undo->child(0)));
|
auto *quc = new QPropertyUndoCommand(static_cast<const QPropertyUndoCommand *>(undo->child(0)));
|
||||||
if (quc->text().isEmpty())
|
if (quc->text().isEmpty())
|
||||||
quc->setText(undo->text());
|
quc->setText(undo->text());
|
||||||
undo_list << quc;
|
undo_list << quc;
|
||||||
@@ -201,7 +201,7 @@ void DynamicElementTextItemEditor::on_m_add_text_clicked()
|
|||||||
if (!m_element)
|
if (!m_element)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DynamicElementTextItem *deti = new DynamicElementTextItem(m_element);
|
auto *deti = new DynamicElementTextItem(m_element);
|
||||||
if (m_element->diagram())
|
if (m_element->diagram())
|
||||||
{
|
{
|
||||||
m_element->diagram()->undoStack().push(new AddElementTextCommand(m_element, deti));
|
m_element->diagram()->undoStack().push(new AddElementTextCommand(m_element, deti));
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ QList<QStandardItem *> DynamicElementTextModel::itemsForText(DynamicElementTextI
|
|||||||
if (deti->textFrom() == DynamicElementTextItem::UserText) title = tr("Texte utilisateur");
|
if (deti->textFrom() == DynamicElementTextItem::UserText) title = tr("Texte utilisateur");
|
||||||
else if (deti->textFrom() == DynamicElementTextItem::ElementInfo) title = tr("Information de l'élément");
|
else if (deti->textFrom() == DynamicElementTextItem::ElementInfo) title = tr("Information de l'élément");
|
||||||
else title = tr("Texte composé");
|
else title = tr("Texte composé");
|
||||||
QStandardItem *srca = new QStandardItem(title);
|
auto *srca = new QStandardItem(title);
|
||||||
srca->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable);
|
srca->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable);
|
||||||
srca->setData(textFrom, Qt::UserRole+1);
|
srca->setData(textFrom, Qt::UserRole+1);
|
||||||
|
|
||||||
@@ -192,7 +192,7 @@ QList<QStandardItem *> DynamicElementTextModel::itemsForText(DynamicElementTextI
|
|||||||
QStandardItem *size = new QStandardItem(tr("Taille"));
|
QStandardItem *size = new QStandardItem(tr("Taille"));
|
||||||
size->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
size->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||||
|
|
||||||
QStandardItem *siza = new QStandardItem();
|
auto *siza = new QStandardItem();
|
||||||
siza->setData(deti->fontSize(), Qt::EditRole);
|
siza->setData(deti->fontSize(), Qt::EditRole);
|
||||||
siza->setData(DynamicElementTextModel::size, Qt::UserRole+1);
|
siza->setData(DynamicElementTextModel::size, Qt::UserRole+1);
|
||||||
siza->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable);
|
siza->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable);
|
||||||
@@ -205,7 +205,7 @@ QList<QStandardItem *> DynamicElementTextModel::itemsForText(DynamicElementTextI
|
|||||||
QStandardItem *color = new QStandardItem(tr("Couleur"));
|
QStandardItem *color = new QStandardItem(tr("Couleur"));
|
||||||
color->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
color->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||||
|
|
||||||
QStandardItem *colora = new QStandardItem;
|
auto *colora = new QStandardItem;
|
||||||
colora->setData(deti->color(), Qt::ForegroundRole);
|
colora->setData(deti->color(), Qt::ForegroundRole);
|
||||||
colora->setData(deti->color(), Qt::EditRole);
|
colora->setData(deti->color(), Qt::EditRole);
|
||||||
colora->setData(DynamicElementTextModel::color, Qt::UserRole+1);
|
colora->setData(DynamicElementTextModel::color, Qt::UserRole+1);
|
||||||
@@ -219,7 +219,7 @@ QList<QStandardItem *> DynamicElementTextModel::itemsForText(DynamicElementTextI
|
|||||||
QStandardItem *frame = new QStandardItem(tr("Cadre"));
|
QStandardItem *frame = new QStandardItem(tr("Cadre"));
|
||||||
frame->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
frame->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||||
|
|
||||||
QStandardItem *frame_a = new QStandardItem;
|
auto *frame_a = new QStandardItem;
|
||||||
frame_a->setCheckable(true);
|
frame_a->setCheckable(true);
|
||||||
frame_a->setCheckState(deti->frame()? Qt::Checked : Qt::Unchecked);
|
frame_a->setCheckState(deti->frame()? Qt::Checked : Qt::Unchecked);
|
||||||
frame_a->setData(DynamicElementTextModel::frame, Qt::UserRole+1);
|
frame_a->setData(DynamicElementTextModel::frame, Qt::UserRole+1);
|
||||||
@@ -233,7 +233,7 @@ QList<QStandardItem *> DynamicElementTextModel::itemsForText(DynamicElementTextI
|
|||||||
QStandardItem *width = new QStandardItem(tr("Largeur"));
|
QStandardItem *width = new QStandardItem(tr("Largeur"));
|
||||||
width->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
width->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||||
|
|
||||||
QStandardItem *width_a = new QStandardItem;
|
auto *width_a = new QStandardItem;
|
||||||
width_a->setData(deti->textWidth(), Qt::EditRole);
|
width_a->setData(deti->textWidth(), Qt::EditRole);
|
||||||
width_a->setData(DynamicElementTextModel::textWidth, Qt::UserRole+1);
|
width_a->setData(DynamicElementTextModel::textWidth, Qt::UserRole+1);
|
||||||
width_a->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable);
|
width_a->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable);
|
||||||
@@ -248,7 +248,7 @@ QList<QStandardItem *> DynamicElementTextModel::itemsForText(DynamicElementTextI
|
|||||||
QStandardItem *x_pos = new QStandardItem(tr("Position X"));
|
QStandardItem *x_pos = new QStandardItem(tr("Position X"));
|
||||||
x_pos->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
x_pos->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||||
|
|
||||||
QStandardItem *x_pos_a = new QStandardItem;
|
auto *x_pos_a = new QStandardItem;
|
||||||
x_pos_a->setData(deti->pos().x(), Qt::EditRole);
|
x_pos_a->setData(deti->pos().x(), Qt::EditRole);
|
||||||
x_pos_a->setData(DynamicElementTextModel::pos, Qt::UserRole+1);
|
x_pos_a->setData(DynamicElementTextModel::pos, Qt::UserRole+1);
|
||||||
x_pos_a->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable);
|
x_pos_a->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable);
|
||||||
@@ -261,7 +261,7 @@ QList<QStandardItem *> DynamicElementTextModel::itemsForText(DynamicElementTextI
|
|||||||
QStandardItem *y_pos = new QStandardItem(tr("Position Y"));
|
QStandardItem *y_pos = new QStandardItem(tr("Position Y"));
|
||||||
y_pos->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
y_pos->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||||
|
|
||||||
QStandardItem *y_pos_a = new QStandardItem;
|
auto *y_pos_a = new QStandardItem;
|
||||||
y_pos_a->setData(deti->pos().y(), Qt::EditRole);
|
y_pos_a->setData(deti->pos().y(), Qt::EditRole);
|
||||||
y_pos_a->setData(DynamicElementTextModel::pos, Qt::UserRole+1);
|
y_pos_a->setData(DynamicElementTextModel::pos, Qt::UserRole+1);
|
||||||
y_pos_a->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable);
|
y_pos_a->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable);
|
||||||
@@ -274,7 +274,7 @@ QList<QStandardItem *> DynamicElementTextModel::itemsForText(DynamicElementTextI
|
|||||||
QStandardItem *rot = new QStandardItem(tr("Rotation"));
|
QStandardItem *rot = new QStandardItem(tr("Rotation"));
|
||||||
rot->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
rot->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||||
|
|
||||||
QStandardItem *rot_a = new QStandardItem;
|
auto *rot_a = new QStandardItem;
|
||||||
rot_a->setData(deti->rotation(), Qt::EditRole);
|
rot_a->setData(deti->rotation(), Qt::EditRole);
|
||||||
rot_a->setData(DynamicElementTextModel::rotation, Qt::UserRole+1);
|
rot_a->setData(DynamicElementTextModel::rotation, Qt::UserRole+1);
|
||||||
rot_a->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable);
|
rot_a->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable);
|
||||||
@@ -299,7 +299,7 @@ QList<QStandardItem *> DynamicElementTextModel::itemsForText(DynamicElementTextI
|
|||||||
|
|
||||||
|
|
||||||
qsi_list.clear();
|
qsi_list.clear();
|
||||||
QStandardItem *empty_qsi = new QStandardItem(0);
|
auto *empty_qsi = new QStandardItem(0);
|
||||||
empty_qsi->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
empty_qsi->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||||
qsi_list << qsi << empty_qsi;
|
qsi_list << qsi << empty_qsi;
|
||||||
|
|
||||||
@@ -620,7 +620,7 @@ void DynamicElementTextModel::addGroup(ElementTextItemGroup *group)
|
|||||||
grp->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDropEnabled | Qt::ItemIsEditable);
|
grp->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDropEnabled | Qt::ItemIsEditable);
|
||||||
grp->setIcon(QET::Icons::textGroup);
|
grp->setIcon(QET::Icons::textGroup);
|
||||||
|
|
||||||
QStandardItem *empty_qsi = new QStandardItem(0);
|
auto *empty_qsi = new QStandardItem(0);
|
||||||
empty_qsi->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
empty_qsi->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||||
|
|
||||||
QList<QStandardItem *> qsi_list;
|
QList<QStandardItem *> qsi_list;
|
||||||
@@ -640,7 +640,7 @@ void DynamicElementTextModel::addGroup(ElementTextItemGroup *group)
|
|||||||
case Qt::AlignVCenter: text = tr("Centre"); break;
|
case Qt::AlignVCenter: text = tr("Centre"); break;
|
||||||
default: break;}
|
default: break;}
|
||||||
|
|
||||||
QStandardItem *alignment_a = new QStandardItem(text);
|
auto *alignment_a = new QStandardItem(text);
|
||||||
alignment_a->setData(DynamicElementTextModel::grpAlignment, Qt::UserRole+1);
|
alignment_a->setData(DynamicElementTextModel::grpAlignment, Qt::UserRole+1);
|
||||||
alignment_a->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable);
|
alignment_a->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable);
|
||||||
qsi_list.clear();
|
qsi_list.clear();
|
||||||
@@ -651,7 +651,7 @@ void DynamicElementTextModel::addGroup(ElementTextItemGroup *group)
|
|||||||
QStandardItem *x_pos = new QStandardItem(tr("Position X"));
|
QStandardItem *x_pos = new QStandardItem(tr("Position X"));
|
||||||
x_pos->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
x_pos->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||||
|
|
||||||
QStandardItem *x_pos_a = new QStandardItem;
|
auto *x_pos_a = new QStandardItem;
|
||||||
x_pos_a->setData(group->pos().x(), Qt::EditRole);
|
x_pos_a->setData(group->pos().x(), Qt::EditRole);
|
||||||
x_pos_a->setData(DynamicElementTextModel::grpPos, Qt::UserRole+1);
|
x_pos_a->setData(DynamicElementTextModel::grpPos, Qt::UserRole+1);
|
||||||
x_pos_a->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable);
|
x_pos_a->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable);
|
||||||
@@ -664,7 +664,7 @@ void DynamicElementTextModel::addGroup(ElementTextItemGroup *group)
|
|||||||
QStandardItem *y_pos = new QStandardItem(tr("Position Y"));
|
QStandardItem *y_pos = new QStandardItem(tr("Position Y"));
|
||||||
y_pos->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
y_pos->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||||
|
|
||||||
QStandardItem *y_pos_a = new QStandardItem;
|
auto *y_pos_a = new QStandardItem;
|
||||||
y_pos_a->setData(group->pos().y(), Qt::EditRole);
|
y_pos_a->setData(group->pos().y(), Qt::EditRole);
|
||||||
y_pos_a->setData(DynamicElementTextModel::grpPos, Qt::UserRole+1);
|
y_pos_a->setData(DynamicElementTextModel::grpPos, Qt::UserRole+1);
|
||||||
y_pos_a->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable);
|
y_pos_a->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable);
|
||||||
@@ -677,7 +677,7 @@ void DynamicElementTextModel::addGroup(ElementTextItemGroup *group)
|
|||||||
QStandardItem *rot = new QStandardItem(tr("Rotation"));
|
QStandardItem *rot = new QStandardItem(tr("Rotation"));
|
||||||
rot->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
rot->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||||
|
|
||||||
QStandardItem *rot_a = new QStandardItem;
|
auto *rot_a = new QStandardItem;
|
||||||
rot_a->setData(group->rotation(), Qt::EditRole);
|
rot_a->setData(group->rotation(), Qt::EditRole);
|
||||||
rot_a->setData(DynamicElementTextModel::grpRotation, Qt::UserRole+1);
|
rot_a->setData(DynamicElementTextModel::grpRotation, Qt::UserRole+1);
|
||||||
rot_a->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable);
|
rot_a->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable);
|
||||||
@@ -689,7 +689,7 @@ void DynamicElementTextModel::addGroup(ElementTextItemGroup *group)
|
|||||||
QStandardItem *v_adj = new QStandardItem(tr("Ajustement vertical"));
|
QStandardItem *v_adj = new QStandardItem(tr("Ajustement vertical"));
|
||||||
v_adj->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
v_adj->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
||||||
|
|
||||||
QStandardItem *v_adj_a = new QStandardItem;
|
auto *v_adj_a = new QStandardItem;
|
||||||
v_adj_a->setData(group->verticalAdjustment(), Qt::EditRole);
|
v_adj_a->setData(group->verticalAdjustment(), Qt::EditRole);
|
||||||
v_adj_a->setData(DynamicElementTextModel::grpVAdjust, Qt::UserRole+1);
|
v_adj_a->setData(DynamicElementTextModel::grpVAdjust, Qt::UserRole+1);
|
||||||
v_adj_a->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable);
|
v_adj_a->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable);
|
||||||
@@ -701,7 +701,7 @@ void DynamicElementTextModel::addGroup(ElementTextItemGroup *group)
|
|||||||
QStandardItem *frame_ = new QStandardItem(tr("Cadre"));
|
QStandardItem *frame_ = new QStandardItem(tr("Cadre"));
|
||||||
frame_->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
frame_->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
||||||
|
|
||||||
QStandardItem *frame_a = new QStandardItem;
|
auto *frame_a = new QStandardItem;
|
||||||
frame_a->setCheckable(true);
|
frame_a->setCheckable(true);
|
||||||
frame_a->setCheckState(group->frame()? Qt::Checked : Qt::Unchecked);
|
frame_a->setCheckState(group->frame()? Qt::Checked : Qt::Unchecked);
|
||||||
frame_a->setData(DynamicElementTextModel::grpFrame, Qt::UserRole+1);
|
frame_a->setData(DynamicElementTextModel::grpFrame, Qt::UserRole+1);
|
||||||
@@ -715,7 +715,7 @@ void DynamicElementTextModel::addGroup(ElementTextItemGroup *group)
|
|||||||
QStandardItem *hold_bottom = new QStandardItem(tr("Maintenir en bas de page"));
|
QStandardItem *hold_bottom = new QStandardItem(tr("Maintenir en bas de page"));
|
||||||
hold_bottom->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
hold_bottom->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
||||||
|
|
||||||
QStandardItem *hold_bottom_a = new QStandardItem();
|
auto *hold_bottom_a = new QStandardItem();
|
||||||
hold_bottom_a->setCheckable(true);
|
hold_bottom_a->setCheckable(true);
|
||||||
hold_bottom_a->setCheckState(group->holdToBottomPage() ? Qt::Checked : Qt::Unchecked);
|
hold_bottom_a->setCheckState(group->holdToBottomPage() ? Qt::Checked : Qt::Unchecked);
|
||||||
hold_bottom_a->setData(DynamicElementTextModel::grpHoldBottom, Qt::UserRole+1);
|
hold_bottom_a->setData(DynamicElementTextModel::grpHoldBottom, Qt::UserRole+1);
|
||||||
@@ -1046,7 +1046,7 @@ QMimeData *DynamicElementTextModel::mimeData(const QModelIndexList &indexes) con
|
|||||||
DynamicElementTextItem *deti = m_texts_list.key(item);
|
DynamicElementTextItem *deti = m_texts_list.key(item);
|
||||||
if(deti)
|
if(deti)
|
||||||
{
|
{
|
||||||
QMimeData *mime_data = new QMimeData();
|
auto *mime_data = new QMimeData();
|
||||||
mime_data->setText(deti->uuid().toString());
|
mime_data->setText(deti->uuid().toString());
|
||||||
mime_data->setData("application/x-qet-element-text-uuid", deti->uuid().toString().toLatin1());
|
mime_data->setData("application/x-qet-element-text-uuid", deti->uuid().toString().toLatin1());
|
||||||
return mime_data;
|
return mime_data;
|
||||||
@@ -1421,7 +1421,7 @@ QWidget *DynamicTextItemDelegate::createEditor(QWidget *parent, const QStyleOpti
|
|||||||
{
|
{
|
||||||
case DynamicElementTextModel::textFrom:
|
case DynamicElementTextModel::textFrom:
|
||||||
{
|
{
|
||||||
QComboBox *qcb = new QComboBox(parent);
|
auto *qcb = new QComboBox(parent);
|
||||||
qcb->setObjectName("text_from");
|
qcb->setObjectName("text_from");
|
||||||
qcb->addItem(tr("Texte utilisateur"));
|
qcb->addItem(tr("Texte utilisateur"));
|
||||||
qcb->addItem(tr("Information de l'élément"));
|
qcb->addItem(tr("Information de l'élément"));
|
||||||
@@ -1430,7 +1430,7 @@ QWidget *DynamicTextItemDelegate::createEditor(QWidget *parent, const QStyleOpti
|
|||||||
}
|
}
|
||||||
case DynamicElementTextModel::infoText:
|
case DynamicElementTextModel::infoText:
|
||||||
{
|
{
|
||||||
const DynamicElementTextModel *detm = static_cast<const DynamicElementTextModel *>(index.model());
|
const auto *detm = static_cast<const DynamicElementTextModel *>(index.model());
|
||||||
QStandardItem *qsi = detm->itemFromIndex(index);
|
QStandardItem *qsi = detm->itemFromIndex(index);
|
||||||
|
|
||||||
if(!qsi)
|
if(!qsi)
|
||||||
@@ -1447,7 +1447,7 @@ QWidget *DynamicTextItemDelegate::createEditor(QWidget *parent, const QStyleOpti
|
|||||||
info_map.insert(QETApp::elementTranslatedInfoKey(str), str);
|
info_map.insert(QETApp::elementTranslatedInfoKey(str), str);
|
||||||
}
|
}
|
||||||
|
|
||||||
QComboBox *qcb = new QComboBox(parent);
|
auto *qcb = new QComboBox(parent);
|
||||||
qcb->setObjectName("info_text");
|
qcb->setObjectName("info_text");
|
||||||
for (const QString& key : info_map.keys()) {
|
for (const QString& key : info_map.keys()) {
|
||||||
qcb->addItem(key, info_map.value(key));
|
qcb->addItem(key, info_map.value(key));
|
||||||
@@ -1456,7 +1456,7 @@ QWidget *DynamicTextItemDelegate::createEditor(QWidget *parent, const QStyleOpti
|
|||||||
}
|
}
|
||||||
case DynamicElementTextModel::compositeText:
|
case DynamicElementTextModel::compositeText:
|
||||||
{
|
{
|
||||||
const DynamicElementTextModel *detm = static_cast<const DynamicElementTextModel *>(index.model());
|
const auto *detm = static_cast<const DynamicElementTextModel *>(index.model());
|
||||||
QStandardItem *qsi = detm->itemFromIndex(index);
|
QStandardItem *qsi = detm->itemFromIndex(index);
|
||||||
|
|
||||||
if(!qsi)
|
if(!qsi)
|
||||||
@@ -1466,13 +1466,13 @@ QWidget *DynamicTextItemDelegate::createEditor(QWidget *parent, const QStyleOpti
|
|||||||
if(!deti)
|
if(!deti)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
CompositeTextEditDialog *cted = new CompositeTextEditDialog(deti, parent);
|
auto *cted = new CompositeTextEditDialog(deti, parent);
|
||||||
cted->setObjectName("composite_text");
|
cted->setObjectName("composite_text");
|
||||||
return cted;
|
return cted;
|
||||||
}
|
}
|
||||||
case DynamicElementTextModel::txtAlignment:
|
case DynamicElementTextModel::txtAlignment:
|
||||||
{
|
{
|
||||||
const DynamicElementTextModel *detm = static_cast<const DynamicElementTextModel *>(index.model());
|
const auto *detm = static_cast<const DynamicElementTextModel *>(index.model());
|
||||||
QStandardItem *qsi = detm->itemFromIndex(index);
|
QStandardItem *qsi = detm->itemFromIndex(index);
|
||||||
|
|
||||||
if(!qsi)
|
if(!qsi)
|
||||||
@@ -1488,7 +1488,7 @@ QWidget *DynamicTextItemDelegate::createEditor(QWidget *parent, const QStyleOpti
|
|||||||
}
|
}
|
||||||
case DynamicElementTextModel::size:
|
case DynamicElementTextModel::size:
|
||||||
{
|
{
|
||||||
QSpinBox *sb = new QSpinBox(parent);
|
auto *sb = new QSpinBox(parent);
|
||||||
sb->setObjectName("font_size");
|
sb->setObjectName("font_size");
|
||||||
sb->setFrame(false);
|
sb->setFrame(false);
|
||||||
return sb;
|
return sb;
|
||||||
@@ -1501,7 +1501,7 @@ QWidget *DynamicTextItemDelegate::createEditor(QWidget *parent, const QStyleOpti
|
|||||||
}
|
}
|
||||||
case DynamicElementTextModel::pos:
|
case DynamicElementTextModel::pos:
|
||||||
{
|
{
|
||||||
QSpinBox *sb = new QSpinBox(parent);
|
auto *sb = new QSpinBox(parent);
|
||||||
sb->setObjectName("pos_dialog");
|
sb->setObjectName("pos_dialog");
|
||||||
sb->setRange(-1000,10000);
|
sb->setRange(-1000,10000);
|
||||||
sb->setFrame(false);
|
sb->setFrame(false);
|
||||||
@@ -1510,7 +1510,7 @@ QWidget *DynamicTextItemDelegate::createEditor(QWidget *parent, const QStyleOpti
|
|||||||
}
|
}
|
||||||
case DynamicElementTextModel::rotation:
|
case DynamicElementTextModel::rotation:
|
||||||
{
|
{
|
||||||
QSpinBox *sb = new QSpinBox(parent);
|
auto *sb = new QSpinBox(parent);
|
||||||
sb->setObjectName("rot_spinbox");
|
sb->setObjectName("rot_spinbox");
|
||||||
sb->setRange(0, 359);
|
sb->setRange(0, 359);
|
||||||
sb->setWrapping(true);
|
sb->setWrapping(true);
|
||||||
@@ -1520,7 +1520,7 @@ QWidget *DynamicTextItemDelegate::createEditor(QWidget *parent, const QStyleOpti
|
|||||||
}
|
}
|
||||||
case DynamicElementTextModel::textWidth:
|
case DynamicElementTextModel::textWidth:
|
||||||
{
|
{
|
||||||
QSpinBox *sb = new QSpinBox(parent);
|
auto *sb = new QSpinBox(parent);
|
||||||
sb->setObjectName("width_spinbox");
|
sb->setObjectName("width_spinbox");
|
||||||
sb->setRange(-1, 500);
|
sb->setRange(-1, 500);
|
||||||
sb->setFrame(false);
|
sb->setFrame(false);
|
||||||
@@ -1529,7 +1529,7 @@ QWidget *DynamicTextItemDelegate::createEditor(QWidget *parent, const QStyleOpti
|
|||||||
}
|
}
|
||||||
case DynamicElementTextModel::grpAlignment:
|
case DynamicElementTextModel::grpAlignment:
|
||||||
{
|
{
|
||||||
QComboBox *qcb = new QComboBox(parent);
|
auto *qcb = new QComboBox(parent);
|
||||||
qcb->setFrame(false);
|
qcb->setFrame(false);
|
||||||
qcb->setObjectName("group_alignment");
|
qcb->setObjectName("group_alignment");
|
||||||
qcb->addItem(tr("Gauche"));
|
qcb->addItem(tr("Gauche"));
|
||||||
@@ -1539,7 +1539,7 @@ QWidget *DynamicTextItemDelegate::createEditor(QWidget *parent, const QStyleOpti
|
|||||||
}
|
}
|
||||||
case DynamicElementTextModel::grpPos:
|
case DynamicElementTextModel::grpPos:
|
||||||
{
|
{
|
||||||
QSpinBox *sb = new QSpinBox(parent);
|
auto *sb = new QSpinBox(parent);
|
||||||
sb->setObjectName("group_pos");
|
sb->setObjectName("group_pos");
|
||||||
sb->setRange(-1000,10000);
|
sb->setRange(-1000,10000);
|
||||||
sb->setFrame(false);
|
sb->setFrame(false);
|
||||||
@@ -1548,7 +1548,7 @@ QWidget *DynamicTextItemDelegate::createEditor(QWidget *parent, const QStyleOpti
|
|||||||
}
|
}
|
||||||
case DynamicElementTextModel::grpRotation:
|
case DynamicElementTextModel::grpRotation:
|
||||||
{
|
{
|
||||||
QSpinBox *sb = new QSpinBox(parent);
|
auto *sb = new QSpinBox(parent);
|
||||||
sb->setObjectName("group_rotation");
|
sb->setObjectName("group_rotation");
|
||||||
sb->setRange(0, 359);
|
sb->setRange(0, 359);
|
||||||
sb->setWrapping(true);
|
sb->setWrapping(true);
|
||||||
@@ -1558,7 +1558,7 @@ QWidget *DynamicTextItemDelegate::createEditor(QWidget *parent, const QStyleOpti
|
|||||||
}
|
}
|
||||||
case DynamicElementTextModel::grpVAdjust:
|
case DynamicElementTextModel::grpVAdjust:
|
||||||
{
|
{
|
||||||
QSpinBox *sb = new QSpinBox(parent);
|
auto *sb = new QSpinBox(parent);
|
||||||
sb->setObjectName("group_v_adjustment");
|
sb->setObjectName("group_v_adjustment");
|
||||||
sb->setRange(-20, 20);
|
sb->setRange(-20, 20);
|
||||||
sb->setFrame(false);
|
sb->setFrame(false);
|
||||||
@@ -1575,11 +1575,11 @@ void DynamicTextItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *
|
|||||||
{
|
{
|
||||||
if(editor->objectName() == "color_dialog")
|
if(editor->objectName() == "color_dialog")
|
||||||
{
|
{
|
||||||
if (QStandardItemModel *qsim = dynamic_cast<QStandardItemModel *>(model))
|
if (auto *qsim = dynamic_cast<QStandardItemModel *>(model))
|
||||||
{
|
{
|
||||||
if(QStandardItem *qsi = qsim->itemFromIndex(index))
|
if(QStandardItem *qsi = qsim->itemFromIndex(index))
|
||||||
{
|
{
|
||||||
QColorDialog *cd = static_cast<QColorDialog *> (editor);
|
auto *cd = static_cast<QColorDialog *> (editor);
|
||||||
qsi->setData(cd->selectedColor(), Qt::EditRole);
|
qsi->setData(cd->selectedColor(), Qt::EditRole);
|
||||||
qsi->setData(cd->selectedColor(), Qt::ForegroundRole);
|
qsi->setData(cd->selectedColor(), Qt::ForegroundRole);
|
||||||
return;
|
return;
|
||||||
@@ -1589,11 +1589,11 @@ void DynamicTextItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *
|
|||||||
}
|
}
|
||||||
else if (editor->objectName() == "info_text")
|
else if (editor->objectName() == "info_text")
|
||||||
{
|
{
|
||||||
if (QStandardItemModel *qsim = dynamic_cast<QStandardItemModel *>(model))
|
if (auto *qsim = dynamic_cast<QStandardItemModel *>(model))
|
||||||
{
|
{
|
||||||
if(QStandardItem *qsi = qsim->itemFromIndex(index))
|
if(QStandardItem *qsi = qsim->itemFromIndex(index))
|
||||||
{
|
{
|
||||||
QComboBox *cb = static_cast<QComboBox *>(editor);
|
auto *cb = static_cast<QComboBox *>(editor);
|
||||||
qsi->setData(cb->currentText(), Qt::DisplayRole);
|
qsi->setData(cb->currentText(), Qt::DisplayRole);
|
||||||
qsi->setData(cb->currentData(), Qt::UserRole+2);
|
qsi->setData(cb->currentData(), Qt::UserRole+2);
|
||||||
return;
|
return;
|
||||||
@@ -1603,17 +1603,17 @@ void DynamicTextItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *
|
|||||||
}
|
}
|
||||||
else if (editor->objectName() == "composite_text")
|
else if (editor->objectName() == "composite_text")
|
||||||
{
|
{
|
||||||
if (QStandardItemModel *qsim = dynamic_cast<QStandardItemModel *>(model))
|
if (auto *qsim = dynamic_cast<QStandardItemModel *>(model))
|
||||||
{
|
{
|
||||||
if(QStandardItem *qsi = qsim->itemFromIndex(index))
|
if(QStandardItem *qsi = qsim->itemFromIndex(index))
|
||||||
{
|
{
|
||||||
|
|
||||||
CompositeTextEditDialog *cted = static_cast<CompositeTextEditDialog *>(editor);
|
auto *cted = static_cast<CompositeTextEditDialog *>(editor);
|
||||||
|
|
||||||
QString edited_text = cted->plainText();
|
QString edited_text = cted->plainText();
|
||||||
QString assigned_text;
|
QString assigned_text;
|
||||||
|
|
||||||
const DynamicElementTextModel *detm = static_cast<const DynamicElementTextModel *>(index.model());
|
const auto *detm = static_cast<const DynamicElementTextModel *>(index.model());
|
||||||
DynamicElementTextItem *deti = detm->textFromIndex(index);
|
DynamicElementTextItem *deti = detm->textFromIndex(index);
|
||||||
if(deti)
|
if(deti)
|
||||||
{
|
{
|
||||||
@@ -1631,11 +1631,11 @@ void DynamicTextItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *
|
|||||||
}
|
}
|
||||||
else if (editor->objectName() == "alignment_text")
|
else if (editor->objectName() == "alignment_text")
|
||||||
{
|
{
|
||||||
if(QStandardItemModel *qsim = dynamic_cast<QStandardItemModel *>(model))
|
if(auto *qsim = dynamic_cast<QStandardItemModel *>(model))
|
||||||
{
|
{
|
||||||
if(QStandardItem *qsi = qsim->itemFromIndex(index))
|
if(QStandardItem *qsi = qsim->itemFromIndex(index))
|
||||||
{
|
{
|
||||||
AlignmentTextDialog *atd = static_cast<AlignmentTextDialog *>(editor);
|
auto *atd = static_cast<AlignmentTextDialog *>(editor);
|
||||||
Qt::Alignment align = atd->alignment();
|
Qt::Alignment align = atd->alignment();
|
||||||
qsi->setData(QVariant::fromValue(align), Qt::UserRole+2);
|
qsi->setData(QVariant::fromValue(align), Qt::UserRole+2);
|
||||||
return;
|
return;
|
||||||
@@ -1644,11 +1644,11 @@ void DynamicTextItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *
|
|||||||
}
|
}
|
||||||
else if (editor->objectName() == "group_alignment")
|
else if (editor->objectName() == "group_alignment")
|
||||||
{
|
{
|
||||||
if(QStandardItemModel *qsim = dynamic_cast<QStandardItemModel *>(model))
|
if(auto *qsim = dynamic_cast<QStandardItemModel *>(model))
|
||||||
{
|
{
|
||||||
if(QStandardItem *qsi = qsim->itemFromIndex(index))
|
if(QStandardItem *qsi = qsim->itemFromIndex(index))
|
||||||
{
|
{
|
||||||
QComboBox *cb = static_cast<QComboBox *>(editor);
|
auto *cb = static_cast<QComboBox *>(editor);
|
||||||
qsi->setData(cb->currentText(), Qt::DisplayRole);
|
qsi->setData(cb->currentText(), Qt::DisplayRole);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1671,7 +1671,7 @@ bool DynamicTextItemDelegate::eventFilter(QObject *object, QEvent *event)
|
|||||||
{
|
{
|
||||||
object->event(event);
|
object->event(event);
|
||||||
|
|
||||||
QSpinBox *sb = static_cast<QSpinBox *>(object);
|
auto *sb = static_cast<QSpinBox *>(object);
|
||||||
switch (event->type()) {
|
switch (event->type()) {
|
||||||
case QEvent::KeyPress:
|
case QEvent::KeyPress:
|
||||||
emit commitData(sb); break;
|
emit commitData(sb); break;
|
||||||
@@ -1691,7 +1691,7 @@ bool DynamicTextItemDelegate::eventFilter(QObject *object, QEvent *event)
|
|||||||
//Like the hack above, change the current index of the combobox, apply the change immediately, no need to lose focus or press enter.
|
//Like the hack above, change the current index of the combobox, apply the change immediately, no need to lose focus or press enter.
|
||||||
if((object->objectName() == "text_from" || object->objectName() == "info_text" || object->objectName() == "group_alignment") && event->type() == QEvent::FocusIn)
|
if((object->objectName() == "text_from" || object->objectName() == "info_text" || object->objectName() == "group_alignment") && event->type() == QEvent::FocusIn)
|
||||||
{
|
{
|
||||||
QComboBox *qcb = static_cast<QComboBox *>(object);
|
auto *qcb = static_cast<QComboBox *>(object);
|
||||||
connect(qcb, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [this,qcb](){emit commitData(qcb);});
|
connect(qcb, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [this,qcb](){emit commitData(qcb);});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ ElementPropertiesWidget::ElementPropertiesWidget(ElementTextItemGroup *group, QW
|
|||||||
{
|
{
|
||||||
if(group->parentItem() && group->parentItem()->type() == Element::Type)
|
if(group->parentItem() && group->parentItem()->type() == Element::Type)
|
||||||
{
|
{
|
||||||
Element *elmt = static_cast<Element *>(group->parentItem());
|
auto *elmt = static_cast<Element *>(group->parentItem());
|
||||||
m_diagram = elmt->diagram();
|
m_diagram = elmt->diagram();
|
||||||
buildGui();
|
buildGui();
|
||||||
setTextsGroup(group);
|
setTextsGroup(group);
|
||||||
@@ -133,7 +133,7 @@ void ElementPropertiesWidget::setDynamicText(DynamicElementTextItem *text)
|
|||||||
{
|
{
|
||||||
if (QString(aepew->metaObject()->className()) == "DynamicElementTextItemEditor")
|
if (QString(aepew->metaObject()->className()) == "DynamicElementTextItemEditor")
|
||||||
{
|
{
|
||||||
DynamicElementTextItemEditor *detie = static_cast<DynamicElementTextItemEditor *>(aepew);
|
auto *detie = static_cast<DynamicElementTextItemEditor *>(aepew);
|
||||||
m_tab->setCurrentWidget(detie);
|
m_tab->setCurrentWidget(detie);
|
||||||
detie->setCurrentText(text);
|
detie->setCurrentText(text);
|
||||||
}
|
}
|
||||||
@@ -156,7 +156,7 @@ void ElementPropertiesWidget::setTextsGroup(ElementTextItemGroup *group)
|
|||||||
{
|
{
|
||||||
if (QString(aepew->metaObject()->className()) == "DynamicElementTextItemEditor")
|
if (QString(aepew->metaObject()->className()) == "DynamicElementTextItemEditor")
|
||||||
{
|
{
|
||||||
DynamicElementTextItemEditor *detie = static_cast<DynamicElementTextItemEditor *>(aepew);
|
auto *detie = static_cast<DynamicElementTextItemEditor *>(aepew);
|
||||||
m_tab->setCurrentWidget(detie);
|
m_tab->setCurrentWidget(detie);
|
||||||
detie->setCurrentGroup(group);
|
detie->setCurrentGroup(group);
|
||||||
}
|
}
|
||||||
@@ -216,7 +216,7 @@ bool ElementPropertiesWidget::setLiveEdit(bool live_edit)
|
|||||||
*/
|
*/
|
||||||
void ElementPropertiesWidget::findInPanel()
|
void ElementPropertiesWidget::findInPanel()
|
||||||
{
|
{
|
||||||
CustomElement *custom_element = qobject_cast<CustomElement *>(m_element);
|
auto *custom_element = qobject_cast<CustomElement *>(m_element);
|
||||||
if (custom_element && m_diagram)
|
if (custom_element && m_diagram)
|
||||||
{
|
{
|
||||||
m_diagram->findElementRequired(custom_element->location());
|
m_diagram->findElementRequired(custom_element->location());
|
||||||
@@ -230,7 +230,7 @@ void ElementPropertiesWidget::findInPanel()
|
|||||||
*/
|
*/
|
||||||
void ElementPropertiesWidget::editElement()
|
void ElementPropertiesWidget::editElement()
|
||||||
{
|
{
|
||||||
CustomElement *custom_element = qobject_cast<CustomElement *>(m_element);
|
auto *custom_element = qobject_cast<CustomElement *>(m_element);
|
||||||
if (custom_element && m_diagram)
|
if (custom_element && m_diagram)
|
||||||
{
|
{
|
||||||
m_diagram->findElementRequired(custom_element->location());
|
m_diagram->findElementRequired(custom_element->location());
|
||||||
@@ -246,7 +246,7 @@ void ElementPropertiesWidget::editElement()
|
|||||||
void ElementPropertiesWidget::buildGui()
|
void ElementPropertiesWidget::buildGui()
|
||||||
{
|
{
|
||||||
m_tab = new QTabWidget(this);
|
m_tab = new QTabWidget(this);
|
||||||
QVBoxLayout *main_layout = new QVBoxLayout(this);
|
auto *main_layout = new QVBoxLayout(this);
|
||||||
main_layout -> addWidget(m_tab);
|
main_layout -> addWidget(m_tab);
|
||||||
setLayout(main_layout);
|
setLayout(main_layout);
|
||||||
}
|
}
|
||||||
@@ -342,8 +342,8 @@ void ElementPropertiesWidget::addGeneralWidget()
|
|||||||
*/
|
*/
|
||||||
QWidget *ElementPropertiesWidget::generalWidget()
|
QWidget *ElementPropertiesWidget::generalWidget()
|
||||||
{
|
{
|
||||||
CustomElement *custom_element = qobject_cast<CustomElement *>(m_element);
|
auto *custom_element = qobject_cast<CustomElement *>(m_element);
|
||||||
GhostElement *ghost_element = qobject_cast<GhostElement *>(m_element);
|
auto *ghost_element = qobject_cast<GhostElement *>(m_element);
|
||||||
|
|
||||||
// type de l'element
|
// type de l'element
|
||||||
QString description_string;
|
QString description_string;
|
||||||
@@ -371,7 +371,7 @@ QWidget *ElementPropertiesWidget::generalWidget()
|
|||||||
|
|
||||||
// widget himself
|
// widget himself
|
||||||
QWidget *general_widget = new QWidget (m_tab);
|
QWidget *general_widget = new QWidget (m_tab);
|
||||||
QVBoxLayout *vlayout_ = new QVBoxLayout (general_widget);
|
auto *vlayout_ = new QVBoxLayout (general_widget);
|
||||||
general_widget -> setLayout(vlayout_);
|
general_widget -> setLayout(vlayout_);
|
||||||
|
|
||||||
//widget for the text
|
//widget for the text
|
||||||
@@ -389,7 +389,7 @@ QWidget *ElementPropertiesWidget::generalWidget()
|
|||||||
connect(find_in_panel, SIGNAL(clicked()), this, SLOT(findInPanel()));
|
connect(find_in_panel, SIGNAL(clicked()), this, SLOT(findInPanel()));
|
||||||
QPushButton *edit_element = new QPushButton(QET::Icons::ElementEdit, tr("Éditer l'élément"), general_widget);
|
QPushButton *edit_element = new QPushButton(QET::Icons::ElementEdit, tr("Éditer l'élément"), general_widget);
|
||||||
connect(edit_element, SIGNAL(clicked()), this, SLOT(editElement()));
|
connect(edit_element, SIGNAL(clicked()), this, SLOT(editElement()));
|
||||||
QHBoxLayout *hlayout_ = new QHBoxLayout;
|
auto *hlayout_ = new QHBoxLayout;
|
||||||
hlayout_->addWidget(find_in_panel);
|
hlayout_->addWidget(find_in_panel);
|
||||||
hlayout_->addWidget(edit_element);
|
hlayout_->addWidget(edit_element);
|
||||||
vlayout_->addLayout(hlayout_);
|
vlayout_->addLayout(hlayout_);
|
||||||
|
|||||||
@@ -42,10 +42,10 @@ QET::Action ImportElementDialog::action() const
|
|||||||
|
|
||||||
void ImportElementDialog::setUpWidget()
|
void ImportElementDialog::setUpWidget()
|
||||||
{
|
{
|
||||||
QButtonGroup *button_group = new QButtonGroup(this);
|
auto *button_group = new QButtonGroup(this);
|
||||||
button_group->addButton(ui->m_use_actual_rd);
|
button_group->addButton(ui->m_use_actual_rd);
|
||||||
button_group->addButton(ui->m_use_drop_rb);
|
button_group->addButton(ui->m_use_drop_rb);
|
||||||
QButtonGroup *button_group_drop = new QButtonGroup(this);
|
auto *button_group_drop = new QButtonGroup(this);
|
||||||
button_group_drop->addButton(ui->m_erase_actual_rb);
|
button_group_drop->addButton(ui->m_erase_actual_rb);
|
||||||
button_group_drop->addButton(ui->m_use_both_rb);
|
button_group_drop->addButton(ui->m_use_both_rb);
|
||||||
|
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ void LinkSingleElementWidget::apply()
|
|||||||
*/
|
*/
|
||||||
QUndoCommand *LinkSingleElementWidget::associatedUndo() const
|
QUndoCommand *LinkSingleElementWidget::associatedUndo() const
|
||||||
{
|
{
|
||||||
LinkElementCommand *undo = new LinkElementCommand(m_element);
|
auto *undo = new LinkElementCommand(m_element);
|
||||||
|
|
||||||
if (m_element_to_link || m_unlink)
|
if (m_element_to_link || m_unlink)
|
||||||
{
|
{
|
||||||
@@ -257,7 +257,7 @@ void LinkSingleElementWidget::buildTree()
|
|||||||
qDebug() << "In method void LinkSingleElementWidget::updateUi(), provided element must be in a diagram";
|
qDebug() << "In method void LinkSingleElementWidget::updateUi(), provided element must be in a diagram";
|
||||||
}
|
}
|
||||||
|
|
||||||
QTreeWidgetItem *qtwi = new QTreeWidgetItem(ui->m_tree_widget, str_list);
|
auto *qtwi = new QTreeWidgetItem(ui->m_tree_widget, str_list);
|
||||||
m_qtwi_elmt_hash.insert(qtwi, elmt);
|
m_qtwi_elmt_hash.insert(qtwi, elmt);
|
||||||
m_qtwi_strl_hash.insert(qtwi, search_list);
|
m_qtwi_strl_hash.insert(qtwi, search_list);
|
||||||
}
|
}
|
||||||
@@ -311,7 +311,7 @@ void LinkSingleElementWidget::buildTree()
|
|||||||
qDebug() << "In method void LinkSingleElementWidget::updateUi(), provided element must be in a diagram";
|
qDebug() << "In method void LinkSingleElementWidget::updateUi(), provided element must be in a diagram";
|
||||||
}
|
}
|
||||||
|
|
||||||
QTreeWidgetItem *qtwi = new QTreeWidgetItem(ui->m_tree_widget, str_list);
|
auto *qtwi = new QTreeWidgetItem(ui->m_tree_widget, str_list);
|
||||||
m_qtwi_elmt_hash.insert(qtwi, elmt);
|
m_qtwi_elmt_hash.insert(qtwi, elmt);
|
||||||
m_qtwi_strl_hash.insert(qtwi, search_list);
|
m_qtwi_strl_hash.insert(qtwi, search_list);
|
||||||
}
|
}
|
||||||
@@ -381,7 +381,7 @@ void LinkSingleElementWidget::setUpCompleter()
|
|||||||
foreach(QStringList strl , m_qtwi_strl_hash.values())
|
foreach(QStringList strl , m_qtwi_strl_hash.values())
|
||||||
search.append(strl);
|
search.append(strl);
|
||||||
|
|
||||||
QCompleter *c = new QCompleter(search, ui->m_search_field);
|
auto *c = new QCompleter(search, ui->m_search_field);
|
||||||
c->setCaseSensitivity(Qt::CaseInsensitive);
|
c->setCaseSensitivity(Qt::CaseInsensitive);
|
||||||
ui->m_search_field->setCompleter(c);
|
ui->m_search_field->setCompleter(c);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ QUndoCommand* MasterPropertiesWidget::associatedUndo() const
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
LinkElementCommand *undo = new LinkElementCommand(m_element);
|
auto *undo = new LinkElementCommand(m_element);
|
||||||
|
|
||||||
if (to_link.isEmpty())
|
if (to_link.isEmpty())
|
||||||
undo->unlinkAll();
|
undo->unlinkAll();
|
||||||
@@ -239,7 +239,7 @@ void MasterPropertiesWidget::updateUi()
|
|||||||
const QList<Element *> free_list = elmt_prov.freeElement(Element::Slave);
|
const QList<Element *> free_list = elmt_prov.freeElement(Element::Slave);
|
||||||
for(Element *elmt : free_list)
|
for(Element *elmt : free_list)
|
||||||
{
|
{
|
||||||
QTreeWidgetItem *qtwi = new QTreeWidgetItem(ui->m_free_tree_widget);
|
auto *qtwi = new QTreeWidgetItem(ui->m_free_tree_widget);
|
||||||
qtwi->setIcon(0, elmt->pixmap());
|
qtwi->setIcon(0, elmt->pixmap());
|
||||||
|
|
||||||
if(settings.value("genericpanel/folio", false).toBool())
|
if(settings.value("genericpanel/folio", false).toBool())
|
||||||
@@ -267,7 +267,7 @@ void MasterPropertiesWidget::updateUi()
|
|||||||
const QList<Element *> link_list = m_element->linkedElements();
|
const QList<Element *> link_list = m_element->linkedElements();
|
||||||
for(Element *elmt : link_list)
|
for(Element *elmt : link_list)
|
||||||
{
|
{
|
||||||
QTreeWidgetItem *qtwi = new QTreeWidgetItem(ui->m_link_tree_widget);
|
auto *qtwi = new QTreeWidgetItem(ui->m_link_tree_widget);
|
||||||
qtwi->setIcon(0, elmt->pixmap());
|
qtwi->setIcon(0, elmt->pixmap());
|
||||||
|
|
||||||
if(settings.value("genericpanel/folio", false).toBool())
|
if(settings.value("genericpanel/folio", false).toBool())
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ void MultiPasteDialog::on_m_button_box_accepted()
|
|||||||
{
|
{
|
||||||
QPair <Terminal *, Terminal *> pair = elmt->AlignedFreeTerminals().takeFirst();
|
QPair <Terminal *, Terminal *> pair = elmt->AlignedFreeTerminals().takeFirst();
|
||||||
|
|
||||||
Conductor *conductor = new Conductor(pair.first, pair.second);
|
auto *conductor = new Conductor(pair.first, pair.second);
|
||||||
m_diagram->undoStack().push(new AddItemCommand<Conductor *>(conductor, m_diagram, QPointF()));
|
m_diagram->undoStack().push(new AddItemCommand<Conductor *>(conductor, m_diagram, QPointF()));
|
||||||
|
|
||||||
//Autonum the new conductor, the undo command associated for this, have for parent undo_object
|
//Autonum the new conductor, the undo command associated for this, have for parent undo_object
|
||||||
|
|||||||
@@ -240,8 +240,8 @@ void PotentialSelectorDialog::buildWidget()
|
|||||||
if(!cp2.m_tension_protocol.isEmpty())
|
if(!cp2.m_tension_protocol.isEmpty())
|
||||||
text2.append(tr("\nTension/protocole : %1").arg(cp2.m_tension_protocol));
|
text2.append(tr("\nTension/protocole : %1").arg(cp2.m_tension_protocol));
|
||||||
|
|
||||||
QRadioButton *rb1 = new QRadioButton(text1, this);
|
auto *rb1 = new QRadioButton(text1, this);
|
||||||
QRadioButton *rb2 = new QRadioButton(text2, this);
|
auto *rb2 = new QRadioButton(text2, this);
|
||||||
|
|
||||||
connect(rb1, &QRadioButton::toggled, [this](bool t)
|
connect(rb1, &QRadioButton::toggled, [this](bool t)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,8 +28,8 @@
|
|||||||
* @param parent : parent widget of this dialog
|
* @param parent : parent widget of this dialog
|
||||||
*/
|
*/
|
||||||
ProjectPropertiesDialog::ProjectPropertiesDialog(QETProject *project, QWidget *parent) {
|
ProjectPropertiesDialog::ProjectPropertiesDialog(QETProject *project, QWidget *parent) {
|
||||||
NewDiagramPage *newDiagramPage = new NewDiagramPage(project,parent,this);
|
auto *newDiagramPage = new NewDiagramPage(project,parent,this);
|
||||||
ProjectAutoNumConfigPage *projectAutoNumConfigPage = new ProjectAutoNumConfigPage (project);
|
auto *projectAutoNumConfigPage = new ProjectAutoNumConfigPage (project);
|
||||||
m_properties_dialog = new ConfigDialog (parent);
|
m_properties_dialog = new ConfigDialog (parent);
|
||||||
m_properties_dialog -> setWindowTitle(QObject::tr("Propriétés du projet", "window title"));
|
m_properties_dialog -> setWindowTitle(QObject::tr("Propriétés du projet", "window title"));
|
||||||
m_properties_dialog -> addPage(new ProjectMainConfigPage (project));
|
m_properties_dialog -> addPage(new ProjectMainConfigPage (project));
|
||||||
@@ -72,6 +72,6 @@ void ProjectPropertiesDialog::setCurrentPage(ProjectPropertiesDialog::Page p) {
|
|||||||
* Change the current displayed tab to folio tab.
|
* Change the current displayed tab to folio tab.
|
||||||
*/
|
*/
|
||||||
void ProjectPropertiesDialog::changeToFolio() {
|
void ProjectPropertiesDialog::changeToFolio() {
|
||||||
ProjectAutoNumConfigPage *autoNumPage = static_cast <ProjectAutoNumConfigPage*>(m_properties_dialog->pages.at(2));
|
auto *autoNumPage = static_cast <ProjectAutoNumConfigPage*>(m_properties_dialog->pages.at(2));
|
||||||
autoNumPage->changeToTab(3);
|
autoNumPage->changeToTab(3);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -349,7 +349,7 @@ bool AlignmentTextsGroupCommand::mergeWith(const QUndoCommand *other)
|
|||||||
if (id() != other->id() || other->childCount())
|
if (id() != other->id() || other->childCount())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
AlignmentTextsGroupCommand const *undo = static_cast<const AlignmentTextsGroupCommand *>(other);
|
auto const *undo = static_cast<const AlignmentTextsGroupCommand *>(other);
|
||||||
if (m_group != undo->m_group)
|
if (m_group != undo->m_group)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ ChangeElementInformationCommand::ChangeElementInformationCommand(Element *elmt,
|
|||||||
bool ChangeElementInformationCommand::mergeWith(const QUndoCommand *other)
|
bool ChangeElementInformationCommand::mergeWith(const QUndoCommand *other)
|
||||||
{
|
{
|
||||||
if (id() != other->id()) return false;
|
if (id() != other->id()) return false;
|
||||||
ChangeElementInformationCommand const *undo = static_cast<const ChangeElementInformationCommand*>(other);
|
auto const *undo = static_cast<const ChangeElementInformationCommand*>(other);
|
||||||
if (m_element != undo->m_element) return false;
|
if (m_element != undo->m_element) return false;
|
||||||
m_new_info = undo->m_new_info;
|
m_new_info = undo->m_new_info;
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ LinkElementCommand::LinkElementCommand(Element *element_, QUndoCommand *parent):
|
|||||||
bool LinkElementCommand::mergeWith(const QUndoCommand *other)
|
bool LinkElementCommand::mergeWith(const QUndoCommand *other)
|
||||||
{
|
{
|
||||||
if (id() != other->id() || other->childCount()) return false;
|
if (id() != other->id() || other->childCount()) return false;
|
||||||
LinkElementCommand const *undo = static_cast<const LinkElementCommand *> (other);
|
auto const *undo = static_cast<const LinkElementCommand *> (other);
|
||||||
if (m_element != undo->m_element) return false;
|
if (m_element != undo->m_element) return false;
|
||||||
m_linked_after = undo->m_linked_after;
|
m_linked_after = undo->m_linked_after;
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ m_diagram(diagram)
|
|||||||
break;
|
break;
|
||||||
case QGraphicsItemGroup::Type:
|
case QGraphicsItemGroup::Type:
|
||||||
{
|
{
|
||||||
if(ElementTextItemGroup *grp = dynamic_cast<ElementTextItemGroup *>(item))
|
if(auto *grp = dynamic_cast<ElementTextItemGroup *>(item))
|
||||||
if(grp->parentElement() && !grp->parentElement()->isSelected())
|
if(grp->parentElement() && !grp->parentElement()->isSelected())
|
||||||
m_undo << new QPropertyUndoCommand(grp, "rotation", QVariant(item->rotation()), QVariant(item->rotation()+angle), this);
|
m_undo << new QPropertyUndoCommand(grp, "rotation", QVariant(item->rotation()), QVariant(item->rotation()+angle), this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ m_diagram(diagram)
|
|||||||
texts_list << dti;
|
texts_list << dti;
|
||||||
if(dti->type() == ConductorTextItem::Type)
|
if(dti->type() == ConductorTextItem::Type)
|
||||||
{
|
{
|
||||||
ConductorTextItem *cti = static_cast<ConductorTextItem *>(dti);
|
auto *cti = static_cast<ConductorTextItem *>(dti);
|
||||||
m_cond_texts.insert(cti, cti->wasRotateByUser());
|
m_cond_texts.insert(cti, cti->wasRotateByUser());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -143,7 +143,7 @@ void RotateTextsCommand::setupAnimation(QObject *target, const QByteArray &prope
|
|||||||
if(m_anim_group == nullptr)
|
if(m_anim_group == nullptr)
|
||||||
m_anim_group = new QParallelAnimationGroup();
|
m_anim_group = new QParallelAnimationGroup();
|
||||||
|
|
||||||
QPropertyAnimation *animation = new QPropertyAnimation(target, propertyName);
|
auto *animation = new QPropertyAnimation(target, propertyName);
|
||||||
animation->setDuration(300);
|
animation->setDuration(300);
|
||||||
animation->setStartValue(start);
|
animation->setStartValue(start);
|
||||||
animation->setEndValue(end);
|
animation->setEndValue(end);
|
||||||
|
|||||||
Reference in New Issue
Block a user