git-svn-id: svn://db.shs.com.ru/libs@260 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2017-08-09 08:21:43 +00:00
parent 28420cccc5
commit 24c04aa44a
4 changed files with 29 additions and 16 deletions

View File

@@ -349,7 +349,7 @@ macro(qt_add_executable _NAME)
_qt_split_add_args(_PREF _ARGS ${ARGN}) _qt_split_add_args(_PREF _ARGS ${ARGN})
#message("${_PREF}") #message("${_PREF}")
#message("${_ARGS}") #message("${_ARGS}")
cmake_policy(SET CMP0020 NEW) #cmake_policy(SET CMP0020 NEW)
set(_TARGET ${_NAME}${TARGET_SUFFIX_Qt${_v}}) set(_TARGET ${_NAME}${TARGET_SUFFIX_Qt${_v}})
add_executable(${_TARGET} ${_PREF} ${_ARGS}) add_executable(${_TARGET} ${_PREF} ${_ARGS})
set(_${_NAME}_is_qt 1) set(_${_NAME}_is_qt 1)
@@ -401,6 +401,7 @@ macro(qt_target_link_libraries _NAME)
list(APPEND _ARGS ${_i}) list(APPEND _ARGS ${_i})
endif() endif()
endforeach() endforeach()
cmake_policy(SET CMP0020 OLD)
target_link_libraries(${_TARGET} ${Qt${_v}_LIBRARIES} ${_ARGS}) target_link_libraries(${_TARGET} ${Qt${_v}_LIBRARIES} ${_ARGS})
#message("link ${_TARGET}: ${Qt${_v}_LIBRARIES} ${_ARGS}") #message("link ${_TARGET}: ${Qt${_v}_LIBRARIES} ${_ARGS}")
endif() endif()

View File

@@ -193,7 +193,7 @@ void Graphic::procGesture(QGesture * g) {
void Graphic::canvasPaintEvent(QPaintEvent * ) { void Graphic::canvasPaintEvent(QPaintEvent * ) {
if (is_lines_update) return; if (is_lines_update) return;
QMutexLocker ml(&mutex_); //QMutexLocker ml(&mutex_);
//static int pwid = 0, phei = 0; //static int pwid = 0, phei = 0;
int wid = canvas->width(), hei = canvas->height(); int wid = canvas->width(), hei = canvas->height();
lastw = wid; lastw = wid;
@@ -1267,7 +1267,7 @@ void Graphic::checkLines() {
void Graphic::tick(int index, bool slide, bool update_) { void Graphic::tick(int index, bool slide, bool update_) {
if (slide) { if (slide) {
mutex.lock(); ///mutex.lock();
GraphicType & t(graphics[index]); GraphicType & t(graphics[index]);
if (history > 0.) if (history > 0.)
while (t.polyline.size() > 1) { while (t.polyline.size() > 1) {
@@ -1277,7 +1277,7 @@ void Graphic::tick(int index, bool slide, bool update_) {
} }
if (!update_) { if (!update_) {
if (isFit) findGraphicsRect(); if (isFit) findGraphicsRect();
mutex.unlock(); ///mutex.unlock();
return; return;
} }
//polyline.push_back(QPointF(brick->time_, brick->output(port))); //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(); if (aupdate) update();
return; return;
} }
mutex.unlock(); ///mutex.unlock();
if (aupdate) update(); if (aupdate) update();
} }

View File

@@ -6,7 +6,7 @@
#include <QPixmap> #include <QPixmap>
#include <QMouseEvent> #include <QMouseEvent>
#include <QComboBox> #include <QComboBox>
#include <QMutex> ///#include <QMutex>
#include <QDebug> #include <QDebug>
#include <QGridLayout> #include <QGridLayout>
#include <QFileDialog> #include <QFileDialog>
@@ -208,10 +208,11 @@ public:
QWidget * viewport() const {return canvas;} QWidget * viewport() const {return canvas;}
QByteArray save(); QByteArray save();
void load(QByteArray ba); void load(QByteArray ba);
void lock() {mutex_.lock();} ///void lock() {mutex_.lock();}
void unlock() {mutex_.unlock();} ///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];} GraphicType graphic(int arg) {if (arg < 0 || arg >= graphics.size()) return GraphicType(); return graphics[arg];}
const QVector<GraphicType> & allGraphics() const {return graphics;} const QVector<GraphicType> & allGraphics() const {return graphics;}
@@ -362,7 +363,7 @@ protected:
QPair<QString, QString> gridMark(double v) const; QPair<QString, QString> gridMark(double v) const;
Ui::Graphic * ui; Ui::Graphic * ui;
QMutex mutex, mutex_; ///QMutex mutex, mutex_;
QWidget * canvas; QWidget * canvas;
QImage * buffer; QImage * buffer;
QPainter * painter; QPainter * painter;

View File

@@ -1,18 +1,29 @@
#ifndef UGLWIDGET_H #ifndef UGLWIDGET_H
#define UGLWIDGET_H #define UGLWIDGET_H
#include <QWidget>
#if QT_VERSION >= 0x050400
# include <QOpenGLWidget>
typedef QOpenGLWidget __GLWidget__;
#else
# include <QGLWidget> # include <QGLWidget>
typedef QGLWidget __GLWidget__;
# ifndef GL_MULTISAMPLE # ifndef GL_MULTISAMPLE
# define GL_MULTISAMPLE 0x809D # define GL_MULTISAMPLE 0x809D
# endif # endif
#endif
class UGLWidget: public QGLWidget class UGLWidget: public __GLWidget__
{ {
Q_OBJECT Q_OBJECT
public: public:
UGLWidget(QWidget * parent = 0): QGLWidget(QGLFormat(QGL::DoubleBuffer | QGL::AlphaChannel | QGL::DirectRendering | QGL::SampleBuffers), parent) {}; UGLWidget(QWidget * parent = 0): __GLWidget__(/*QGLFormat(QGL::DoubleBuffer | QGL::AlphaChannel | QGL::DirectRendering | QGL::SampleBuffers),*/ parent) {}
UGLWidget(QGLContext * context, QWidget * parent = 0): QGLWidget(context, parent) {}; //UGLWidget(QGLContext * context, QWidget * parent = 0): __GLWidget__(context, parent) {}
#if QT_VERSION >= 0x050400
QImage grabFrameBuffer() {return grabFramebuffer();}
#endif
signals: signals:
void closeEvent(QCloseEvent * e); void closeEvent(QCloseEvent * e);