mirror of https://github.com/CGAL/cgal
Merge pull request #4780 from maxGimeno/GraphicsView-Fix_qt_deprecated_code-maxGimeno
GraphicsView: Fix Qt 5.15 deprecation warnings
This commit is contained in:
commit
38e7c641d7
|
|
@ -22,8 +22,8 @@ ArrangementDemoGraphicsView::ArrangementDemoGraphicsView( QWidget* parent ) :
|
||||||
gridColor( ::Qt::black ),
|
gridColor( ::Qt::black ),
|
||||||
backgroundColor( ::Qt::white )
|
backgroundColor( ::Qt::white )
|
||||||
{
|
{
|
||||||
QMatrix m( 1.0, 0.0, 0.0, -1.0, 0.0, 0.0 );
|
QTransform m( 1.0, 0.0, 0.0, -1.0, 0.0, 0.0 );
|
||||||
this->setMatrix( m );
|
this->setTransform( m );
|
||||||
this->setBackgroundBrush( QBrush( backgroundColor ) );
|
this->setBackgroundBrush( QBrush( backgroundColor ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ class ArrangementDemoPropertiesDialog : public QDialog
|
||||||
};
|
};
|
||||||
|
|
||||||
ArrangementDemoPropertiesDialog( ArrangementDemoWindow* parent_ = 0,
|
ArrangementDemoPropertiesDialog( ArrangementDemoWindow* parent_ = 0,
|
||||||
Qt::WindowFlags f = 0 );
|
Qt::WindowFlags f = Qt::WindowType(0));
|
||||||
QVariant property( int index );
|
QVariant property( int index );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ namespace Ui
|
||||||
class NewTabDialog : public QDialog
|
class NewTabDialog : public QDialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NewTabDialog( QWidget* parent = 0, Qt::WindowFlags f = 0 );
|
NewTabDialog( QWidget* parent = 0, Qt::WindowFlags f = Qt::WindowType(0) );
|
||||||
int checkedId( ) const;
|
int checkedId( ) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ class OverlayDialog : public QDialog
|
||||||
ARRANGEMENT = 32
|
ARRANGEMENT = 32
|
||||||
} OverlayDialogRole;
|
} OverlayDialogRole;
|
||||||
|
|
||||||
OverlayDialog( ArrangementDemoWindow* parent, Qt::WindowFlags f = 0 );
|
OverlayDialog( ArrangementDemoWindow* parent, Qt::WindowFlags f = Qt::WindowType(0) );
|
||||||
|
|
||||||
std::vector< CGAL::Object > selectedArrangements( ) const;
|
std::vector< CGAL::Object > selectedArrangements( ) const;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,7 @@ MainWindow::MainWindow()
|
||||||
this->graphicsView->setMouseTracking(true);
|
this->graphicsView->setMouseTracking(true);
|
||||||
|
|
||||||
// Turn the vertical axis upside down
|
// Turn the vertical axis upside down
|
||||||
this->graphicsView->matrix().scale(1, -1);
|
this->graphicsView->transform().scale(1, -1);
|
||||||
|
|
||||||
// The navigation adds zooming and translation functionality to the
|
// The navigation adds zooming and translation functionality to the
|
||||||
// QGraphicsView
|
// QGraphicsView
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,7 @@ MainWindow::MainWindow()
|
||||||
this->graphicsView->setMouseTracking(true);
|
this->graphicsView->setMouseTracking(true);
|
||||||
|
|
||||||
// Turn the vertical axis upside down
|
// Turn the vertical axis upside down
|
||||||
this->graphicsView->matrix().scale(1, -1);
|
this->graphicsView->transform().scale(1, -1);
|
||||||
|
|
||||||
// The navigation adds zooming and translation functionality to the
|
// The navigation adds zooming and translation functionality to the
|
||||||
// QGraphicsView
|
// QGraphicsView
|
||||||
|
|
|
||||||
|
|
@ -208,7 +208,7 @@ MainWindow::MainWindow()
|
||||||
this->graphicsView->setMouseTracking(true);
|
this->graphicsView->setMouseTracking(true);
|
||||||
|
|
||||||
// Turn the vertical axis upside down
|
// Turn the vertical axis upside down
|
||||||
this->graphicsView->matrix().scale(1, -1);
|
this->graphicsView->transform().scale(1, -1);
|
||||||
|
|
||||||
// The navigation adds zooming and translation functionality to the
|
// The navigation adds zooming and translation functionality to the
|
||||||
// QGraphicsView
|
// QGraphicsView
|
||||||
|
|
|
||||||
|
|
@ -178,7 +178,7 @@ MainWindow::MainWindow()
|
||||||
this->graphicsView->setMouseTracking(true);
|
this->graphicsView->setMouseTracking(true);
|
||||||
|
|
||||||
// Turn the vertical axis upside down
|
// Turn the vertical axis upside down
|
||||||
this->graphicsView->matrix().scale(1, -1);
|
this->graphicsView->transform().scale(1, -1);
|
||||||
|
|
||||||
// The navigation adds zooming and translation functionality to the
|
// The navigation adds zooming and translation functionality to the
|
||||||
// QGraphicsView
|
// QGraphicsView
|
||||||
|
|
|
||||||
|
|
@ -181,7 +181,7 @@ MainWindow::MainWindow()
|
||||||
this->graphicsView->setMouseTracking(true);
|
this->graphicsView->setMouseTracking(true);
|
||||||
|
|
||||||
// Turn the vertical axis upside down
|
// Turn the vertical axis upside down
|
||||||
this->graphicsView->matrix().scale(1, -1);
|
this->graphicsView->transform().scale(1, -1);
|
||||||
|
|
||||||
// The navigation adds zooming and translation functionality to the
|
// The navigation adds zooming and translation functionality to the
|
||||||
// QGraphicsView
|
// QGraphicsView
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,7 @@ MainWindow::MainWindow()
|
||||||
scene.setItemIndexMethod(QGraphicsScene::NoIndex);
|
scene.setItemIndexMethod(QGraphicsScene::NoIndex);
|
||||||
this->graphicsView->setScene(&scene);
|
this->graphicsView->setScene(&scene);
|
||||||
// Turn the vertical axis upside down
|
// Turn the vertical axis upside down
|
||||||
this->graphicsView->matrix().scale(1, -1);
|
this->graphicsView->transform().scale(1, -1);
|
||||||
this->graphicsView->setMouseTracking(true);
|
this->graphicsView->setMouseTracking(true);
|
||||||
|
|
||||||
rgi = new CGAL::Qt::RegularGridGraphicsItem<K>(delta, delta);
|
rgi = new CGAL::Qt::RegularGridGraphicsItem<K>(delta, delta);
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ MainWindow::MainWindow()
|
||||||
this->graphicsView->setScene(&scene);
|
this->graphicsView->setScene(&scene);
|
||||||
|
|
||||||
// Turn the vertical axis upside down
|
// Turn the vertical axis upside down
|
||||||
this->graphicsView->matrix().scale(1, -1);
|
this->graphicsView->transform().scale(1, -1);
|
||||||
|
|
||||||
// The navigation adds zooming and translation functionality to the
|
// The navigation adds zooming and translation functionality to the
|
||||||
// QGraphicsView
|
// QGraphicsView
|
||||||
|
|
|
||||||
|
|
@ -171,7 +171,7 @@ MainWindow::MainWindow()
|
||||||
this->graphicsView->setMouseTracking(true);
|
this->graphicsView->setMouseTracking(true);
|
||||||
|
|
||||||
// Turn the vertical axis upside down
|
// Turn the vertical axis upside down
|
||||||
this->graphicsView->matrix().scale(1, -1);
|
this->graphicsView->transform().scale(1, -1);
|
||||||
|
|
||||||
// The navigation adds zooming and translation functionality to the
|
// The navigation adds zooming and translation functionality to the
|
||||||
// QGraphicsView
|
// QGraphicsView
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,7 @@ MainWindow::MainWindow()
|
||||||
this->graphicsView->setMouseTracking(true);
|
this->graphicsView->setMouseTracking(true);
|
||||||
|
|
||||||
// Turn the vertical axis upside down
|
// Turn the vertical axis upside down
|
||||||
this->graphicsView->matrix().scale(1, -1);
|
this->graphicsView->transform().scale(1, -1);
|
||||||
|
|
||||||
// The navigation adds zooming and translation functionality to the
|
// The navigation adds zooming and translation functionality to the
|
||||||
// QGraphicsView
|
// QGraphicsView
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ private:
|
||||||
QMenu* getHelpMenu();
|
QMenu* getHelpMenu();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
DemosMainWindow (QWidget * parent = 0, ::Qt::WindowFlags flags = 0 );
|
DemosMainWindow (QWidget * parent = 0, ::Qt::WindowFlags flags = ::Qt::WindowType(0) );
|
||||||
~DemosMainWindow();
|
~DemosMainWindow();
|
||||||
void setupStatusBar();
|
void setupStatusBar();
|
||||||
void addNavigation(QGraphicsView*);
|
void addNavigation(QGraphicsView*);
|
||||||
|
|
|
||||||
|
|
@ -134,15 +134,12 @@ namespace Qt {
|
||||||
} // end case KeyRelease
|
} // end case KeyRelease
|
||||||
case QEvent::Wheel: {
|
case QEvent::Wheel: {
|
||||||
QWheelEvent *wheelEvent = static_cast<QWheelEvent*>(event);
|
QWheelEvent *wheelEvent = static_cast<QWheelEvent*>(event);
|
||||||
if(wheelEvent->orientation() != ::Qt::Vertical) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
double zoom_ratio = 240.0;
|
double zoom_ratio = 240.0;
|
||||||
if( (wheelEvent->modifiers() & ::Qt::ShiftModifier)
|
if( (wheelEvent->modifiers() & ::Qt::ShiftModifier)
|
||||||
|| (wheelEvent->modifiers() & ::Qt::ControlModifier) ) {
|
|| (wheelEvent->modifiers() & ::Qt::ControlModifier) ) {
|
||||||
zoom_ratio = 120.0;
|
zoom_ratio = 120.0;
|
||||||
}
|
}
|
||||||
scaleView(v, pow((double)2, -wheelEvent->delta() / zoom_ratio));
|
scaleView(v, pow((double)2, -wheelEvent->angleDelta().y() / zoom_ratio));
|
||||||
|
|
||||||
// display_parameters();
|
// display_parameters();
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -311,12 +308,12 @@ namespace Qt {
|
||||||
boost::format("matrix translation=(%1%, %2%)\n"
|
boost::format("matrix translation=(%1%, %2%)\n"
|
||||||
" rotation=(%3% - %4% )\n"
|
" rotation=(%3% - %4% )\n"
|
||||||
" (%5% - %6% )\n")
|
" (%5% - %6% )\n")
|
||||||
% v->matrix().dx()
|
% v->transform().dx()
|
||||||
% v->matrix().dy()
|
% v->transform().dy()
|
||||||
% v->matrix().m11()
|
% v->transform().m11()
|
||||||
% v->matrix().m12()
|
% v->transform().m12()
|
||||||
% v->matrix().m21()
|
% v->transform().m21()
|
||||||
% v->matrix().m22();
|
% v->transform().m22();
|
||||||
|
|
||||||
QRect vp_rect = v->viewport()->rect();
|
QRect vp_rect = v->viewport()->rect();
|
||||||
QPoint vp_top_left = vp_rect.topLeft();
|
QPoint vp_top_left = vp_rect.topLeft();
|
||||||
|
|
|
||||||
|
|
@ -421,7 +421,7 @@ void ManipulatedCameraFrame::wheelEvent(QWheelEvent *const event,
|
||||||
case MOVE_BACKWARD:
|
case MOVE_BACKWARD:
|
||||||
//#CONNECTION# mouseMoveEvent() MOVE_FORWARD case
|
//#CONNECTION# mouseMoveEvent() MOVE_FORWARD case
|
||||||
translate(
|
translate(
|
||||||
inverseTransformOf(Vec(0.0, 0.0, 0.2 * flySpeed() * event->delta())));
|
inverseTransformOf(Vec(0.0, 0.0, 0.2 * flySpeed() * event->angleDelta().y())));
|
||||||
Q_EMIT manipulated();
|
Q_EMIT manipulated();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -295,7 +295,7 @@ qreal ManipulatedFrame::deltaWithPrevPos(QMouseEvent *const event,
|
||||||
CGAL_INLINE_FUNCTION
|
CGAL_INLINE_FUNCTION
|
||||||
qreal ManipulatedFrame::wheelDelta(const QWheelEvent *event) const {
|
qreal ManipulatedFrame::wheelDelta(const QWheelEvent *event) const {
|
||||||
static const qreal WHEEL_SENSITIVITY_COEF = 8E-4;
|
static const qreal WHEEL_SENSITIVITY_COEF = 8E-4;
|
||||||
return event->delta() * wheelSensitivity() * WHEEL_SENSITIVITY_COEF;
|
return event->angleDelta().y() * wheelSensitivity() * WHEEL_SENSITIVITY_COEF;
|
||||||
}
|
}
|
||||||
|
|
||||||
CGAL_INLINE_FUNCTION
|
CGAL_INLINE_FUNCTION
|
||||||
|
|
|
||||||
|
|
@ -73,11 +73,11 @@ class CGAL_QT_EXPORT QGLViewer : public QOpenGLWidget, public QOpenGLFunctions {
|
||||||
public:
|
public:
|
||||||
//todo check if this is used. If not remove it
|
//todo check if this is used. If not remove it
|
||||||
explicit QGLViewer(QGLContext* context, QWidget *parent = 0,
|
explicit QGLViewer(QGLContext* context, QWidget *parent = 0,
|
||||||
::Qt::WindowFlags flags = 0);
|
::Qt::WindowFlags flags = ::Qt::WindowType(0));
|
||||||
explicit QGLViewer(QOpenGLContext* context, QWidget *parent = 0,
|
explicit QGLViewer(QOpenGLContext* context, QWidget *parent = 0,
|
||||||
::Qt::WindowFlags flags = 0);
|
::Qt::WindowFlags flags = ::Qt::WindowType(0));
|
||||||
explicit QGLViewer(QWidget *parent = 0,
|
explicit QGLViewer(QWidget *parent = 0,
|
||||||
::Qt::WindowFlags flags = 0);
|
::Qt::WindowFlags flags = ::Qt::WindowType(0));
|
||||||
|
|
||||||
virtual ~QGLViewer();
|
virtual ~QGLViewer();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -207,7 +207,7 @@ MainWindow::MainWindow()
|
||||||
this->graphicsView->shear(230, 230);
|
this->graphicsView->shear(230, 230);
|
||||||
|
|
||||||
// Turn the vertical axis upside down
|
// Turn the vertical axis upside down
|
||||||
this->graphicsView->matrix().scale(1, -1);
|
this->graphicsView->transform().scale(1, -1);
|
||||||
|
|
||||||
// The navigation adds zooming and translation functionality to the
|
// The navigation adds zooming and translation functionality to the
|
||||||
// QGraphicsView
|
// QGraphicsView
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ void GlViewer::paintGL()
|
||||||
void GlViewer::wheelEvent(QWheelEvent *event)
|
void GlViewer::wheelEvent(QWheelEvent *event)
|
||||||
{
|
{
|
||||||
if (!m_scene) return;
|
if (!m_scene) return;
|
||||||
m_scale += 0.05 * (event->delta() / 120);
|
m_scale += 0.05 * (event->angleDelta().y() / 120);
|
||||||
if (m_scale <= 0.0) m_scale = 0.0;
|
if (m_scale <= 0.0) m_scale = 0.0;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
#include <CGAL/Three/Scene_item.h>
|
#include <CGAL/Three/Scene_item.h>
|
||||||
#include <CGAL/Three/TextRenderer.h>
|
#include <CGAL/Three/TextRenderer.h>
|
||||||
#include <CGAL/Three/exceptions.h>
|
#include <CGAL/Three/exceptions.h>
|
||||||
|
#include <CGAL/Three/Three.h>
|
||||||
#include <CGAL/Qt/debug.h>
|
#include <CGAL/Qt/debug.h>
|
||||||
#include <CGAL/double.h>
|
#include <CGAL/double.h>
|
||||||
|
|
||||||
|
|
@ -401,6 +402,7 @@ MainWindow::MainWindow(const QStringList &keywords, bool verbose, QWidget* paren
|
||||||
objectValue);
|
objectValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
filterOperations(true);
|
||||||
// debugger->action(QScriptEngineDebugger::InterruptAction)->trigger();
|
// debugger->action(QScriptEngineDebugger::InterruptAction)->trigger();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
@ -408,16 +410,22 @@ MainWindow::MainWindow(const QStringList &keywords, bool verbose, QWidget* paren
|
||||||
void addActionToMenu(QAction* action, QMenu* menu)
|
void addActionToMenu(QAction* action, QMenu* menu)
|
||||||
{
|
{
|
||||||
bool added = false;
|
bool added = false;
|
||||||
|
QString atxt = action->text().remove("&");
|
||||||
|
if(atxt.isEmpty())
|
||||||
|
return;
|
||||||
for(QAction* it : menu->actions())
|
for(QAction* it : menu->actions())
|
||||||
{
|
{
|
||||||
QString atxt = action->text().remove("&"),
|
QString btxt = it->text().remove("&");
|
||||||
btxt = it->text().remove("&");
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while(atxt[i] == btxt[i]
|
if(btxt.isEmpty())
|
||||||
&& i < atxt.size()
|
{
|
||||||
&& i < btxt.size())
|
continue;
|
||||||
|
}
|
||||||
|
while(i < atxt.size()
|
||||||
|
&& i < btxt.size()
|
||||||
|
&& atxt[i] == btxt[i])
|
||||||
++i;
|
++i;
|
||||||
bool res = (atxt[i] < btxt[i]);
|
bool res = (i == atxt.size() || i == btxt.size() || atxt[i] < btxt[i]);
|
||||||
if (res)
|
if (res)
|
||||||
{
|
{
|
||||||
menu->insertAction(it, action);
|
menu->insertAction(it, action);
|
||||||
|
|
@ -490,12 +498,12 @@ void MainWindow::filterOperations(bool)
|
||||||
menu->removeAction(action);
|
menu->removeAction(action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_FOREACH(QAction* action, action_menu_map.keys())
|
Q_FOREACH(QAction* action, action_menu_map.keys())
|
||||||
{
|
{
|
||||||
QMenu* menu = action_menu_map[action];
|
QMenu* menu = action_menu_map[action];
|
||||||
addActionToMenu(action, menu);
|
addActionToMenu(action, menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString filter=operationSearchBar.text();
|
QString filter=operationSearchBar.text();
|
||||||
Q_FOREACH(const PluginNamePair& p, plugins) {
|
Q_FOREACH(const PluginNamePair& p, plugins) {
|
||||||
Q_FOREACH(QAction* action, p.first->actions()) {
|
Q_FOREACH(QAction* action, p.first->actions()) {
|
||||||
|
|
@ -765,7 +773,7 @@ void MainWindow::loadPlugins()
|
||||||
qputenv("PATH", new_path);
|
qputenv("PATH", new_path);
|
||||||
#endif
|
#endif
|
||||||
Q_FOREACH (QString pluginsDir,
|
Q_FOREACH (QString pluginsDir,
|
||||||
env_path.split(separator, QString::SkipEmptyParts)) {
|
env_path.split(separator, CGAL_QT_SKIP_EMPTY_PARTS)) {
|
||||||
QDir dir(pluginsDir);
|
QDir dir(pluginsDir);
|
||||||
if(dir.isReadable())
|
if(dir.isReadable())
|
||||||
plugins_directories << dir;
|
plugins_directories << dir;
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
#include "Scene_polylines_item.h"
|
#include "Scene_polylines_item.h"
|
||||||
#include <CGAL/subdivision_method_3.h>
|
#include <CGAL/subdivision_method_3.h>
|
||||||
#include <CGAL/Kernel_traits.h>
|
#include <CGAL/Kernel_traits.h>
|
||||||
|
#include <CGAL/Three/Three.h>
|
||||||
#include "ui_Basic_generator_widget.h"
|
#include "ui_Basic_generator_widget.h"
|
||||||
|
|
||||||
class GeneratorWidget :
|
class GeneratorWidget :
|
||||||
|
|
@ -350,8 +351,7 @@ void Basic_generator_plugin::generateCube()
|
||||||
|
|
||||||
for(int i=0; i<8; ++i)
|
for(int i=0; i<8; ++i)
|
||||||
{
|
{
|
||||||
|
QStringList list = point_texts[i].split(QRegExp("\\s+"), CGAL_QT_SKIP_EMPTY_PARTS);
|
||||||
QStringList list = point_texts[i].split(QRegExp("\\s+"), QString::SkipEmptyParts);
|
|
||||||
if (list.isEmpty()) return;
|
if (list.isEmpty()) return;
|
||||||
if (list.size()!=3){
|
if (list.size()!=3){
|
||||||
QMessageBox *msgBox = new QMessageBox;
|
QMessageBox *msgBox = new QMessageBox;
|
||||||
|
|
@ -392,7 +392,7 @@ void Basic_generator_plugin::generateCube()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QString text = dock_widget->extremaEdit->text();
|
QString text = dock_widget->extremaEdit->text();
|
||||||
QStringList list = text.split(QRegExp("\\s+"), QString::SkipEmptyParts);
|
QStringList list = text.split(QRegExp("\\s+"), CGAL_QT_SKIP_EMPTY_PARTS);
|
||||||
if (list.isEmpty()) return;
|
if (list.isEmpty()) return;
|
||||||
if (list.size()!=6){
|
if (list.size()!=6){
|
||||||
QMessageBox *msgBox = new QMessageBox;
|
QMessageBox *msgBox = new QMessageBox;
|
||||||
|
|
@ -443,7 +443,7 @@ void Basic_generator_plugin::generatePrism()
|
||||||
bool is_closed = dock_widget->prismCheckBox->isChecked();
|
bool is_closed = dock_widget->prismCheckBox->isChecked();
|
||||||
|
|
||||||
QString text = dock_widget->prism_lineEdit->text();
|
QString text = dock_widget->prism_lineEdit->text();
|
||||||
QStringList list = text.split(QRegExp("\\s+"), QString::SkipEmptyParts);
|
QStringList list = text.split(QRegExp("\\s+"), CGAL_QT_SKIP_EMPTY_PARTS);
|
||||||
if (list.isEmpty()) return;
|
if (list.isEmpty()) return;
|
||||||
if (list.size()!=3){
|
if (list.size()!=3){
|
||||||
QMessageBox *msgBox = new QMessageBox;
|
QMessageBox *msgBox = new QMessageBox;
|
||||||
|
|
@ -490,7 +490,7 @@ void Basic_generator_plugin::generatePyramid()
|
||||||
bool is_closed = dock_widget->pyramidCheckBox->isChecked();
|
bool is_closed = dock_widget->pyramidCheckBox->isChecked();
|
||||||
|
|
||||||
QString text = dock_widget->pyramid_lineEdit->text();
|
QString text = dock_widget->pyramid_lineEdit->text();
|
||||||
QStringList list = text.split(QRegExp("\\s+"), QString::SkipEmptyParts);
|
QStringList list = text.split(QRegExp("\\s+"), CGAL_QT_SKIP_EMPTY_PARTS);
|
||||||
if (list.isEmpty()) return;
|
if (list.isEmpty()) return;
|
||||||
if (list.size()!=3){
|
if (list.size()!=3){
|
||||||
QMessageBox *msgBox = new QMessageBox;
|
QMessageBox *msgBox = new QMessageBox;
|
||||||
|
|
@ -533,7 +533,7 @@ void Basic_generator_plugin::generateSphere()
|
||||||
{
|
{
|
||||||
int precision = dock_widget->SphereSpinBox->value();
|
int precision = dock_widget->SphereSpinBox->value();
|
||||||
QString text = dock_widget->center_radius_lineEdit->text();
|
QString text = dock_widget->center_radius_lineEdit->text();
|
||||||
QStringList list = text.split(QRegExp("\\s+"), QString::SkipEmptyParts);
|
QStringList list = text.split(QRegExp("\\s+"), CGAL_QT_SKIP_EMPTY_PARTS);
|
||||||
if (list.isEmpty()) return;
|
if (list.isEmpty()) return;
|
||||||
if (list.size()!=4){
|
if (list.size()!=4){
|
||||||
QMessageBox *msgBox = new QMessageBox;
|
QMessageBox *msgBox = new QMessageBox;
|
||||||
|
|
@ -582,8 +582,7 @@ void Basic_generator_plugin::generateTetrahedron()
|
||||||
|
|
||||||
for(int i=0; i<4; ++i)
|
for(int i=0; i<4; ++i)
|
||||||
{
|
{
|
||||||
|
QStringList list = point_texts[i].split(QRegExp("\\s+"), CGAL_QT_SKIP_EMPTY_PARTS);
|
||||||
QStringList list = point_texts[i].split(QRegExp("\\s+"), QString::SkipEmptyParts);
|
|
||||||
if (list.isEmpty()) return;
|
if (list.isEmpty()) return;
|
||||||
if (list.size()!=3){
|
if (list.size()!=3){
|
||||||
QMessageBox *msgBox = new QMessageBox;
|
QMessageBox *msgBox = new QMessageBox;
|
||||||
|
|
@ -624,7 +623,7 @@ void Basic_generator_plugin::generatePoints()
|
||||||
{
|
{
|
||||||
QString text = dock_widget->point_textEdit->toPlainText();
|
QString text = dock_widget->point_textEdit->toPlainText();
|
||||||
Scene_points_with_normal_item* item = new Scene_points_with_normal_item();
|
Scene_points_with_normal_item* item = new Scene_points_with_normal_item();
|
||||||
QStringList list = text.split(QRegExp("\\s+"), QString::SkipEmptyParts);
|
QStringList list = text.split(QRegExp("\\s+"), CGAL_QT_SKIP_EMPTY_PARTS);
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
double coord[3];
|
double coord[3];
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
|
|
@ -682,7 +681,8 @@ void Basic_generator_plugin::generateLines()
|
||||||
polylines.resize(polylines.size()+1);
|
polylines.resize(polylines.size()+1);
|
||||||
std::vector<Scene_polylines_item::Point_3>& polyline = *(polylines.rbegin());
|
std::vector<Scene_polylines_item::Point_3>& polyline = *(polylines.rbegin());
|
||||||
QStringList polylines_metadata;
|
QStringList polylines_metadata;
|
||||||
QStringList list = text.split(QRegExp("\\s+"), QString::SkipEmptyParts);
|
|
||||||
|
QStringList list = text.split(QRegExp("\\s+"), CGAL_QT_SKIP_EMPTY_PARTS);
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
double coord[3];
|
double coord[3];
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
|
|
@ -782,7 +782,7 @@ void Basic_generator_plugin::generateGrid()
|
||||||
bool triangulated = dock_widget->grid_checkBox->isChecked();
|
bool triangulated = dock_widget->grid_checkBox->isChecked();
|
||||||
points_text= dock_widget->grid_lineEdit->text();
|
points_text= dock_widget->grid_lineEdit->text();
|
||||||
|
|
||||||
QStringList list = points_text.split(QRegExp("\\s+"), QString::SkipEmptyParts);
|
QStringList list = points_text.split(QRegExp("\\s+"), CGAL_QT_SKIP_EMPTY_PARTS);
|
||||||
if (list.isEmpty()) return;
|
if (list.isEmpty()) return;
|
||||||
if (list.size()!=6){
|
if (list.size()!=6){
|
||||||
QMessageBox *msgBox = new QMessageBox;
|
QMessageBox *msgBox = new QMessageBox;
|
||||||
|
|
|
||||||
|
|
@ -249,12 +249,17 @@ protected:
|
||||||
}
|
}
|
||||||
case QEvent::Wheel: {
|
case QEvent::Wheel: {
|
||||||
QWheelEvent* event = static_cast<QWheelEvent*>(ev);
|
QWheelEvent* event = static_cast<QWheelEvent*>(ev);
|
||||||
QPointF old_pos = v->mapToScene(event->pos());
|
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
||||||
if(event->delta() <0)
|
QPoint pos = event->pos();
|
||||||
|
#else
|
||||||
|
QPointF pos = event->position();
|
||||||
|
#endif
|
||||||
|
QPointF old_pos = v->mapToScene(pos.x(), pos.y());
|
||||||
|
if(event->angleDelta().y() <0)
|
||||||
v->scale(1.2, 1.2);
|
v->scale(1.2, 1.2);
|
||||||
else
|
else
|
||||||
v->scale(0.8, 0.8);
|
v->scale(0.8, 0.8);
|
||||||
QPointF new_pos = v->mapToScene(event->pos());
|
QPointF new_pos = v->mapToScene(pos.x(), pos.y());
|
||||||
QPointF delta = new_pos - old_pos;
|
QPointF delta = new_pos - old_pos;
|
||||||
v->translate(delta.x(), delta.y());
|
v->translate(delta.x(), delta.y());
|
||||||
v->update();
|
v->update();
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ public :
|
||||||
if(event->type() == QEvent::Wheel && ctrl_pressing)
|
if(event->type() == QEvent::Wheel && ctrl_pressing)
|
||||||
{
|
{
|
||||||
QWheelEvent *mouseEvent = static_cast<QWheelEvent*>(event);
|
QWheelEvent *mouseEvent = static_cast<QWheelEvent*>(event);
|
||||||
int steps = mouseEvent->delta() / 120;
|
int steps = mouseEvent->angleDelta().y() / 120;
|
||||||
if (steps > 0)
|
if (steps > 0)
|
||||||
length_+=tick;
|
length_+=tick;
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -708,7 +708,7 @@ protected:
|
||||||
{
|
{
|
||||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
QWheelEvent *mouseEvent = static_cast<QWheelEvent*>(event);
|
QWheelEvent *mouseEvent = static_cast<QWheelEvent*>(event);
|
||||||
int steps = mouseEvent->delta() / 120;
|
int steps = mouseEvent->angleDelta().y() / 120;
|
||||||
if (steps > 0)
|
if (steps > 0)
|
||||||
neighborhood.point_set (point_set_item).expand();
|
neighborhood.point_set (point_set_item).expand();
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -143,12 +143,17 @@ protected:
|
||||||
}
|
}
|
||||||
case QEvent::Wheel: {
|
case QEvent::Wheel: {
|
||||||
QWheelEvent* event = static_cast<QWheelEvent*>(ev);
|
QWheelEvent* event = static_cast<QWheelEvent*>(ev);
|
||||||
QPointF old_pos = v->mapToScene(event->pos());
|
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
||||||
if(event->delta() <0)
|
QPoint pos = event->pos();
|
||||||
|
#else
|
||||||
|
QPointF pos = event->position();
|
||||||
|
#endif
|
||||||
|
QPointF old_pos = v->mapToScene(pos.x(), pos.y());
|
||||||
|
if(event->angleDelta().y() <0)
|
||||||
v->scale(1.2, 1.2);
|
v->scale(1.2, 1.2);
|
||||||
else
|
else
|
||||||
v->scale(0.8, 0.8);
|
v->scale(0.8, 0.8);
|
||||||
QPointF new_pos = v->mapToScene(event->pos());
|
QPointF new_pos = v->mapToScene(pos.x(), pos.y());
|
||||||
QPointF delta = new_pos - old_pos;
|
QPointF delta = new_pos - old_pos;
|
||||||
v->translate(delta.x(), delta.y());
|
v->translate(delta.x(), delta.y());
|
||||||
v->update();
|
v->update();
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ struct State{
|
||||||
class UVProjector:public QWidget
|
class UVProjector:public QWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
UVProjector(QWidget* parent = 0, Qt::WindowFlags flags =0)
|
UVProjector(QWidget* parent = 0, Qt::WindowFlags flags = Qt::WindowType(0))
|
||||||
:QWidget(parent,flags)
|
:QWidget(parent,flags)
|
||||||
{
|
{
|
||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
|
|
@ -108,7 +108,7 @@ protected:
|
||||||
}
|
}
|
||||||
void wheelEvent(QWheelEvent *event)
|
void wheelEvent(QWheelEvent *event)
|
||||||
{
|
{
|
||||||
if(event->delta() >0)
|
if(event->angleDelta().y() >0)
|
||||||
translation[2] *= 1.2;
|
translation[2] *= 1.2;
|
||||||
else
|
else
|
||||||
translation[2] /= 1.2;
|
translation[2] /= 1.2;
|
||||||
|
|
|
||||||
|
|
@ -885,7 +885,7 @@ bool Scene_edit_polyhedron_item::eventFilter(QObject* /*target*/, QEvent *event)
|
||||||
&&d->state.shift_pressing)
|
&&d->state.shift_pressing)
|
||||||
{
|
{
|
||||||
QWheelEvent *w_event = static_cast<QWheelEvent*>(event);
|
QWheelEvent *w_event = static_cast<QWheelEvent*>(event);
|
||||||
int steps = w_event->delta() / 120;
|
int steps = w_event->angleDelta().y() / 120;
|
||||||
d->expand_or_reduce(steps, d->sm_item->polyhedron());
|
d->expand_or_reduce(steps, d->sm_item->polyhedron());
|
||||||
}
|
}
|
||||||
if(event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonRelease)
|
if(event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonRelease)
|
||||||
|
|
|
||||||
|
|
@ -852,7 +852,7 @@ void Viewer::postSelection(const QPoint& pixel)
|
||||||
}
|
}
|
||||||
bool CGAL::Three::Viewer_interface::readFrame(QString s, CGAL::qglviewer::Frame& frame)
|
bool CGAL::Three::Viewer_interface::readFrame(QString s, CGAL::qglviewer::Frame& frame)
|
||||||
{
|
{
|
||||||
QStringList list = s.split(" ", QString::SkipEmptyParts);
|
QStringList list = s.split(" ", CGAL_QT_SKIP_EMPTY_PARTS);
|
||||||
if(list.size() != 7)
|
if(list.size() != 7)
|
||||||
return false;
|
return false;
|
||||||
float vec[3];
|
float vec[3];
|
||||||
|
|
@ -1422,7 +1422,7 @@ void Viewer::wheelEvent(QWheelEvent* e)
|
||||||
{
|
{
|
||||||
if(e->modifiers().testFlag(Qt::ShiftModifier))
|
if(e->modifiers().testFlag(Qt::ShiftModifier))
|
||||||
{
|
{
|
||||||
double delta = e->delta();
|
double delta = e->angleDelta().y();
|
||||||
if(delta>0)
|
if(delta>0)
|
||||||
{
|
{
|
||||||
switch(camera()->type())
|
switch(camera()->type())
|
||||||
|
|
@ -1781,7 +1781,7 @@ void Viewer::setLighting()
|
||||||
connect(dialog->position_lineEdit, &QLineEdit::editingFinished,
|
connect(dialog->position_lineEdit, &QLineEdit::editingFinished,
|
||||||
[this, dialog]()
|
[this, dialog]()
|
||||||
{
|
{
|
||||||
QStringList list = dialog->position_lineEdit->text().split(QRegExp(","), QString::SkipEmptyParts);
|
QStringList list = dialog->position_lineEdit->text().split(QRegExp(","), CGAL_QT_SKIP_EMPTY_PARTS);
|
||||||
if (list.isEmpty()) return;
|
if (list.isEmpty()) return;
|
||||||
if (list.size()!=3){
|
if (list.size()!=3){
|
||||||
QMessageBox *msgBox = new QMessageBox;
|
QMessageBox *msgBox = new QMessageBox;
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,9 @@
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QDoubleValidator>
|
#include <QDoubleValidator>
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||||
|
#include <QRandomGenerator>
|
||||||
|
#endif
|
||||||
|
|
||||||
Values_delegate::Values_delegate(QWidget* parent) : QItemDelegate(parent) {}
|
Values_delegate::Values_delegate(QWidget* parent) : QItemDelegate(parent) {}
|
||||||
void Values_delegate::paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const
|
void Values_delegate::paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const
|
||||||
|
|
@ -240,7 +243,12 @@ void Values_list::addValue(const double i)
|
||||||
newItem->setData(Value, Qt::CheckStateRole, Qt::Checked);
|
newItem->setData(Value, Qt::CheckStateRole, Qt::Checked);
|
||||||
newItem->setData(Value, Qt::DisplayRole, i);
|
newItem->setData(Value, Qt::DisplayRole, i);
|
||||||
QStringList colors = QColor::colorNames();
|
QStringList colors = QColor::colorNames();
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
|
||||||
const int color_index = qrand() % colors.size();
|
const int color_index = qrand() % colors.size();
|
||||||
|
#else
|
||||||
|
const int color_index = QRandomGenerator::global()->generate() % colors.size();
|
||||||
|
#endif
|
||||||
|
|
||||||
QColor color = QColor(colors[color_index]);
|
QColor color = QColor(colors[color_index]);
|
||||||
newItem->setData(Color, Qt::DisplayRole, color);
|
newItem->setData(Color, Qt::DisplayRole, color);
|
||||||
newItem->setData(Name, Qt::DisplayRole, "");
|
newItem->setData(Name, Qt::DisplayRole, "");
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,15 @@
|
||||||
# define THREE_EXPORT Q_DECL_IMPORT
|
# define THREE_EXPORT Q_DECL_IMPORT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||||
|
#define CGAL_QT_SKIP_EMPTY_PARTS QString::SkipEmptyParts
|
||||||
|
#else
|
||||||
|
#define CGAL_QT_SKIP_EMPTY_PARTS ::Qt::SkipEmptyParts
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace CGAL{
|
namespace CGAL{
|
||||||
namespace Three{
|
namespace Three{
|
||||||
|
//define enum depending on Qt version
|
||||||
class Polyhedron_demo_plugin_interface;
|
class Polyhedron_demo_plugin_interface;
|
||||||
class THREE_EXPORT Three{
|
class THREE_EXPORT Three{
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -2151,7 +2151,7 @@ void Viewer::wheelEvent(QWheelEvent *event)
|
||||||
// note: most mouse types work in steps of 15 degrees
|
// note: most mouse types work in steps of 15 degrees
|
||||||
// positive value: rotate forwards away from the user;
|
// positive value: rotate forwards away from the user;
|
||||||
// negative value: rotate backwards toward the user.
|
// negative value: rotate backwards toward the user.
|
||||||
m_fRadius += (event->delta()*1.f / m_iStep ); // inc-/decrease by 0.1 per step
|
m_fRadius += (event->angleDelta().y()*1.f / m_iStep ); // inc-/decrease by 0.1 per step
|
||||||
if( m_fRadius < 0.1f )
|
if( m_fRadius < 0.1f )
|
||||||
m_fRadius = 0.1f;
|
m_fRadius = 0.1f;
|
||||||
|
|
||||||
|
|
@ -2166,7 +2166,7 @@ void Viewer::wheelEvent(QWheelEvent *event)
|
||||||
// positive value: rotate forwards away from the user;
|
// positive value: rotate forwards away from the user;
|
||||||
// negative value: rotate backwards toward the user.
|
// negative value: rotate backwards toward the user.
|
||||||
float origR = m_fRadius;
|
float origR = m_fRadius;
|
||||||
m_fRadius += (event->delta()*1.f / m_iStep ); // inc-/decrease by 0.1 per step
|
m_fRadius += (event->angleDelta().y()*1.f / m_iStep ); // inc-/decrease by 0.1 per step
|
||||||
if( m_fRadius < 0.1f )
|
if( m_fRadius < 0.1f )
|
||||||
m_fRadius = 0.1f;
|
m_fRadius = 0.1f;
|
||||||
// update the new point and its conflict region
|
// update the new point and its conflict region
|
||||||
|
|
@ -2185,7 +2185,7 @@ void Viewer::wheelEvent(QWheelEvent *event)
|
||||||
// resize the trackball when moving a point
|
// resize the trackball when moving a point
|
||||||
else if( m_curMode == MOVE && modifiers == Qt::SHIFT && m_isMoving ) {
|
else if( m_curMode == MOVE && modifiers == Qt::SHIFT && m_isMoving ) {
|
||||||
float origR = m_fRadius;
|
float origR = m_fRadius;
|
||||||
m_fRadius += (event->delta()*1.f / m_iStep ); // inc-/decrease by 0.1 per step
|
m_fRadius += (event->angleDelta().y()*1.f / m_iStep ); // inc-/decrease by 0.1 per step
|
||||||
if( m_fRadius < 0.1f )
|
if( m_fRadius < 0.1f )
|
||||||
m_fRadius = 0.1f;
|
m_fRadius = 0.1f;
|
||||||
origR = m_fRadius / origR;
|
origR = m_fRadius / origR;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue