scidavis  2.3.0
About: SciDAVis is a free application for Scientific Data Analysis and Visualization (a fork off of QtiPlot).
  Fossies Dox: scidavis-2.3.0.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

MultiLayer.h
Go to the documentation of this file.
1 
14 
32 #ifndef MULTILAYER_H
33 #define MULTILAYER_H
34 
35 #include "MyWidget.h"
36 #include "Graph.h"
37 #include <QPushButton>
38 #include <QLayout>
39 #include <QPointer>
40 #include "core/column/Column.h"
41 
42 class QWidget;
43 class QLabel;
44 class QWidget;
45 class LayerButton;
47 class ApplicationWindow;
48 
66 class MultiLayer: public MyWidget
67 {
68  Q_OBJECT
69 
70 public:
71  MultiLayer (const QString& label, QWidget* parent=0, const QString name=QString(), Qt::WindowFlags f=0);
72  QWidgetList graphPtrs(){return graphsList;};
73  Graph *layer(int num);
74  QWidgetList layerWidgets() const { return graphsList; }
76  void copy(ApplicationWindow * parent, MultiLayer* ml);
77 
80 
82 
83  void mousePressEvent(QMouseEvent *);
84  void contextMenuEvent(QContextMenuEvent *);
85  void wheelEvent(QWheelEvent *);
86  void keyPressEvent(QKeyEvent *);
87  bool eventFilter(QObject *object, QEvent *);
88  void releaseLayer();
89 
90  bool focusNextPrevChild ( bool next );
92 
95 
97  void printCropmarks(bool on){d_print_cropmarks = on;};
98 
99 public slots:
100  Graph* addLayer(int x = 0, int y = 0, int width = 0, int height = 0);
101  void setLayersNumber(int n);
102 
103  bool isEmpty();
104  void removeLayer();
105  void confirmRemoveLayer();
106 
114  void addTextLayer(int f, const QFont& font, const QColor& textCol, const QColor& backgroundCol);
122  void addTextLayer(const QPoint& pos);
123 
125  void setActiveGraph(Graph* g);
126  void activateGraph(LayerButton* button);
127 
128  void setGraphGeometry(int x, int y, int w, int h);
129 
130  void findBestLayout(int &rows, int &cols);
131 
132  QSize arrangeLayers(bool userSize);
133  void arrangeLayers(bool fit, bool userSize);
134 
135  int getRows(){return rows;};
136  void setRows(int r);
137 
138  int getCols(){return cols;};
139  void setCols(int c);
140 
141  int colsSpacing(){return colsSpace;};
142  int rowsSpacing(){return rowsSpace;};
143  void setSpacing (int rgap, int cgap);
144 
145  int leftMargin(){return left_margin;};
146  int rightMargin(){return right_margin;};
147  int topMargin(){return top_margin;};
148  int bottomMargin(){return bottom_margin;};
149  void setMargins (int lm, int rm, int tm, int bm);
150 
152  void setLayerCanvasSize (int w, int h);
153 
156  void setAlignement (int ha, int va);
157 
158  int layers(){return graphs;};
159 
161 
162  void exportToFile(const QString& fileName);
163  void exportImage(const QString& fileName, int quality = -1);
164  void exportSVG(const QString& fname);
165  void exportPDF(const QString& fname);
166  void exportVector(const QString& fileName, int res = 0, bool color = true,
167  bool keepAspect = true, QPrinter::PageSize pageSize = QPrinter::Custom,
168  QPrinter::Orientation orientation = QPrinter::Portrait);
169  void exportPainter(QPaintDevice &paintDevice, bool keepAspect = false, QRect rect = QRect());
170  void exportPainter(QPainter &painter, bool keepAspect = false, QRect rect = QRect(), QSize size = QSize());
171 
172  void copyAllLayers();
173  void print();
174  void printAllLayers(QPainter *painter);
175  void printActiveLayer();
177 
178  void setFonts(const QFont& titleFnt, const QFont& scaleFnt,
179  const QFont& numbersFnt, const QFont& legendFnt);
180 
181  void connectLayer(Graph *g);
182 
183  QString saveToString(const QString& geometry);
184  QString saveAsTemplate(const QString& geometryInfo);
185 
186 signals:
188  void showPlotDialog(int);
189  void showAxisDialog(int);
190  void showScaleDialog(int);
196  void drawTextOff();
197  void drawLineEnded(bool);
203  void modifiedPlot();
204  void cursorInfo(const QString&);
208  void createTable(const QString&,const QString&,QList<Column*>);
210  void pasteMarker();
211  void createIntensityTable(const QString&);
213 
214 private:
215  void resizeLayers (const QResizeEvent *re);
216  void resizeLayers (const QSize& size, const QSize& oldSize, bool scaleFonts);
217  QSize lastSize; // workaround for resize layers after hide/minimize
218 
224  bool addTextOn;
226 
231 
232  QWidgetList buttonsList, graphsList;
233  QHBoxLayout *layerButtonsBox;
234  QWidget *canvas;
235 
236  QPointer<SelectionMoveResizer> d_layers_selector;
237 };
238 
239 
241 class LayerButton: public QPushButton
242 {
243  Q_OBJECT
244 
245 public:
246  LayerButton (const QString& text = {}, QWidget* parent = 0);
248 
249  static int btnSize(){return 20;};
250 
251 protected:
252  void mousePressEvent( QMouseEvent * );
253  void mouseDoubleClickEvent ( QMouseEvent * );
254 
255 signals:
259 };
260 
261 #endif
MultiLayer::resizeLayers
void resizeLayers(const QResizeEvent *re)
Definition: MultiLayer.cpp:232
MultiLayer::graph_height
int graph_height
Definition: MultiLayer.h:221
MultiLayer::print
void print()
Definition: MultiLayer.cpp:782
MultiLayer::contextMenuEvent
void contextMenuEvent(QContextMenuEvent *)
Definition: MultiLayer.cpp:226
MultiLayer::colsSpace
int colsSpace
Definition: MultiLayer.h:221
MultiLayer::setSpacing
void setSpacing(int rgap, int cgap)
Definition: MultiLayer.cpp:1204
MultiLayer::colsSpacing
int colsSpacing()
Definition: MultiLayer.h:141
MultiLayer::addTextLayer
void addTextLayer(int f, const QFont &font, const QColor &textCol, const QColor &backgroundCol)
Start adding a text layer.
Definition: MultiLayer.cpp:934
MultiLayer::defaultTextMarkerBackground
QColor defaultTextMarkerBackground
Definition: MultiLayer.h:230
MultiLayer::showCurvesDialog
void showCurvesDialog()
MultiLayer::createTable
void createTable(const QString &, const QString &, QList< Column * >)
MultiLayer::printAllLayers
void printAllLayers(QPainter *painter)
Definition: MultiLayer.cpp:803
MultiLayer::leftMargin
int leftMargin()
Definition: MultiLayer.h:145
MultiLayer::layerWidgets
QWidgetList layerWidgets() const
Definition: MultiLayer.h:74
MultiLayer::showImageDialog
void showImageDialog()
MultiLayer::showPlotDialog
void showPlotDialog(int)
MultiLayer::scaleLayersOnPrint
bool scaleLayersOnPrint()
Definition: MultiLayer.h:93
Column.h
MultiLayer::cols
int cols
Definition: MultiLayer.h:221
MultiLayer::mousePressEvent
void mousePressEvent(QMouseEvent *)
Definition: MultiLayer.cpp:1150
MultiLayer::removeLayer
void removeLayer()
Definition: MultiLayer.cpp:313
MultiLayer::rightMargin
int rightMargin()
Definition: MultiLayer.h:146
MultiLayer
An MDI window (MyWidget) managing one or more Graph objects.
Definition: MultiLayer.h:67
MultiLayer::verticalAlignement
int verticalAlignement()
Definition: MultiLayer.h:155
MultiLayer::active_graph
Graph * active_graph
Definition: MultiLayer.h:219
MultiLayer::setRows
void setRows(int r)
Definition: MultiLayer.cpp:631
MultiLayer::isEmpty
bool isEmpty()
Definition: MultiLayer.cpp:1099
MultiLayer::right_margin
int right_margin
Definition: MultiLayer.h:222
MultiLayer::wheelEvent
void wheelEvent(QWheelEvent *)
Definition: MultiLayer.cpp:1023
MultiLayer::printCropmarks
void printCropmarks(bool on)
Definition: MultiLayer.h:97
MultiLayer::exportImage
void exportImage(const QString &fileName, int quality=-1)
Definition: MultiLayer.cpp:662
MultiLayer::keyPressEvent
void keyPressEvent(QKeyEvent *)
Definition: MultiLayer.cpp:988
MultiLayer::confirmRemoveLayer
void confirmRemoveLayer()
Definition: MultiLayer.cpp:285
MyWidget
Base class of all MDI client windows.
Definition: MyWidget.h:52
MultiLayer::pasteMarker
void pasteMarker()
MultiLayer::d_print_cropmarks
bool d_print_cropmarks
Definition: MultiLayer.h:225
MultiLayer::horizontalAlignement
int horizontalAlignement()
Definition: MultiLayer.h:154
LayerButton::LayerButton
LayerButton(const QString &text={}, QWidget *parent=0)
Definition: MultiLayer.cpp:63
MyWidget::name
virtual QString name()
Return the window name.
Definition: MyWidget.h:81
MultiLayer::canvas
QWidget * canvas
Definition: MultiLayer.h:234
MultiLayer::showMarkerPopupMenu
void showMarkerPopupMenu()
MultiLayer::showWindowContextMenu
void showWindowContextMenu()
MultiLayer::graphs
int graphs
Used for resizing of layers.
Definition: MultiLayer.h:221
MultiLayer::setLayersNumber
void setLayersNumber(int n)
Definition: MultiLayer.cpp:1229
MultiLayer::activeGraph
Graph * activeGraph()
Definition: MultiLayer.h:124
MultiLayer::createIntensityTable
void createIntensityTable(const QString &)
MultiLayer::Right
@ Right
Definition: MultiLayer.h:78
LayerButton::showContextMenu
void showContextMenu()
MultiLayer::l_canvas_height
int l_canvas_height
Definition: MultiLayer.h:223
MultiLayer::setScaleLayersOnPrint
void setScaleLayersOnPrint(bool on)
Definition: MultiLayer.h:94
MultiLayer::setGraphGeometry
void setGraphGeometry(int x, int y, int w, int h)
Definition: MultiLayer.cpp:368
MultiLayer::topMargin
int topMargin()
Definition: MultiLayer.h:147
MultiLayer::printCropmarksEnabled
bool printCropmarksEnabled()
Definition: MultiLayer.h:96
MultiLayer::eventFilter
bool eventFilter(QObject *object, QEvent *)
Definition: MultiLayer.cpp:971
MultiLayer::top_margin
int top_margin
Definition: MultiLayer.h:222
MultiLayer::modifiedPlot
void modifiedPlot()
LayerButton::showCurvesDialog
void showCurvesDialog()
MultiLayer::exportPainter
void exportPainter(QPaintDevice &paintDevice, bool keepAspect=false, QRect rect=QRect())
Definition: MultiLayer.cpp:730
MultiLayer::exportPDF
void exportPDF(const QString &fname)
Definition: MultiLayer.cpp:669
MultiLayer::showAxisDialog
void showAxisDialog(int)
MultiLayer::HCenter
@ HCenter
Definition: MultiLayer.h:78
MultiLayer::addTextOn
bool addTextOn
Definition: MultiLayer.h:224
MultiLayer::d_scale_on_print
bool d_scale_on_print
Definition: MultiLayer.h:225
MultiLayer::bottom_margin
int bottom_margin
Definition: MultiLayer.h:222
MultiLayer::exportSVG
void exportSVG(const QString &fname)
Definition: MultiLayer.cpp:715
MultiLayer::connectLayer
void connectLayer(Graph *g)
Definition: MultiLayer.cpp:906
MultiLayer::drawTextOff
void drawTextOff()
MultiLayer::defaultTextMarkerFont
QFont defaultTextMarkerFont
Definition: MultiLayer.h:229
MultiLayer::layerButtonsBox
QHBoxLayout * layerButtonsBox
Definition: MultiLayer.h:233
MultiLayer::exportToFile
void exportToFile(const QString &fileName)
Definition: MultiLayer.cpp:637
MultiLayer::activateGraph
void activateGraph(LayerButton *button)
Definition: MultiLayer.cpp:184
MultiLayer::lastSize
QSize lastSize
Definition: MultiLayer.h:217
MultiLayer::showRightAxisTitleDialog
void showRightAxisTitleDialog()
MultiLayer::rowsSpace
int rowsSpace
Definition: MultiLayer.h:221
MultiLayer::findBestLayout
void findBestLayout(int &rows, int &cols)
Definition: MultiLayer.cpp:544
MultiLayer::showLayerButtonContextMenu
void showLayerButtonContextMenu()
MultiLayer::VCenter
@ VCenter
Definition: MultiLayer.h:79
MultiLayer::showGraphContextMenu
void showGraphContextMenu()
MultiLayer::Bottom
@ Bottom
Definition: MultiLayer.h:79
MultiLayer::setFonts
void setFonts(const QFont &titleFnt, const QFont &scaleFnt, const QFont &numbersFnt, const QFont &legendFnt)
Definition: MultiLayer.cpp:874
MultiLayer::viewTitleDialog
void viewTitleDialog()
MultiLayer::d_layers_selector
QPointer< SelectionMoveResizer > d_layers_selector
Definition: MultiLayer.h:236
MultiLayer::showTopAxisTitleDialog
void showTopAxisTitleDialog()
MultiLayer::defaultTextMarkerColor
QColor defaultTextMarkerColor
Definition: MultiLayer.h:230
LayerButton::clicked
void clicked(LayerButton *)
ApplicationWindow
SciDAVis's main window.
Definition: ApplicationWindow.h:122
MultiLayer::buttonsList
QWidgetList buttonsList
Definition: MultiLayer.h:232
MultiLayer::setMargins
void setMargins(int lm, int rm, int tm, int bm)
Definition: MultiLayer.cpp:1192
LayerButton::mousePressEvent
void mousePressEvent(QMouseEvent *)
Definition: MultiLayer.cpp:74
LayerButton::~LayerButton
~LayerButton()
Definition: MultiLayer.h:247
MultiLayer::setLayerCanvasSize
void setLayerCanvasSize(int w, int h)
Definition: MultiLayer.cpp:1212
MultiLayer::layer
Graph * layer(int num)
Definition: MultiLayer.cpp:141
MultiLayer::copyAllLayers
void copyAllLayers()
Definition: MultiLayer.cpp:765
MultiLayer::releaseLayer
void releaseLayer()
MultiLayer::showTextDialog
void showTextDialog()
MultiLayer::left_margin
int left_margin
Definition: MultiLayer.h:222
MultiLayer::graph_width
int graph_width
Definition: MultiLayer.h:221
MultiLayer::showScaleDialog
void showScaleDialog(int)
MultiLayer::MultiLayer
MultiLayer(const QString &label, QWidget *parent=0, const QString name=QString(), Qt::WindowFlags f=0)
Definition: MultiLayer.cpp:87
MultiLayer::setAlignement
void setAlignement(int ha, int va)
Definition: MultiLayer.cpp:1220
MultiLayer::defaultTextMarkerFrame
int defaultTextMarkerFrame
Used when adding text markers on new layers.
Definition: MultiLayer.h:228
Graph.h
MultiLayer::drawLineEnded
void drawLineEnded(bool)
MultiLayer::HorAlignement
HorAlignement
Definition: MultiLayer.h:78
MultiLayer::layers
int layers()
Definition: MultiLayer.h:158
MultiLayer::copy
void copy(ApplicationWindow *parent, MultiLayer *ml)
Definition: MultiLayer.cpp:1286
MyWidget.h
SelectionMoveResizer
Handler for modifying one or more QWidget and/or QwtPlotMarker with mouse or keyboard.
Definition: SelectionMoveResizer.h:90
MultiLayer::graphsList
QWidgetList graphsList
Definition: MultiLayer.h:232
MultiLayer::cursorInfo
void cursorInfo(const QString &)
MultiLayer::showXAxisTitleDialog
void showXAxisTitleDialog()
LayerButton::btnSize
static int btnSize()
Definition: MultiLayer.h:249
MultiLayer::VertAlignement
VertAlignement
Definition: MultiLayer.h:79
Graph
A 2D-plotting widget.
Definition: Graph.h:119
MultiLayer::exportVector
void exportVector(const QString &fileName, int res=0, bool color=true, bool keepAspect=true, QPrinter::PageSize pageSize=QPrinter::Custom, QPrinter::Orientation orientation=QPrinter::Portrait)
Definition: MultiLayer.cpp:674
MultiLayer::Top
@ Top
Definition: MultiLayer.h:79
MultiLayer::printActiveLayer
void printActiveLayer()
Definition: MultiLayer.cpp:772
MultiLayer::focusNextPrevChild
bool focusNextPrevChild(bool next)
Definition: MultiLayer.cpp:1306
MultiLayer::getCols
int getCols()
Definition: MultiLayer.h:138
MultiLayer::showLineDialog
void showLineDialog()
MultiLayer::addLayer
Graph * addLayer(int x=0, int y=0, int width=0, int height=0)
Definition: MultiLayer.cpp:164
MultiLayer::setCols
void setCols(int c)
Definition: MultiLayer.cpp:625
MultiLayer::graphPtrs
QWidgetList graphPtrs()
Definition: MultiLayer.h:72
MultiLayer::getRows
int getRows()
Definition: MultiLayer.h:135
MultiLayer::vert_align
int vert_align
Definition: MultiLayer.h:223
MultiLayer::saveToString
QString saveToString(const QString &geometry)
Definition: MultiLayer.cpp:1107
LayerButton
Button with layer number.
Definition: MultiLayer.h:242
MultiLayer::addLayerButton
LayerButton * addLayerButton()
Definition: MultiLayer.cpp:146
MultiLayer::showYAxisTitleDialog
void showYAxisTitleDialog()
MultiLayer::showGeometryDialog
void showGeometryDialog()
MultiLayer::bottomMargin
int bottomMargin()
Definition: MultiLayer.h:148
MultiLayer::showCurveContextMenu
void showCurveContextMenu(int)
MultiLayer::saveAsTemplate
QString saveAsTemplate(const QString &geometryInfo)
Definition: MultiLayer.cpp:1130
MultiLayer::hor_align
int hor_align
Definition: MultiLayer.h:223
MultiLayer::setPointerCursor
void setPointerCursor()
MultiLayer::Left
@ Left
Definition: MultiLayer.h:78
MultiLayer::arrangeLayers
QSize arrangeLayers(bool userSize)
Definition: MultiLayer.cpp:379
LayerButton::mouseDoubleClickEvent
void mouseDoubleClickEvent(QMouseEvent *)
Definition: MultiLayer.cpp:82
MultiLayer::rowsSpacing
int rowsSpacing()
Definition: MultiLayer.h:142
MultiLayer::rows
int rows
Definition: MultiLayer.h:221
MultiLayer::layerCanvasSize
QSize layerCanvasSize()
Definition: MultiLayer.h:151
MultiLayer::setActiveGraph
void setActiveGraph(Graph *g)
Definition: MultiLayer.cpp:202
MultiLayer::l_canvas_width
int l_canvas_width
Definition: MultiLayer.h:223