6.4 QMathGL class

Class is Qt widget which display MathGL graphics. It is defined in #include <mgl2/qt.h>.

Example of Qt window with MathGL plot.
Method on QMathGL: void setDraw (mglDraw *dr)

Sets drawing functions from a class inherited from mglDraw.

Method on QMathGL: void setDraw (int (*draw)(mglBase *gr, void *p), void *par=NULL)
Method on QMathGL: void setDraw (int (*draw)(mglGraph *gr))

Sets the drawing function draw. There is support of a list of plots (frames). So as one can prepare a set of frames at first and redraw it fast later (but it requires more memory). Function should return positive number of frames for the list or zero if it will plot directly. Parameter par contains pointer to data for the plotting function draw.

Method on QMathGL: void setGraph (HMGL gr)
Method on QMathGL: void setGraph (mglGraph *gr)

Set pointer to external grapher (instead of built-in one). Note that QMathGL will automatically delete this object at destruction or at new setGraph() call.

Method on QMathGL: HMGL getGraph ()

Get pointer to grapher.

Method on QMathGL: void setPopup (QMenu *p)

Set popup menu pointer.

Method on QMathGL: void setSize (int w, int h)

Set widget/picture sizes

Method on QMathGL: double getRatio ()

Return aspect ratio of the picture.

Method on QMathGL: int getPer ()

Get perspective value in percents.

Method on QMathGL: int getPhi ()

Get Phi-angle value in degrees.

Method on QMathGL: int getTet ()

Get Theta-angle value in degrees.

Method on QMathGL: bool getAlpha ()

Get transparency state.

Method on QMathGL: bool getLight ()

Get lightning state.

Method on QMathGL: bool getZoom ()

Get mouse zooming state.

Method on QMathGL: bool getRotate ()

Get mouse rotation state.

Slot on QMathGL: void refresh ()

Redraw saved bitmap without executing drawing function.

Slot on QMathGL: void update ()

Update picture by executing drawing function.

Slot on QMathGL: void copy ()

Copy graphics to clipboard.

Slot on QMathGL: void copyClickCoor ()

Copy coordinates of click (as text).

Slot on QMathGL: void print ()

Print current picture.

Slot on QMathGL: void stop ()

Send signal to stop drawing.

Slot on QMathGL: void adjust ()

Adjust image size to fit whole widget.

Slot on QMathGL: void nextSlide ()

Show next slide.

Slot on QMathGL: void prevSlide ()

Show previous slide.

Slot on QMathGL: void animation (bool st=true)

Start/stop animation.

Slot on QMathGL: void setPer (int val)

Set perspective value.

Slot on QMathGL: void setPhi (int val)

Set Phi-angle value.

Slot on QMathGL: void setTet (int val)

Set Theta-angle value.

Slot on QMathGL: void setAlpha (bool val)

Switch on/off transparency.

Slot on QMathGL: void setLight (bool val)

Switch on/off lightning.

Slot on QMathGL: void setGrid (bool val)

Switch on/off drawing of grid for absolute coordinates.

Slot on QMathGL: void setZoom (bool val)

Switch on/off mouse zooming.

Slot on QMathGL: void setRotate (bool val)

Switch on/off mouse rotation.

Slot on QMathGL: void zoomIn ()

Zoom in graphics.

Slot on QMathGL: void zoomOut ()

Zoom out graphics.

Slot on QMathGL: void shiftLeft ()

Shift graphics to left direction.

Slot on QMathGL: void shiftRight ()

Shift graphics to right direction.

Slot on QMathGL: void shiftUp ()

Shift graphics to up direction.

Slot on QMathGL: void shiftDown ()

Shift graphics to down direction.

Slot on QMathGL: void restore ()

Restore zoom and rotation to default values.

Slot on QMathGL: void exportPNG (QString fname="")

Export current picture to PNG file.

Slot on QMathGL: void exportPNGs (QString fname="")

Export current picture to PNG file (no transparency).

Slot on QMathGL: void exportJPG (QString fname="")

Export current picture to JPEG file.

Slot on QMathGL: void exportBPS (QString fname="")

Export current picture to bitmap EPS file.

Slot on QMathGL: void exportEPS (QString fname="")

Export current picture to vector EPS file.

Slot on QMathGL: void exportSVG (QString fname="")

Export current picture to SVG file.

Slot on QMathGL: void exportGIF (QString fname="")

Export current picture to GIF file.

Slot on QMathGL: void exportTEX (QString fname="")

Export current picture to LaTeX/Tikz file.

Slot on QMathGL: void exportTGA (QString fname="")

Export current picture to TGA file.

Slot on QMathGL: void exportXYZ (QString fname="")

Export current picture to XYZ/XYZL/XYZF file.

Slot on QMathGL: void exportOBJ (QString fname="")

Export current picture to OBJ/MTL file.

Slot on QMathGL: void exportSTL (QString fname="")

Export current picture to STL file.

Slot on QMathGL: void exportOFF (QString fname="")

Export current picture to OFF file.

Slot on QMathGL: voidsetUsePrimitives (bool use)

Enable using list of primitives for frames. This allows frames transformation/zoom but requires much more memory. Default value is true.

Slot on QMathGL: void setMGLFont (QString path)

Restore (path="") or load font for graphics.

Slot on QMathGL: void about ()

Show about information.

Slot on QMathGL: void aboutQt ()

Show information about Qt version.

Signal on QMathGL: void phiChanged (int val)

Phi angle changed (by mouse or by toolbar).

Signal on QMathGL: void tetChanged (int val)

Tet angle changed (by mouse or by toolbar).

Signal on QMathGL: void perChanged (int val)

Perspective changed (by mouse or by toolbar).

Signal on QMathGL: void alphaChanged (bool val)

Transparency changed (by toolbar).

Signal on QMathGL: void lightChanged (bool val)

Lighting changed (by toolbar).

Signal on QMathGL: void gridChanged (bool val)

Grid drawing changed (by toolbar).

Signal on QMathGL: void zoomChanged (bool val)

Zooming changed (by toolbar).

Signal on QMathGL: void rotateChanged (bool val)

Rotation changed (by toolbar).

Signal on QMathGL: void mouseClick (mreal x, mreal y, mreal z)

Mouse click take place at position {x,y,z}.

Signal on QMathGL: void frameChanged (int val)

Need another frame to show.

Signal on QMathGL: void showWarn (QString warn)

Need to show warning.

Signal on QMathGL: void posChanged (QString pos)

Position of mouse click is changed.

Signal on QMathGL: void objChanged (int id)

Object id is changed (due to mouse click).

Signal on QMathGL: void refreshData ()

Data can be changed (drawing is finished).

QMathGL option of QMathGL: QString appName

Application name for message boxes.

QMathGL option of QMathGL: bool autoResize

Allow auto resizing (default is false).