ImageWidget.h
Go to the documentation of this file.
/***************************************************************************
File : ImageWidget.h
Project : QtiPlot
--------------------------------------------------------------------
Copyright : (C) 2008 - 2010 by Ion Vasilief
Email (use @ for *) : ion_vasilief*yahoo.fr
Description : A widget displaying images in 2D plots
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301 USA *
* *
***************************************************************************/
#ifndef IMAGEWIDGET_H
#define IMAGEWIDGET_H
#include <QWidget>
#include "FrameWidget.h"
class ApplicationWindow;
class ImageWidget: public FrameWidget
{
Q_OBJECT
public:
ImageWidget(Graph *, const QString& fn = QString::null);
ImageWidget(Graph *, const QImage& image);
QPixmap pixmap() const {return d_pix;};
void setPixmap(const QPixmap&);
bool load(const QString& fn, bool update = true);
QString fileName(){return d_file_name;};
bool saveInternally(){return d_save_xpm;};
void setSaveInternally(bool save = true){d_save_xpm = save;};
void print(QPainter *p, const QwtScaleMap map[QwtPlot::axisCnt]);
virtual QString saveToString();
void clone(ImageWidget* t);
static void restore(Graph *g, const QStringList& lst);
QString windowName(){return d_window_name;};
void setWindowName(const QString& name){d_window_name = name;};
static QPixmap windowPixmap(ApplicationWindow *mw, const QString& name, const QSize& size);
void paintEvent(QPaintEvent *e);
private:
void draw(QPainter *painter, const QRect& r);
QPixmap d_pix;
QString d_file_name;
bool d_save_xpm;
QString d_window_name;
};
#endif
ImageWidget::setWindowName
void setWindowName(const QString &name)
Definition: ImageWidget.h:67
ImageWidget::restore
static void restore(Graph *g, const QStringList &lst)
Definition: ImageWidget.cpp:240
ImageWidget::saveToString
virtual QString saveToString()
Definition: ImageWidget.cpp:223
ImageWidget::draw
void draw(QPainter *painter, const QRect &r)
Definition: ImageWidget.cpp:168
ImageWidget::clone
void clone(ImageWidget *t)
Definition: ImageWidget.cpp:213
Graph
A 2D-plotting widget.
Definition: Graph.h:123
ImageWidget::setSaveInternally
void setSaveInternally(bool save=true)
Definition: ImageWidget.h:57
ImageWidget::d_file_name
QString d_file_name
The file from which the image was loaded.
Definition: ImageWidget.h:76
ImageWidget::setPixmap
void setPixmap(const QPixmap &)
Definition: ImageWidget.cpp:200
ImageWidget::fileName
QString fileName()
Return d_file_name.
Definition: ImageWidget.h:54
ImageWidget::d_pix
QPixmap d_pix
Definition: ImageWidget.h:74
ImageWidget::load
bool load(const QString &fn, bool update=true)
Import image from d_file_name. Returns true if successful.
Definition: ImageWidget.cpp:86
ImageWidget
Definition: ImageWidget.h:37
ImageWidget::ImageWidget
ImageWidget(Graph *, const QString &fn=QString::null)
Construct an image widget from a file name.
Definition: ImageWidget.cpp:46
ImageWidget::d_save_xpm
bool d_save_xpm
Flag telling if the pixmap must be saved in the .qti project as XPM.
Definition: ImageWidget.h:78
ImageWidget::pixmap
QPixmap pixmap() const
Return the pixmap to be drawn.
Definition: ImageWidget.h:48
ImageWidget::windowName
QString windowName()
Return d_window_name.
Definition: ImageWidget.h:66
FrameWidget
Definition: FrameWidget.h:38
ApplicationWindow
QtiPlot&#39;s main window.
Definition: ApplicationWindow.h:133
FrameWidget.h
ImageWidget::print
void print(QPainter *p, const QwtScaleMap map[QwtPlot::axisCnt])
Definition: ImageWidget.cpp:157
ImageWidget::windowPixmap
static QPixmap windowPixmap(ApplicationWindow *mw, const QString &name, const QSize &size)
Definition: ImageWidget.cpp:118
ImageWidget::paintEvent
void paintEvent(QPaintEvent *e)
Definition: ImageWidget.cpp:139
ImageWidget::saveInternally
bool saveInternally()
Definition: ImageWidget.h:56
ImageWidget::d_window_name
QString d_window_name
The window whos image is drawn.
Definition: ImageWidget.h:80