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