[qet] [2327] Update to import image |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 2327
Author: scorpio810
Date: 2013-06-23 15:04:31 +0200 (Sun, 23 Jun 2013)
Log Message:
-----------
Update to import image
Modified Paths:
--------------
branches/0.4/sources/diagramview.cpp
branches/0.4/sources/qetdiagrameditor.cpp
branches/0.4/sources/qetdiagrameditor.h
branches/0.4/sources/qeticons.cpp
branches/0.4/sources/qeticons.h
Modified: branches/0.4/sources/diagramview.cpp
===================================================================
--- branches/0.4/sources/diagramview.cpp 2013-06-23 12:04:07 UTC (rev 2326)
+++ branches/0.4/sources/diagramview.cpp 2013-06-23 13:04:31 UTC (rev 2327)
@@ -1209,12 +1209,11 @@
if (scene -> isReadOnly()) return;
is_adding_text = true;
//Debug CYRIL
- is_adding_image = true;
+ is_adding_image = false;
}
-/**
- To edit the text through the htmlEditor
+/** To edit the text through the htmlEditor
*/
void DiagramView::editText() {
if (scene -> isReadOnly()) return;
@@ -1239,9 +1238,10 @@
*/
void DiagramView::addImage() {
if (scene -> isReadOnly()) return;
+ is_adding_image = true;
QString pathPictures = QDesktopServices::storageLocation ( QDesktopServices::PicturesLocation );
- QString fileName = QFileDialog::getOpenFileName(this, tr("Selectionner une image..."), pathPictures.toStdString().c_str(), tr("Image Files (*.png *.jpg *.bmp)"));
+ QString fileName = QFileDialog::getOpenFileName(this, tr("Selectionner une image..."), pathPictures.toStdString().c_str(), tr("Image Files (*.png *.jpg *.bmp *.svg)"));
if(fileName.isEmpty())return;
int ret = image_to_add_.load(fileName);
@@ -1258,13 +1258,13 @@
IndependentTextItem *DiagramView::addDiagramImageAtPos(const QPointF &pos) {
if (!isInteractive() || scene -> isReadOnly()) return(0);
-
addImage();
QGraphicsPixmapItem *pixItem = new QGraphicsPixmapItem( QPixmap::fromImage(image_to_add_) );
pixItem->setFlag(QGraphicsItem::ItemIsMovable,true);
pixItem->setFlag(QGraphicsItem::ItemIsSelectable,true);
pixItem->setCursor(Qt::PointingHandCursor);
- scene ->addItem( pixItem );
+ scene ->addItem(pixItem);
+
}
/**
@@ -1285,7 +1285,7 @@
// emet le signal textAdded
emit(textAdded(false));
-
+
return(iti);
}
Modified: branches/0.4/sources/qetdiagrameditor.cpp
===================================================================
--- branches/0.4/sources/qetdiagrameditor.cpp 2013-06-23 12:04:07 UTC (rev 2326)
+++ branches/0.4/sources/qetdiagrameditor.cpp 2013-06-23 13:04:31 UTC (rev 2327)
@@ -216,6 +216,7 @@
add_text = new QAction(QET::Icons::PartTextField, tr("Ajouter un champ de texte"), this);
add_edittext = new QAction(QET::Icons::EditText, tr("\311diter le champ de texte"), this);
add_column = new QAction(QET::Icons::EditTableInsertColumnRight, tr("Ajouter une colonne"), this);
+ adding_image = new QAction(QET::Icons::adding_image, tr("Ajouter une image"), this);
remove_column = new QAction(QET::Icons::EditTableDeleteColumn, tr("Enlever une colonne"), this);
add_row = new QAction(QET::Icons::EditTableInsertRowUnder, tr("Ajouter une ligne"), this);
remove_row = new QAction(QET::Icons::EditTableDeleteRow, tr("Enlever une ligne"), this);
@@ -399,6 +400,7 @@
connect(infos_diagram, SIGNAL(triggered()), this, SLOT(editCurrentDiagramProperties()));
connect(add_text, SIGNAL(triggered()), this, SLOT(slot_addText()) );
connect(add_edittext, SIGNAL(triggered()), this, SLOT(slot_editText()) );
+ connect(adding_image, SIGNAL(triggered()), this, SLOT(slot_addImage()) );
connect(add_column, SIGNAL(triggered()), this, SLOT(slot_addColumn()) );
connect(remove_column, SIGNAL(triggered()), this, SLOT(slot_removeColumn()) );
connect(add_row, SIGNAL(triggered()), this, SLOT(slot_addRow()) );
@@ -514,7 +516,7 @@
menu_affichage -> addAction(zoom_content);
menu_affichage -> addAction(zoom_fit);
menu_affichage -> addAction(zoom_reset);
-
+
// menu Fenetres
slot_updateWindowsMenu();
}
@@ -562,6 +564,7 @@
diagram_bar -> addAction(infos_diagram);
diagram_bar -> addAction(conductor_reset);
diagram_bar -> addAction(add_text);
+ diagram_bar -> addAction(adding_image);
// ajout de la barre d'outils a la fenetre principale
addToolBar(Qt::TopToolBarArea, main_bar);
@@ -1150,6 +1153,7 @@
remove_column -> setEnabled(editable_diagram);
add_row -> setEnabled(editable_diagram);
remove_row -> setEnabled(editable_diagram);
+ adding_image ->setEnabled(editable_diagram);
//display the beta feature only in debug mode
#ifdef QT_NO_DEBUG
@@ -1486,8 +1490,15 @@
dv -> addText();
}
}
-
/**
+ Ajoute une image au schema courant
+*/
+void QETDiagramEditor::slot_addImage() {
+ if (DiagramView *dv = currentDiagram()) {
+ dv -> addImage();
+ }
+}
+/**
to Edit en text through the html editor
*/
void QETDiagramEditor::slot_editText() {
@@ -1754,6 +1765,7 @@
connect(dv, SIGNAL(modeChanged()), this, SLOT(slot_updateModeActions()));
connect(dv, SIGNAL(textAdded(bool)), add_text, SLOT(setChecked(bool)));
connect(dv, SIGNAL(textAdded(bool)), add_edittext, SLOT(setChecked(bool)));
+ connect(dv, SIGNAL(adding_image(bool)), adding_image, SLOT(setChecked(bool)));
}
/**
Modified: branches/0.4/sources/qetdiagrameditor.h
===================================================================
--- branches/0.4/sources/qetdiagrameditor.h 2013-06-23 12:04:07 UTC (rev 2326)
+++ branches/0.4/sources/qetdiagrameditor.h 2013-06-23 13:04:31 UTC (rev 2327)
@@ -124,6 +124,7 @@
void slot_resetConductors();
void slot_addText();
void slot_editText();
+ void slot_addImage();
void setWindowedMode();
void setTabbedMode();
void readSettings();
@@ -215,7 +216,7 @@
QAction *cascade_window; ///< Show MDI subwindows as cascade
QAction *prev_window; ///< Switch to the previous document
QAction *next_window; ///< Switch to the next document
-
+ QAction *adding_image; ///< Tool to add an independent image item on diagrams
private:
QMdiArea workspace;
QSignalMapper windowMapper;
Modified: branches/0.4/sources/qeticons.cpp
===================================================================
--- branches/0.4/sources/qeticons.cpp 2013-06-23 12:04:07 UTC (rev 2326)
+++ branches/0.4/sources/qeticons.cpp 2013-06-23 13:04:31 UTC (rev 2327)
@@ -152,6 +152,7 @@
QIcon ZoomIn;
QIcon ZoomOriginal;
QIcon ZoomOut;
+ QIcon adding_image;
}
}
@@ -221,6 +222,7 @@
EditClear .addFile(":/ico/16x16/edit-clear.png");
EditClear .addFile(":/ico/22x22/edit-clear.png");
EditText .addFile(":/ico/22x22/names.png");
+ adding_image .addFile(":/ico/22x22/insert-image.png");
if (rtl) {
EditClearLocationBar.addPixmap(QPixmap(":/ico/16x16/edit-clear-locationbar-ltr.png").transformed(reverse));
Modified: branches/0.4/sources/qeticons.h
===================================================================
--- branches/0.4/sources/qeticons.h 2013-06-23 12:04:07 UTC (rev 2326)
+++ branches/0.4/sources/qeticons.h 2013-06-23 13:04:31 UTC (rev 2327)
@@ -161,6 +161,7 @@
extern QIcon ZoomIn;
extern QIcon ZoomOriginal;
extern QIcon ZoomOut;
+ extern QIcon adding_image;
}
}
#endif