30 #include <QVBoxLayout> 42 m_diagram (elmt->diagram()),
44 m_general_widget(nullptr)
61 m_general_widget(nullptr)
82 m_general_widget(nullptr)
84 if(group->parentItem() && group->parentItem()->type() ==
Element::Type)
104 if (previous_element)
133 if (QString(aepew->metaObject()->className()) ==
"DynamicElementTextItemEditor")
136 m_tab->setCurrentWidget(detie);
151 if(group->parentItem() && group->parentItem()->type() ==
Element::Type)
153 setElement(static_cast<Element *>(group->parentItem()));
156 if (QString(aepew->metaObject()->className()) ==
"DynamicElementTextItemEditor")
159 m_tab->setCurrentWidget(detie);
173 QList <QUndoCommand *> undo_list;
179 if (undo_list.isEmpty())
return;
182 foreach(QUndoCommand *uc, undo_list) str += uc->text() +=
" ";
184 QUndoStack &stack =
m_element -> diagram() -> undoStack();
185 stack.beginMacro(str);
186 foreach(QUndoCommand *uc, undo_list) stack.push(uc);
245 m_tab =
new QTabWidget(
this);
246 QVBoxLayout *main_layout =
new QVBoxLayout(
this);
247 main_layout -> addWidget(
m_tab);
248 setLayout(main_layout);
260 tab_text =
m_tab->tabText(
m_tab->currentIndex());
301 m_tab->addTab(aepew, aepew->title());
306 if (!tab_text.isEmpty())
308 for(
int i=0 ; i<
m_tab->count() ; ++i)
310 if (tab_text ==
m_tab->tabBar()->tabText(i))
312 m_tab->setCurrentIndex(i);
325 int index =
m_tab->currentIndex();
333 m_tab->setCurrentIndex(index);
342 QString description_string(
tr(
"Élement\n"));
345 description_string += QString(
tr(
"Nom : %1\n")).arg(
m_element -> name());
346 int folio_index =
m_diagram -> folioIndex();
347 if (folio_index != -1) {
348 description_string += QString(
tr(
"Folio : %1\n")).arg(folio_index + 1);
350 description_string += QString(
tr(
"Position : %1\n")).arg(
m_diagram -> convertPosition(
m_element -> scenePos()).toString());
351 description_string += QString(
tr(
"Rotation : %1°\n")).arg(
m_element.data()->rotation());
352 description_string += QString(
tr(
"Dimensions : %1*%2\n")).arg(
m_element -> size().width()).arg(
m_element -> size().height());
353 description_string += QString(
tr(
"Bornes : %1\n")).arg(
m_element -> terminals().count());
354 description_string += QString(
tr(
"Emplacement : %1\n")).arg(
m_element.data()->location().toString());
357 QWidget *general_widget =
new QWidget (
m_tab);
358 QVBoxLayout *vlayout_ =
new QVBoxLayout (general_widget);
359 general_widget -> setLayout(vlayout_);
362 QLabel *label =
new QLabel (description_string, general_widget);
363 label->setWordWrap(
true);
364 vlayout_->addWidget(label);
367 QLabel *pix =
new QLabel(general_widget);
368 vlayout_->addWidget(pix, 0, Qt::AlignHCenter);
369 vlayout_ -> addStretch();
372 QPushButton *find_in_panel =
new QPushButton(
QET::Icons::ZoomDraw,
tr(
"Retrouver dans le panel"), general_widget);
373 connect(find_in_panel, SIGNAL(clicked()),
this, SLOT(
findInPanel()));
375 connect(edit_element, SIGNAL(clicked()),
this, SLOT(
editElement()));
376 QHBoxLayout *hlayout_ =
new QHBoxLayout;
377 hlayout_->addWidget(find_in_panel);
378 hlayout_->addWidget(edit_element);
379 vlayout_->addLayout(hlayout_);
383 int margin = vlayout_->contentsMargins().left() + vlayout_->contentsMargins().right();
384 int widht_ = vlayout_->minimumSize().width()-margin;
386 if (pixmap.size().width() > widht_ || pixmap.size().height() > widht_) {
387 pix->setPixmap(
m_element->pixmap().scaled (widht_, widht_, Qt::KeepAspectRatio, Qt::SmoothTransformation));
390 pix->setPixmap(pixmap);
393 return general_widget;
virtual kind linkType() const
The DynamicElementTextItem class This class provide a simple text field of element who can be added o...
Diagram * diagram() const
QetGraphicsItem::diagram return the diagram of this item.
void editElementRequired(const ElementsLocation &)
Signal emitted when users wish to locate an element from the diagram within elements collection...
void setCurrentGroup(ElementTextItemGroup *group)
DynamicElementTextItemEditor::setCurrentGroup Expand and select the item for group ...
Element * parentElement() const
DynamicElementTextItem::ParentElement.
The ElementTextItemGroup class This class represent a group of element text Texts in the group can be...
void setCurrentText(DynamicElementTextItem *text)
DynamicElementTextItemEditor::setCurrentText Expand and select the item for text .
void findElementRequired(const ElementsLocation &)