mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-24 03:10:52 +01:00
Use PropertiesEditorWidget instead of QWidget for some widget (widget used to edit propertie of element)
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3932 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
* the parent widget
|
||||
*/
|
||||
LinkSingleElementWidget::LinkSingleElementWidget(Element *elmt, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
PropertiesEditorWidget(parent),
|
||||
ui(new Ui::LinkSingleElementWidget),
|
||||
element_(elmt),
|
||||
esw_(0),
|
||||
@@ -67,10 +67,32 @@ LinkSingleElementWidget::~LinkSingleElementWidget()
|
||||
* Apply the new property of the edited element
|
||||
*/
|
||||
void LinkSingleElementWidget::apply() {
|
||||
QUndoCommand *undo = associatedUndo();
|
||||
if (undo)
|
||||
element_->diagram()->undoStack().push(undo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief LinkSingleElementWidget::associatedUndo
|
||||
* @return the undo command associated to the current edition
|
||||
* if there isn't change, return nulptr
|
||||
*/
|
||||
QUndoCommand *LinkSingleElementWidget::associatedUndo() const
|
||||
{
|
||||
if (esw_->selectedElement())
|
||||
element_->diagram()->undoStack().push(new LinkElementsCommand(element_, esw_->selectedElement()));
|
||||
return new LinkElementsCommand(element_, esw_->selectedElement());
|
||||
else if (unlink_)
|
||||
element_->diagram()->undoStack().push(new unlinkElementsCommand(element_));
|
||||
return new unlinkElementsCommand(element_);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QString LinkSingleElementWidget::title() const
|
||||
{
|
||||
if (element_->linkType() == Element::AllReport)
|
||||
return tr("Report de folio");
|
||||
else
|
||||
return tr("Référence croisée (esclave)");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user