From 24c04aa44a891a35c73a37a70dd6be9eb3eccf71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=B5=D0=BB=D0=B8=D0=BF=D0=B5=D0=BD=D0=BA=D0=BE=20?= =?UTF-8?q?=D0=98=D0=B2=D0=B0=D0=BD?= Date: Wed, 9 Aug 2017 08:21:43 +0000 Subject: [PATCH] git-svn-id: svn://db.shs.com.ru/libs@260 a8b55f48-bf90-11e4-a774-851b48703e85 --- qad/QtWraps.cmake | 3 ++- qad/graphic/graphic.cpp | 8 ++++---- qad/graphic/graphic.h | 11 ++++++----- qad/graphic/uglwidget.h | 23 +++++++++++++++++------ 4 files changed, 29 insertions(+), 16 deletions(-) diff --git a/qad/QtWraps.cmake b/qad/QtWraps.cmake index d00a4f8..a38821d 100644 --- a/qad/QtWraps.cmake +++ b/qad/QtWraps.cmake @@ -349,7 +349,7 @@ macro(qt_add_executable _NAME) _qt_split_add_args(_PREF _ARGS ${ARGN}) #message("${_PREF}") #message("${_ARGS}") - cmake_policy(SET CMP0020 NEW) + #cmake_policy(SET CMP0020 NEW) set(_TARGET ${_NAME}${TARGET_SUFFIX_Qt${_v}}) add_executable(${_TARGET} ${_PREF} ${_ARGS}) set(_${_NAME}_is_qt 1) @@ -401,6 +401,7 @@ macro(qt_target_link_libraries _NAME) list(APPEND _ARGS ${_i}) endif() endforeach() + cmake_policy(SET CMP0020 OLD) target_link_libraries(${_TARGET} ${Qt${_v}_LIBRARIES} ${_ARGS}) #message("link ${_TARGET}: ${Qt${_v}_LIBRARIES} ${_ARGS}") endif() diff --git a/qad/graphic/graphic.cpp b/qad/graphic/graphic.cpp index cd2aa3e..ee39655 100644 --- a/qad/graphic/graphic.cpp +++ b/qad/graphic/graphic.cpp @@ -193,7 +193,7 @@ void Graphic::procGesture(QGesture * g) { void Graphic::canvasPaintEvent(QPaintEvent * ) { if (is_lines_update) return; - QMutexLocker ml(&mutex_); + //QMutexLocker ml(&mutex_); //static int pwid = 0, phei = 0; int wid = canvas->width(), hei = canvas->height(); lastw = wid; @@ -1267,7 +1267,7 @@ void Graphic::checkLines() { void Graphic::tick(int index, bool slide, bool update_) { if (slide) { - mutex.lock(); + ///mutex.lock(); GraphicType & t(graphics[index]); if (history > 0.) while (t.polyline.size() > 1) { @@ -1277,7 +1277,7 @@ void Graphic::tick(int index, bool slide, bool update_) { } if (!update_) { if (isFit) findGraphicsRect(); - mutex.unlock(); + ///mutex.unlock(); return; } //polyline.push_back(QPointF(brick->time_, brick->output(port))); @@ -1287,7 +1287,7 @@ void Graphic::tick(int index, bool slide, bool update_) { if (aupdate) update(); return; } - mutex.unlock(); + ///mutex.unlock(); if (aupdate) update(); } diff --git a/qad/graphic/graphic.h b/qad/graphic/graphic.h index c1991d8..9d46bc3 100644 --- a/qad/graphic/graphic.h +++ b/qad/graphic/graphic.h @@ -6,7 +6,7 @@ #include #include #include -#include +///#include #include #include #include @@ -208,10 +208,11 @@ public: QWidget * viewport() const {return canvas;} QByteArray save(); void load(QByteArray ba); - void lock() {mutex_.lock();} - void unlock() {mutex_.unlock();} + ///void lock() {mutex_.lock();} + ///void unlock() {mutex_.unlock();} - void reset() {mutex.lock(); clear(); mutex.unlock();} + ///void reset() {mutex.lock(); clear(); mutex.unlock();} + void reset() {clear();} GraphicType graphic(int arg) {if (arg < 0 || arg >= graphics.size()) return GraphicType(); return graphics[arg];} const QVector & allGraphics() const {return graphics;} @@ -362,7 +363,7 @@ protected: QPair gridMark(double v) const; Ui::Graphic * ui; - QMutex mutex, mutex_; + ///QMutex mutex, mutex_; QWidget * canvas; QImage * buffer; QPainter * painter; diff --git a/qad/graphic/uglwidget.h b/qad/graphic/uglwidget.h index c3391eb..2d2a0df 100644 --- a/qad/graphic/uglwidget.h +++ b/qad/graphic/uglwidget.h @@ -1,18 +1,29 @@ #ifndef UGLWIDGET_H #define UGLWIDGET_H -#include -#ifndef GL_MULTISAMPLE -#define GL_MULTISAMPLE 0x809D +#include +#if QT_VERSION >= 0x050400 +# include +typedef QOpenGLWidget __GLWidget__; +#else +# include +typedef QGLWidget __GLWidget__; +# ifndef GL_MULTISAMPLE +# define GL_MULTISAMPLE 0x809D +# endif #endif -class UGLWidget: public QGLWidget +class UGLWidget: public __GLWidget__ { Q_OBJECT public: - UGLWidget(QWidget * parent = 0): QGLWidget(QGLFormat(QGL::DoubleBuffer | QGL::AlphaChannel | QGL::DirectRendering | QGL::SampleBuffers), parent) {}; - UGLWidget(QGLContext * context, QWidget * parent = 0): QGLWidget(context, parent) {}; + UGLWidget(QWidget * parent = 0): __GLWidget__(/*QGLFormat(QGL::DoubleBuffer | QGL::AlphaChannel | QGL::DirectRendering | QGL::SampleBuffers),*/ parent) {} + //UGLWidget(QGLContext * context, QWidget * parent = 0): __GLWidget__(context, parent) {} + +#if QT_VERSION >= 0x050400 + QImage grabFrameBuffer() {return grabFramebuffer();} +#endif signals: void closeEvent(QCloseEvent * e);