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})
#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()

View File

@@ -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();
}

View File

@@ -6,7 +6,7 @@
#include <QPixmap>
#include <QMouseEvent>
#include <QComboBox>
#include <QMutex>
///#include <QMutex>
#include <QDebug>
#include <QGridLayout>
#include <QFileDialog>
@@ -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<GraphicType> & allGraphics() const {return graphics;}
@@ -362,7 +363,7 @@ protected:
QPair<QString, QString> gridMark(double v) const;
Ui::Graphic * ui;
QMutex mutex, mutex_;
///QMutex mutex, mutex_;
QWidget * canvas;
QImage * buffer;
QPainter * painter;

View File

@@ -1,18 +1,29 @@
#ifndef UGLWIDGET_H
#define UGLWIDGET_H
#include <QGLWidget>
#ifndef GL_MULTISAMPLE
#define GL_MULTISAMPLE 0x809D
#include <QWidget>
#if QT_VERSION >= 0x050400
# include <QOpenGLWidget>
typedef QOpenGLWidget __GLWidget__;
#else
# include <QGLWidget>
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);