[Kst] branches/work/kst/portto4/kst/src/libkstapp
Adam Treat
treat at kde.org
Wed Jun 6 19:31:26 CEST 2007
SVN commit 672300 by treat:
* Add an svg item
M +1 -0 CMakeLists.txt
M +12 -0 mainwindow.cpp
M +2 -0 mainwindow.h
M +7 -8 pictureitem.cpp
M +1 -1 pictureitem.h
A svgitem.cpp [License: GPL (v2+)]
A svgitem.h [License: GPL (v2+)]
--- branches/work/kst/portto4/kst/src/libkstapp/CMakeLists.txt #672299:672300
@@ -21,6 +21,7 @@
pictureitem.cpp
plotitem.cpp
sessionmodel.cpp
+ svgitem.cpp
tabwidget.cpp
vectoreditordialog.cpp
vectormodel.cpp
--- branches/work/kst/portto4/kst/src/libkstapp/mainwindow.cpp #672299:672300
@@ -24,6 +24,7 @@
#include "memorywidget.h"
#include "pictureitem.h"
#include "plotitem.h"
+#include "svgitem.h"
#include "tabwidget.h"
#include "vectoreditordialog.h"
#include "view.h"
@@ -230,6 +231,12 @@
}
+void MainWindow::createSvg() {
+ CreateSvgCommand *cmd = new CreateSvgCommand;
+ cmd->createItem();
+}
+
+
void MainWindow::createBox() {
CreateBoxCommand *cmd = new CreateBoxCommand;
cmd->createItem();
@@ -300,6 +307,10 @@
_createPictureAct->setStatusTip(tr("Create a picture for the current view"));
connect(_createPictureAct, SIGNAL(triggered()), this, SLOT(createPicture()));
+ _createSvgAct = new QAction(tr("&Create svg"), this);
+ _createSvgAct->setStatusTip(tr("Create a svg for the current view"));
+ connect(_createSvgAct, SIGNAL(triggered()), this, SLOT(createSvg()));
+
_createEllipseAct = new QAction(tr("&Create ellipse"), this);
_createEllipseAct->setStatusTip(tr("Create an ellipse for the current view"));
connect(_createEllipseAct, SIGNAL(triggered()), this, SLOT(createEllipse()));
@@ -396,6 +407,7 @@
_plotMenu->addAction(_createLineAct);
_plotMenu->addAction(_createPictureAct);
_plotMenu->addAction(_createPlotAct);
+ _plotMenu->addAction(_createSvgAct);
_settingsMenu = menuBar()->addMenu(tr("&Settings"));
--- branches/work/kst/portto4/kst/src/libkstapp/mainwindow.h #672299:672300
@@ -63,6 +63,7 @@
void createEllipse();
void createLine();
void createPicture();
+ void createSvg();
void createPlot();
void demoModel();
@@ -116,6 +117,7 @@
QAction *_createLineAct;
QAction *_createPictureAct;
QAction *_createPlotAct;
+ QAction *_createSvgAct;
QAction *_newTabAct;
QAction *_saveAct;
--- branches/work/kst/portto4/kst/src/libkstapp/pictureitem.cpp #672299:672300
@@ -18,8 +18,8 @@
namespace Kst {
-PictureItem::PictureItem(View *parent, const QImage& im)
- : ViewItem(parent), _image(QPixmap::fromImage(im)) {
+PictureItem::PictureItem(View *parent, const QImage &image)
+ : ViewItem(parent), _image(QPixmap::fromImage(image)) {
setFlags(ItemIsMovable | ItemIsSelectable | ItemIsFocusable);
}
@@ -73,12 +73,11 @@
}
void CreatePictureCommand::createItem() {
- QString fn = QFileDialog::getOpenFileName(_view, tr("Kst: Open Image"));
- QImage im;
- if (!fn.isEmpty()) {
- im = QImage(fn);
- }
- _item = new PictureItem(_view, im);
+ QString file = QFileDialog::getOpenFileName(_view, tr("Kst: Open Image"));
+ if (file.isEmpty())
+ return;
+
+ _item = new PictureItem(_view, QImage(file));
_view->setMouseMode(View::Create);
_view->setCursor(Qt::CrossCursor);
--- branches/work/kst/portto4/kst/src/libkstapp/pictureitem.h #672299:672300
@@ -21,7 +21,7 @@
{
Q_OBJECT
public:
- PictureItem(View *parent, const QImage& im);
+ PictureItem(View *parent, const QImage &image);
~PictureItem();
QGraphicsItem *graphicsItem() { return this; }
More information about the Kst
mailing list