diff --git a/AABB_tree/demo/AABB_tree/MainWindow.cpp b/AABB_tree/demo/AABB_tree/MainWindow.cpp index 8cd596d6bbc..636febda8ce 100644 --- a/AABB_tree/demo/AABB_tree/MainWindow.cpp +++ b/AABB_tree/demo/AABB_tree/MainWindow.cpp @@ -23,7 +23,7 @@ MainWindow::MainWindow(QWidget* parent) m_pViewer = ui->viewer; // does not save the state of the viewer - m_pViewer->setStateFileName(QString::null); + m_pViewer->setStateFileName(QString()); // accepts drop events setAcceptDrops(true); diff --git a/GraphicsView/include/CGAL/Qt/DemosMainWindow_impl.h b/GraphicsView/include/CGAL/Qt/DemosMainWindow_impl.h index 96403ac859b..74b869a915e 100644 --- a/GraphicsView/include/CGAL/Qt/DemosMainWindow_impl.h +++ b/GraphicsView/include/CGAL/Qt/DemosMainWindow_impl.h @@ -458,9 +458,8 @@ void DemosMainWindow::readState(QString groupname, Options /*what_to_save*/) settings.beginGroup(groupname); resize(settings.value("size", this->size()).toSize()); - QDesktopWidget* desktop = qApp->desktop(); QPoint pos = settings.value("pos", this->pos()).toPoint(); - if(desktop->availableGeometry(pos).contains(pos)) { + if(QGuiApplication::screenAt(pos)) { move(pos); } QByteArray mainWindowState = settings.value("state").toByteArray(); diff --git a/GraphicsView/include/CGAL/Qt/qglviewer_impl.h b/GraphicsView/include/CGAL/Qt/qglviewer_impl.h index 960bd473d2d..b9e7e8bc90e 100644 --- a/GraphicsView/include/CGAL/Qt/qglviewer_impl.h +++ b/GraphicsView/include/CGAL/Qt/qglviewer_impl.h @@ -1606,7 +1606,7 @@ CGAL_INLINE_FUNCTION QString CGAL::QGLViewer::mouseActionString(qglviewer::MouseAction ma) { switch (ma) { case CGAL::qglviewer::NO_MOUSE_ACTION: - return QString::null; + return QString(); case CGAL::qglviewer::ROTATE: return CGAL::QGLViewer::tr("Rotates", "ROTATE mouse action"); case CGAL::qglviewer::ZOOM: @@ -1632,14 +1632,14 @@ QString CGAL::QGLViewer::mouseActionString(qglviewer::MouseAction ma) { case CGAL::qglviewer::ZOOM_ON_REGION: return CGAL::QGLViewer::tr("Zooms on region for", "ZOOM_ON_REGION mouse action"); } - return QString::null; + return QString(); } CGAL_INLINE_FUNCTION QString CGAL::QGLViewer::clickActionString(CGAL::qglviewer::ClickAction ca) { switch (ca) { case CGAL::qglviewer::NO_CLICK_ACTION: - return QString::null; + return QString(); case CGAL::qglviewer::ZOOM_ON_PIXEL: return CGAL::QGLViewer::tr("Zooms on pixel", "ZOOM_ON_PIXEL click action"); case CGAL::qglviewer::ZOOM_TO_FIT: @@ -1664,7 +1664,7 @@ QString CGAL::QGLViewer::clickActionString(CGAL::qglviewer::ClickAction ca) { case CGAL::qglviewer::ALIGN_CAMERA: return CGAL::QGLViewer::tr("Aligns camera", "ALIGN_CAMERA click action"); } - return QString::null; + return QString(); } static QString keyString(unsigned int key) { @@ -1946,7 +1946,7 @@ void CGAL::QGLViewer::setKeyDescription(unsigned int key, QString description) { CGAL_INLINE_FUNCTION QString CGAL::QGLViewer::cameraPathKeysString() const { if (pathIndex_.isEmpty()) - return QString::null; + return QString(); QVector< ::Qt::Key> keys; keys.reserve(pathIndex_.count()); @@ -1954,7 +1954,7 @@ QString CGAL::QGLViewer::cameraPathKeysString() const { endi = pathIndex_.end(); i != endi; ++i) keys.push_back(i.key()); - qSort(keys); + std::sort(keys.begin(), keys.end()); QVector< ::Qt::Key>::const_iterator it = keys.begin(), end = keys.end(); QString res = keyString(*it); @@ -3546,7 +3546,7 @@ This is the name of the XML file where saveStateToFile() saves the viewer state restoreStateFromFile() to restore this state later (usually in your init() method). -Setting this value to \c QString::null will disable the automatic state file +Setting this value to \c QString() will disable the automatic state file saving that normally occurs on exit. If more than one viewer are created by the application, this function will @@ -3578,7 +3578,7 @@ Use restoreStateFromFile() to restore this viewer state. This method is automatically called when a viewer is closed (using Escape or using the window's upper right \c x close button). setStateFileName() to \c -QString::null to prevent this. */ +QString() to prevent this. */ CGAL_INLINE_FUNCTION void CGAL::QGLViewer::saveStateToFile() { QString name = stateFileName(); diff --git a/Polyhedron/demo/Polyhedron/MainWindow.cpp b/Polyhedron/demo/Polyhedron/MainWindow.cpp index 36244401da4..eefdf3532f3 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow.cpp @@ -152,7 +152,7 @@ MainWindow::MainWindow(const QStringList &keywords, bool verbose, QWidget* paren sceneView = ui->sceneView; viewer = ui->viewer; // do not save the state of the viewer (anoying) - viewer->setStateFileName(QString::null); + viewer->setStateFileName(QString()); // setup scene scene = new Scene(this); @@ -759,7 +759,7 @@ void MainWindow::updateMenus() } // sort the operations menu by name as = ui->menuOperations->actions(); - qSort(as.begin(), as.end(), actionsByName); + std::sort(as.begin(), as.end(), actionsByName); ui->menuOperations->clear(); ui->menuOperations->addAction(searchAction); ui->menuOperations->addActions(as); @@ -2354,9 +2354,9 @@ void MainWindow::on_actionLoadPlugin_triggered() void MainWindow::recurseExpand(QModelIndex index) { int row = index.row(); - if(index.child(0,0).isValid()) + if(scene->index(0,0,index).isValid()) { - recurseExpand(index.child(0,0)); + recurseExpand(scene->index(0,0,index)); } CGAL::Three::Scene_group_item* group = qobject_cast(scene->item(scene->getIdFromModelIndex(index))); @@ -2535,10 +2535,17 @@ void MainWindow::resetHeader() sceneView->header()->setSectionResizeMode(Scene::RenderingModeColumn, QHeaderView::ResizeToContents); sceneView->header()->setSectionResizeMode(Scene::ABColumn, QHeaderView::Fixed); sceneView->header()->setSectionResizeMode(Scene::VisibleColumn, QHeaderView::Fixed); +#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) + sceneView->header()->resizeSection(Scene::ColorColumn, sceneView->header()->fontMetrics().horizontalAdvance("_#_")); + sceneView->resizeColumnToContents(Scene::RenderingModeColumn); + sceneView->header()->resizeSection(Scene::ABColumn, sceneView->header()->fontMetrics().horizontalAdvance(QString("_AB_"))); + sceneView->header()->resizeSection(Scene::VisibleColumn, sceneView->header()->fontMetrics().horizontalAdvance(QString("_View_"))); +#else sceneView->header()->resizeSection(Scene::ColorColumn, sceneView->header()->fontMetrics().width("_#_")); sceneView->resizeColumnToContents(Scene::RenderingModeColumn); sceneView->header()->resizeSection(Scene::ABColumn, sceneView->header()->fontMetrics().width(QString("_AB_"))); sceneView->header()->resizeSection(Scene::VisibleColumn, sceneView->header()->fontMetrics().width(QString("_View_"))); +#endif } void MainWindow::reset_default_loaders() diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp index 907085acdd0..5ca92628bac 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp @@ -577,7 +577,11 @@ private: // Find the right width for the label to accommodate at least 9999 QFontMetrics metric = x_cubeLabel->fontMetrics(); +#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) + x_cubeLabel->setFixedWidth(metric.horizontalAdvance(QString(".9999."))); +#else x_cubeLabel->setFixedWidth(metric.width(QString(".9999."))); +#endif x_cubeLabel->setText("0"); x_cubeLabel->setValidator(validator); @@ -603,7 +607,11 @@ private: // Find the right width for the label to accommodate at least 9999 QFontMetrics metric = y_cubeLabel->fontMetrics(); +#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) + y_cubeLabel->setFixedWidth(metric.horizontalAdvance(QString(".9999."))); +#else y_cubeLabel->setFixedWidth(metric.width(QString(".9999."))); +#endif y_cubeLabel->setText("0"); y_cubeLabel->setValidator(validator); y_slider = new QSlider(mw); @@ -628,7 +636,11 @@ private: // Find the right width for the label to accommodate at least 9999 QFontMetrics metric = z_cubeLabel->fontMetrics(); +#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) + z_cubeLabel->setFixedWidth(metric.horizontalAdvance(QString(".9999."))); +#else z_cubeLabel->setFixedWidth(metric.width(QString(".9999."))); +#endif z_cubeLabel->setText("0"); z_cubeLabel->setValidator(validator); z_slider = new QSlider(mw); diff --git a/Polyhedron/demo/Polyhedron/Scene.cpp b/Polyhedron/demo/Polyhedron/Scene.cpp index 7994c82d144..d194b8ff16f 100644 --- a/Polyhedron/demo/Polyhedron/Scene.cpp +++ b/Polyhedron/demo/Polyhedron/Scene.cpp @@ -850,7 +850,7 @@ Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer) QList depths = picked_item_IDs.keys(); if(!depths.isEmpty()) { - qSort(depths); + std::sort(depths.begin(), depths.end()); int id = picked_item_IDs[depths.first()]; setSelectedItemIndex(id); viewer->setSelectedName(id); diff --git a/Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp b/Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp index c7b105536d8..9c79cc25e85 100644 --- a/Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp @@ -1482,7 +1482,7 @@ void Scene_c3t3_item_priv::computeIntersection(const Primitive& cell) typedef unsigned char UC; Tr::Cell_handle ch = cell.id(); - QColor c = this->colors_subdomains[ch->subdomain_index()].light(50); + QColor c = this->colors_subdomains[ch->subdomain_index()].lighter(50); const Tr::Bare_point& pa = wp2p(ch->vertex(0)->point()); const Tr::Bare_point& pb = wp2p(ch->vertex(1)->point()); diff --git a/Polyhedron/demo/Polyhedron/Viewer.cpp b/Polyhedron/demo/Polyhedron/Viewer.cpp index 728464c6133..76427a81afc 100644 --- a/Polyhedron/demo/Polyhedron/Viewer.cpp +++ b/Polyhedron/demo/Polyhedron/Viewer.cpp @@ -1008,7 +1008,13 @@ void Viewer::drawVisualHints() //Prints the displayMessage QFont font = QFont(); QFontMetrics fm(font); - TextItem *message_text = new TextItem(float(10 + fm.width(d->message)/2), + TextItem *message_text = new TextItem(float(10 + + #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) + fm.horizontalAdvance(d->message)/2) + #else + fm.width(d->message)/2) + #endif + , float(height()-20), 0, d->message, false, QFont(), Qt::gray ); diff --git a/Principal_component_analysis/demo/Principal_component_analysis/MainWindow.cpp b/Principal_component_analysis/demo/Principal_component_analysis/MainWindow.cpp index 1d9eaabc9d1..dba4802cfec 100644 --- a/Principal_component_analysis/demo/Principal_component_analysis/MainWindow.cpp +++ b/Principal_component_analysis/demo/Principal_component_analysis/MainWindow.cpp @@ -26,7 +26,7 @@ MainWindow::MainWindow(QWidget* parent) m_pViewer = ui->viewer; // does not save the state of the viewer - m_pViewer->setStateFileName(QString::null); + m_pViewer->setStateFileName(QString()); // accepts drop events setAcceptDrops(true); diff --git a/Three/include/CGAL/Three/TextRenderer.h b/Three/include/CGAL/Three/TextRenderer.h index d9c3417fd21..1c7905f3011 100644 --- a/Three/include/CGAL/Three/TextRenderer.h +++ b/Three/include/CGAL/Three/TextRenderer.h @@ -30,6 +30,7 @@ #include #include +#include class QVector3D; namespace CGAL{ @@ -60,7 +61,12 @@ public : :x(p_x), y(p_y), z(p_z),_3D(p_3D), _is_always_visible(always_visible), m_text(p_text), m_font(font), m_color(p_color) { QFontMetrics fm(m_font); - _width = float(fm.width(m_text)); +#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) + _width = float(fm.horizontalAdvance(m_text)+2); +#else + _width = float(fm.width(m_text)+2); +#endif + _height = float(fm.height()); } //!\brief Accessor for the string diff --git a/Triangulation_3/demo/Triangulation_3/Viewer.cpp b/Triangulation_3/demo/Triangulation_3/Viewer.cpp index 1bf46499f87..3d3f0d54ffb 100644 --- a/Triangulation_3/demo/Triangulation_3/Viewer.cpp +++ b/Triangulation_3/demo/Triangulation_3/Viewer.cpp @@ -1766,7 +1766,7 @@ void Viewer::endSelection(const QPoint& p) QList depths = picked_IDs.keys(); if(!depths.isEmpty()) { - qSort(depths); + std::sort(depths.begin(), depths.end()); id = picked_IDs[depths.first()]; picked = true; } @@ -2267,7 +2267,7 @@ void Viewer::keyPressEvent(QKeyEvent *event) else if( m_curMode == SELECT && event->key()==Qt::Key_Delete && modifiers==Qt::NoButton ) { // sort selected id's in descending order - qSort(m_vidSeled.begin(), m_vidSeled.end(), qGreater()); + std::sort(m_vidSeled.begin(), m_vidSeled.end(), std::greater()); for(QList::iterator vit=m_vidSeled.begin(); vit