git-svn-id: svn://db.shs.com.ru/libs@279 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -66,7 +66,7 @@ Graphic::Graphic(QWidget * parent): QFrame(parent), line_x_min(this), line_x_max
|
||||
connect(&line_x_max, SIGNAL(valueChanged(double)), this, SLOT(lineXMaxChanged(double)));
|
||||
connect(&line_y_min, SIGNAL(valueChanged(double)), this, SLOT(lineYMinChanged(double)));
|
||||
connect(&line_y_max, SIGNAL(valueChanged(double)), this, SLOT(lineYMaxChanged(double)));
|
||||
connect(ui->canvas_raster, SIGNAL(paintEvent(QPaintEvent * )), this, SLOT(canvasPaintEvent(QPaintEvent * )));
|
||||
connect(ui->canvas_raster, SIGNAL(paintEvent(QPaintEvent * )), this, SLOT(canvasPaintEvent()));
|
||||
connect(ui->canvas_raster, SIGNAL(mouseMoveEvent(QMouseEvent * )), this, SLOT(canvasMouseMoveEvent(QMouseEvent * )));
|
||||
connect(ui->canvas_raster, SIGNAL(mousePressEvent(QMouseEvent * )), this, SLOT(canvasMousePressEvent(QMouseEvent * )));
|
||||
connect(ui->canvas_raster, SIGNAL(mouseReleaseEvent(QMouseEvent * )), this, SLOT(canvasMouseReleaseEvent(QMouseEvent * )));
|
||||
@@ -74,7 +74,7 @@ Graphic::Graphic(QWidget * parent): QFrame(parent), line_x_min(this), line_x_max
|
||||
connect(ui->canvas_raster, SIGNAL(wheelEvent(QWheelEvent * )), this, SLOT(canvasWheelEvent(QWheelEvent * )));
|
||||
connect(ui->canvas_raster, SIGNAL(leaveEvent(QEvent * )), this, SLOT(canvasLeaveEvent(QEvent * )));
|
||||
connect(ui->canvas_raster, SIGNAL(keyPressEvent(QKeyEvent * )), this, SLOT(canvasKeyPressEvent(QKeyEvent * )));
|
||||
connect(ui->canvas_gl, SIGNAL(paintEvent(QPaintEvent * )), this, SLOT(canvasPaintEvent(QPaintEvent * )));
|
||||
connect(ui->canvas_gl, SIGNAL(paintSignal()), this, SLOT(canvasPaintEvent()));
|
||||
connect(ui->canvas_gl, SIGNAL(mouseMoveEvent(QMouseEvent * )), this, SLOT(canvasMouseMoveEvent(QMouseEvent * )));
|
||||
connect(ui->canvas_gl, SIGNAL(mousePressEvent(QMouseEvent * )), this, SLOT(canvasMousePressEvent(QMouseEvent * )));
|
||||
connect(ui->canvas_gl, SIGNAL(mouseReleaseEvent(QMouseEvent * )), this, SLOT(canvasMouseReleaseEvent(QMouseEvent * )));
|
||||
@@ -191,7 +191,7 @@ void Graphic::procGesture(QGesture * g) {
|
||||
}
|
||||
|
||||
|
||||
void Graphic::canvasPaintEvent(QPaintEvent * ) {
|
||||
void Graphic::canvasPaintEvent() {
|
||||
if (is_lines_update) return;
|
||||
//QMutexLocker ml(&mutex_);
|
||||
//static int pwid = 0, phei = 0;
|
||||
@@ -853,7 +853,7 @@ void Graphic::drawAction() {
|
||||
|
||||
|
||||
void Graphic::drawGrid() {
|
||||
int gbx = gridborder.x(), gby = gridborder.y(), cwid = painter->viewport().width(), chei = painter->viewport().height() - legy;
|
||||
int gbx = gridborder.x(), gby = gridborder.y(), cwid = canvas->width(), chei = canvas->height() - legy;
|
||||
double px, py, range, step, start;
|
||||
int wid = cwid - gbx - 5, hei = chei - gby - 5, cx, cy, cnt;
|
||||
QRect rect;
|
||||
@@ -1016,7 +1016,7 @@ void Graphic::drawGraphics() {
|
||||
if (isHover)
|
||||
ui->status->setText(tr("Cursor: ") + pointCoords(canvas2real(QPointF(curpos))));
|
||||
QPointF srp = -selrect.topLeft(), cp;
|
||||
double sclx, scly, wid = painter->viewport().width(), hei = painter->viewport().height() - legy, pw;
|
||||
double sclx, scly, wid = canvas->width(), hei = canvas->height() - legy, pw;
|
||||
sclx = (wid - gridborder.x() - margins_.left() - margins_.width()) / selrect.width();
|
||||
scly = (hei - gridborder.y() - margins_.top() - margins_.height()) / selrect.height();
|
||||
painter->setClipping(true);
|
||||
|
||||
@@ -394,7 +394,7 @@ protected:
|
||||
bool hasLblX, hasLblY, navigation, only_expand_y, only_expand_x, is_lines_update, leg_update, visible_update, fullscr;
|
||||
|
||||
protected slots:
|
||||
void canvasPaintEvent(QPaintEvent * );
|
||||
void canvasPaintEvent();
|
||||
void canvasMouseMoveEvent(QMouseEvent * );
|
||||
void canvasMousePressEvent(QMouseEvent * );
|
||||
void canvasMouseReleaseEvent(QMouseEvent * );
|
||||
|
||||
@@ -16,7 +16,7 @@ MainWindow::MainWindow(QWidget * parent): QMainWindow(parent), Ui::MainWindow()
|
||||
epal.setColor(lineInput->backgroundRole(), QColor(Qt::red).lighter(150));
|
||||
connect(&session, SIGNAL(loading(QPIConfig & )), this, SLOT(loading(QPIConfig & )));
|
||||
connect(&session, SIGNAL(saving(QPIConfig & )), this, SLOT(saving(QPIConfig & )));
|
||||
session.setFile("session.conf");
|
||||
session.setFile("session_qpicalc.conf");
|
||||
session.addEntry(this);
|
||||
session.addEntry(lineInput);
|
||||
session.addEntry(tabWidget);
|
||||
@@ -105,6 +105,9 @@ void MainWindow::loading(QPIConfig & conf) {
|
||||
}
|
||||
buttonGraphicClear->setEnabled(treeGraphics->topLevelItemCount() > 0);
|
||||
graphic->setVisualRect(conf.getValue("graphicRect", QRectF(-1., -1., 2., 2.)));
|
||||
ba = conf.getValue("graphic_state", QByteArray());
|
||||
if (!ba.isEmpty())
|
||||
graphic->load(ba);
|
||||
on_tabWidget_currentChanged(0);
|
||||
redrawGraphics();
|
||||
active_ = true;
|
||||
@@ -130,6 +133,7 @@ void MainWindow::saving(QPIConfig & conf) {
|
||||
s << graphic->allGraphics();
|
||||
conf.setValue("graphics", QByteArray2QString(ba));
|
||||
conf.setValue("graphicRect", graphic->visualRect());
|
||||
conf.setValue("graphic_state", graphic->save());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>780</width>
|
||||
<height>492</height>
|
||||
<height>521</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -22,7 +22,7 @@
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
@@ -32,7 +32,16 @@
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
@@ -120,7 +129,16 @@
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
@@ -166,7 +184,7 @@
|
||||
<item>
|
||||
<widget class="QToolButton" name="buttonVarAdd">
|
||||
<property name="icon">
|
||||
<iconset resource="qpicalculator.qrc">
|
||||
<iconset resource="../../utils/qad_utils.qrc">
|
||||
<normaloff>:/icons/list-add.png</normaloff>:/icons/list-add.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@@ -183,7 +201,7 @@
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="qpicalculator.qrc">
|
||||
<iconset resource="../../utils/qad_utils.qrc">
|
||||
<normaloff>:/icons/edit-delete.png</normaloff>:/icons/edit-delete.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@@ -219,7 +237,7 @@
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="qpicalculator.qrc">
|
||||
<iconset resource="../../utils/qad_utils.qrc">
|
||||
<normaloff>:/icons/edit-clear.png</normaloff>:/icons/edit-clear.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@@ -255,7 +273,16 @@
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
@@ -313,7 +340,7 @@
|
||||
<item>
|
||||
<widget class="QToolButton" name="buttonGraphicAdd">
|
||||
<property name="icon">
|
||||
<iconset resource="qpicalculator.qrc">
|
||||
<iconset resource="../../utils/qad_utils.qrc">
|
||||
<normaloff>:/icons/list-add.png</normaloff>:/icons/list-add.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@@ -330,7 +357,7 @@
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="qpicalculator.qrc">
|
||||
<iconset resource="../../utils/qad_utils.qrc">
|
||||
<normaloff>:/icons/edit-delete.png</normaloff>:/icons/edit-delete.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@@ -366,7 +393,7 @@
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="qpicalculator.qrc">
|
||||
<iconset resource="../../utils/qad_utils.qrc">
|
||||
<normaloff>:/icons/edit-clear.png</normaloff>:/icons/edit-clear.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@@ -402,7 +429,7 @@
|
||||
<item>
|
||||
<widget class="Graphic" name="graphic">
|
||||
<property name="buttons">
|
||||
<set>Graphic::BorderInputs|Graphic::Configure|Graphic::CursorAxis|Graphic::Grid|Graphic::Save</set>
|
||||
<set>Graphic::BorderInputs|Graphic::Configure|Graphic::CursorAxis|Graphic::Fullscreen|Graphic::Grid|Graphic::Save</set>
|
||||
</property>
|
||||
<property name="antialiasing">
|
||||
<bool>true</bool>
|
||||
@@ -436,6 +463,7 @@
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../../utils/qad_utils.qrc"/>
|
||||
<include location="qpicalculator.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define UGLWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QDebug>
|
||||
#if QT_VERSION >= 0x050400
|
||||
# include <QOpenGLWidget>
|
||||
typedef QOpenGLWidget __GLWidget__;
|
||||
@@ -18,13 +19,29 @@ class UGLWidget: public __GLWidget__
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
UGLWidget(QWidget * parent = 0): __GLWidget__(/*QGLFormat(QGL::DoubleBuffer | QGL::AlphaChannel | QGL::DirectRendering | QGL::SampleBuffers),*/ parent) {}
|
||||
#if QT_VERSION >= 0x050400
|
||||
UGLWidget(QWidget * parent = 0): __GLWidget__(parent) {QSurfaceFormat sf = format(); sf.setSamples(8); setFormat(sf);}
|
||||
#else
|
||||
UGLWidget(QWidget * parent = 0): __GLWidget__(QGLFormat(QGL::DoubleBuffer | QGL::AlphaChannel | QGL::DirectRendering | QGL::SampleBuffers), parent) {}
|
||||
#endif
|
||||
//UGLWidget(QGLContext * context, QWidget * parent = 0): __GLWidget__(context, parent) {}
|
||||
|
||||
#if QT_VERSION >= 0x050400
|
||||
QImage grabFrameBuffer() {return grabFramebuffer();}
|
||||
#endif
|
||||
|
||||
protected:
|
||||
#if QT_VERSION >= 0x050400
|
||||
virtual void paintGL() {emit paintSignal();}
|
||||
#else
|
||||
virtual void paintEvent(QPaintEvent * ) {emit paintSignal();}
|
||||
#endif
|
||||
virtual void resizeEvent(QResizeEvent * e) {
|
||||
__GLWidget__::resizeEvent(e);
|
||||
emit resizeSignal();
|
||||
}
|
||||
|
||||
|
||||
signals:
|
||||
void closeEvent(QCloseEvent * e);
|
||||
void dragEnterEvent(QDragEnterEvent * e);
|
||||
@@ -41,18 +58,10 @@ signals:
|
||||
void mousePressEvent(QMouseEvent * e);
|
||||
void mouseReleaseEvent(QMouseEvent * e);
|
||||
void moveEvent(QMoveEvent * e);
|
||||
void resizeEvent(QResizeEvent * e);
|
||||
void showEvent(QShowEvent * e);
|
||||
void wheelEvent(QWheelEvent * e);
|
||||
void paintEvent(QPaintEvent * e);
|
||||
void glDraw();
|
||||
void glInit();
|
||||
void initializeGL();
|
||||
void initializeOverlayGL();
|
||||
void paintGL();
|
||||
void paintOverlayGL();
|
||||
void resizeGL(int width, int height);
|
||||
void resizeOverlayGL(int width, int height);
|
||||
void resizeSignal();
|
||||
void paintSignal();
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ class UWidget: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
UWidget(QWidget * parent = 0): QWidget(parent) {};
|
||||
UWidget(QWidget * parent = 0): QWidget(parent) {}
|
||||
|
||||
private:
|
||||
virtual bool event(QEvent * e) {
|
||||
|
||||
Reference in New Issue
Block a user