mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-04-17 23:29:58 +02:00
Refactor some properties dialog.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4027 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -17,7 +17,8 @@
|
||||
*/
|
||||
#include "diagramimageitem.h"
|
||||
#include "diagram.h"
|
||||
#include "imagepropertiesdialog.h"
|
||||
#include "PropertiesEditor/propertieseditordialog.h"
|
||||
#include "imagepropertieswidget.h"
|
||||
|
||||
/**
|
||||
* @brief DiagramImageItem::DiagramImageItem
|
||||
@@ -85,7 +86,7 @@ void DiagramImageItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *
|
||||
void DiagramImageItem::editProperty()
|
||||
{
|
||||
if (diagram() -> isReadOnly()) return;
|
||||
ImagePropertiesDialog dialog(this, QApplication::activeWindow());
|
||||
PropertiesEditorDialog dialog(new ImagePropertiesWidget(this), QApplication::activeWindow());
|
||||
dialog.exec();
|
||||
}
|
||||
|
||||
|
||||
@@ -22,10 +22,11 @@
|
||||
#include "elementtextitem.h"
|
||||
#include "diagramcommands.h"
|
||||
#include <QtDebug>
|
||||
#include <elementpropertiesdialog.h>
|
||||
#include "elementprovider.h"
|
||||
#include "diagramposition.h"
|
||||
#include "terminal.h"
|
||||
#include "PropertiesEditor/propertieseditordialog.h"
|
||||
#include "elementpropertieswidget.h"
|
||||
|
||||
/**
|
||||
Constructeur pour un element sans scene ni parent
|
||||
@@ -48,14 +49,15 @@ Element::Element(QGraphicsItem *parent) :
|
||||
Element::~Element() {
|
||||
}
|
||||
|
||||
void Element::editProperty() {
|
||||
if (diagram())
|
||||
if(!diagram()->isReadOnly()){
|
||||
ElementPropertiesDialog epw (this, diagram()->views().first());
|
||||
connect(&epw, SIGNAL(editElementRequired(ElementsLocation)), diagram(), SIGNAL(editElementRequired(ElementsLocation)));
|
||||
connect(&epw, SIGNAL(findElementRequired(ElementsLocation)), diagram(), SIGNAL(findElementRequired(ElementsLocation)));
|
||||
epw.exec();
|
||||
}
|
||||
void Element::editProperty()
|
||||
{
|
||||
if (diagram() && !diagram()->isReadOnly())
|
||||
{
|
||||
ElementPropertiesWidget *epw = new ElementPropertiesWidget(this);
|
||||
PropertiesEditorDialog dialog(epw, QApplication::activeWindow());
|
||||
connect(epw, &ElementPropertiesWidget::findEditClicked, &dialog, &QDialog::reject);
|
||||
dialog.exec();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "diagram.h"
|
||||
#include "qet.h"
|
||||
#include "shapegraphicsitempropertieswidget.h"
|
||||
#include "PropertiesEditor/propertieseditordialog.h"
|
||||
|
||||
|
||||
/**
|
||||
@@ -359,24 +360,8 @@ void QetShapeItem::editProperty()
|
||||
{
|
||||
if (diagram() -> isReadOnly()) return;
|
||||
|
||||
//the dialog
|
||||
QDialog property_dialog(diagram()->views().at(0));
|
||||
property_dialog.setWindowTitle(tr("Éditer les propriétés d'une shape, Zone ", "window title"));
|
||||
//the main layout
|
||||
QVBoxLayout dialog_layout(&property_dialog);
|
||||
ShapeGraphicsItemPropertiesWidget *sgipw = new ShapeGraphicsItemPropertiesWidget(this, &property_dialog);
|
||||
dialog_layout.addWidget(sgipw);
|
||||
|
||||
//dialog button, box
|
||||
QDialogButtonBox dbb(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||
dialog_layout.addWidget(&dbb);
|
||||
connect(&dbb, SIGNAL(accepted()), &property_dialog, SLOT(accept()));
|
||||
connect(&dbb, SIGNAL(rejected()), &property_dialog, SLOT(reject()));
|
||||
|
||||
if (property_dialog.exec() == QDialog::Accepted)
|
||||
sgipw->apply();
|
||||
else
|
||||
sgipw->reset();
|
||||
PropertiesEditorDialog ped(new ShapeGraphicsItemPropertiesWidget(this), diagram()->views().at(0));
|
||||
ped.exec();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user