19 #include "ui_masterpropertieswidget.h" 20 #include <QListWidgetItem> 40 ui->m_free_tree_widget->setContextMenuPolicy(Qt::CustomContextMenu);
41 ui->m_link_tree_widget->setContextMenuPolicy(Qt::CustomContextMenu);
45 if (settings.value(
"genericpanel/folio",
false).toBool()) {
46 list <<
tr(
"Vignette") <<
tr(
"Label de folio") <<
tr(
"Titre de folio") <<
tr(
"Position");
49 list <<
tr(
"Vignette") <<
tr(
"N° de folio") <<
tr(
"Titre de folio") <<
tr(
"Position");
51 ui->m_free_tree_widget->setHeaderLabels(list);
52 ui->m_link_tree_widget->setHeaderLabels(list);
64 connect(
ui->m_free_tree_widget, &QTreeWidget::customContextMenuRequested, [
this](QPoint point) {this->customContextMenu(point, 1);});
65 connect(
ui->m_link_tree_widget, &QTreeWidget::customContextMenuRequested, [
this](QPoint point) {this->customContextMenu(point, 2);});
79 QHeaderView *qhv =
ui->m_free_tree_widget->header();
80 qhv->setContextMenuPolicy(Qt::CustomContextMenu);
84 QByteArray qba = qhv->saveState();
86 settings.setValue(
"link-element-widget/master-state", qba);
155 m_element -> diagram() -> undoStack().push(undo);
164 foreach (QTreeWidgetItem *qtwi,
m_qtwi_hash.keys())
180 QList <Element *> to_link;
181 QList <Element *> linked_ =
m_element->linkedElements();
183 for (
int i=0; i<
ui->m_link_tree_widget->topLevelItemCount(); i++)
184 to_link <<
m_qtwi_hash[
ui->m_link_tree_widget->topLevelItem(i)];
187 if (to_link.size() == linked_.size())
191 foreach(
Element *elmt, to_link)
192 if (!linked_.contains(elmt))
201 if (to_link.isEmpty())
227 ui->m_free_tree_widget->clear();
228 ui->m_link_tree_widget->clear();
238 QList <QTreeWidgetItem *> items_list;
242 QTreeWidgetItem *qtwi =
new QTreeWidgetItem(
ui->m_free_tree_widget);
243 qtwi->setIcon(0, elmt->pixmap());
245 if(settings.value(
"genericpanel/folio",
false).toBool())
253 qtwi->setText(1, QString::number(elmt->diagram()->folioIndex() + 1));
257 qtwi->setText(2, elmt->diagram()->title());
258 qtwi->setText(4, elmt->diagram()->convertPosition(elmt->scenePos()).toString());
259 items_list.append(qtwi);
263 ui->m_free_tree_widget->addTopLevelItems(items_list);
267 const QList<Element *> link_list =
m_element->linkedElements();
270 QTreeWidgetItem *qtwi =
new QTreeWidgetItem(
ui->m_link_tree_widget);
271 qtwi->setIcon(0, elmt->pixmap());
273 if(settings.value(
"genericpanel/folio",
false).toBool())
281 qtwi->setText(1, QString::number(elmt->diagram()->folioIndex() + 1));
284 qtwi->setText(2, elmt->diagram()->title());
285 qtwi->setText(3, elmt->diagram()->convertPosition(elmt->scenePos()).toString());
286 items_list.append(qtwi);
290 if(items_list.count())
291 ui->m_link_tree_widget->addTopLevelItems(items_list);
293 QVariant v = settings.value(
"link-element-widget/master-state");
296 ui->m_free_tree_widget->header()->restoreState(v.toByteArray());
297 ui->m_link_tree_widget->header()->restoreState(v.toByteArray());
315 QTreeWidgetItem *qtwi =
ui->m_free_tree_widget->currentItem();
318 ui->m_free_tree_widget->takeTopLevelItem(
ui->m_free_tree_widget->indexOfTopLevelItem(qtwi));
319 ui->m_link_tree_widget->insertTopLevelItem(0, qtwi);
333 QTreeWidgetItem *qtwi =
ui->m_link_tree_widget->currentItem();
336 ui->m_link_tree_widget->takeTopLevelItem(
ui->m_link_tree_widget->indexOfTopLevelItem(qtwi));
337 ui->m_free_tree_widget->insertTopLevelItem(0, qtwi);
384 QTimer::singleShot(10,
this, SLOT(
updateUi()));
398 point.ry()+=
ui->m_free_tree_widget->header()->height();
404 point =
ui->m_free_tree_widget->mapToGlobal(point);
407 if (
ui->m_free_tree_widget->currentItem())
416 point =
ui->m_link_tree_widget->mapToGlobal(point);
419 if (
ui->m_link_tree_widget->currentItem())
static QString formulaToLabel(QString formula, sequentialNumbers &seqStruct, Diagram *diagram, const Element *elmt=nullptr)
AssignVariables::formulaToLabel Return the with variable assigned (ready to be displayed) ...
Diagram * diagram() const
QetGraphicsItem::diagram return the diagram of this item.
void linkedElementChanged()
void unlinkAll()
LinkElementCommand::unlinkAll Unlink all element of the edited element.
The LinkElementCommand class This undo class manage link between elements. In the same instance of th...
QList< Element * > freeElement(const int filter) const
ElementProvider::FreeElement Search and return the asked element corresponding with the given filter ...
void setLink(const QList< Element *> &element_list)
LinkElementCommand::setLink Replace all linked elements of edited element by elements stored in This...
QETProject * project() const