More warnings fixed

This commit is contained in:
Maxime Gimeno 2019-07-10 14:02:06 +02:00
parent 6e1e8e9dc4
commit 1184530530
11 changed files with 53 additions and 23 deletions

View File

@ -23,7 +23,7 @@ MainWindow::MainWindow(QWidget* parent)
m_pViewer = ui->viewer; m_pViewer = ui->viewer;
// does not save the state of the viewer // does not save the state of the viewer
m_pViewer->setStateFileName(QString::null); m_pViewer->setStateFileName(QString());
// accepts drop events // accepts drop events
setAcceptDrops(true); setAcceptDrops(true);

View File

@ -461,9 +461,8 @@ void DemosMainWindow::readState(QString groupname, Options /*what_to_save*/)
settings.beginGroup(groupname); settings.beginGroup(groupname);
resize(settings.value("size", this->size()).toSize()); resize(settings.value("size", this->size()).toSize());
QDesktopWidget* desktop = qApp->desktop();
QPoint pos = settings.value("pos", this->pos()).toPoint(); QPoint pos = settings.value("pos", this->pos()).toPoint();
if(desktop->availableGeometry(pos).contains(pos)) { if(QGuiApplication::screenAt(pos)) {
move(pos); move(pos);
} }
QByteArray mainWindowState = settings.value("state").toByteArray(); QByteArray mainWindowState = settings.value("state").toByteArray();

View File

@ -1606,7 +1606,7 @@ CGAL_INLINE_FUNCTION
QString CGAL::QGLViewer::mouseActionString(qglviewer::MouseAction ma) { QString CGAL::QGLViewer::mouseActionString(qglviewer::MouseAction ma) {
switch (ma) { switch (ma) {
case CGAL::qglviewer::NO_MOUSE_ACTION: case CGAL::qglviewer::NO_MOUSE_ACTION:
return QString::null; return QString();
case CGAL::qglviewer::ROTATE: case CGAL::qglviewer::ROTATE:
return CGAL::QGLViewer::tr("Rotates", "ROTATE mouse action"); return CGAL::QGLViewer::tr("Rotates", "ROTATE mouse action");
case CGAL::qglviewer::ZOOM: case CGAL::qglviewer::ZOOM:
@ -1632,14 +1632,14 @@ QString CGAL::QGLViewer::mouseActionString(qglviewer::MouseAction ma) {
case CGAL::qglviewer::ZOOM_ON_REGION: case CGAL::qglviewer::ZOOM_ON_REGION:
return CGAL::QGLViewer::tr("Zooms on region for", "ZOOM_ON_REGION mouse action"); return CGAL::QGLViewer::tr("Zooms on region for", "ZOOM_ON_REGION mouse action");
} }
return QString::null; return QString();
} }
CGAL_INLINE_FUNCTION CGAL_INLINE_FUNCTION
QString CGAL::QGLViewer::clickActionString(CGAL::qglviewer::ClickAction ca) { QString CGAL::QGLViewer::clickActionString(CGAL::qglviewer::ClickAction ca) {
switch (ca) { switch (ca) {
case CGAL::qglviewer::NO_CLICK_ACTION: case CGAL::qglviewer::NO_CLICK_ACTION:
return QString::null; return QString();
case CGAL::qglviewer::ZOOM_ON_PIXEL: case CGAL::qglviewer::ZOOM_ON_PIXEL:
return CGAL::QGLViewer::tr("Zooms on pixel", "ZOOM_ON_PIXEL click action"); return CGAL::QGLViewer::tr("Zooms on pixel", "ZOOM_ON_PIXEL click action");
case CGAL::qglviewer::ZOOM_TO_FIT: case CGAL::qglviewer::ZOOM_TO_FIT:
@ -1664,7 +1664,7 @@ QString CGAL::QGLViewer::clickActionString(CGAL::qglviewer::ClickAction ca) {
case CGAL::qglviewer::ALIGN_CAMERA: case CGAL::qglviewer::ALIGN_CAMERA:
return CGAL::QGLViewer::tr("Aligns camera", "ALIGN_CAMERA click action"); return CGAL::QGLViewer::tr("Aligns camera", "ALIGN_CAMERA click action");
} }
return QString::null; return QString();
} }
static QString keyString(unsigned int key) { static QString keyString(unsigned int key) {
@ -1946,7 +1946,7 @@ void CGAL::QGLViewer::setKeyDescription(unsigned int key, QString description) {
CGAL_INLINE_FUNCTION CGAL_INLINE_FUNCTION
QString CGAL::QGLViewer::cameraPathKeysString() const { QString CGAL::QGLViewer::cameraPathKeysString() const {
if (pathIndex_.isEmpty()) if (pathIndex_.isEmpty())
return QString::null; return QString();
QVector< ::Qt::Key> keys; QVector< ::Qt::Key> keys;
keys.reserve(pathIndex_.count()); keys.reserve(pathIndex_.count());
@ -1954,7 +1954,7 @@ QString CGAL::QGLViewer::cameraPathKeysString() const {
endi = pathIndex_.end(); endi = pathIndex_.end();
i != endi; ++i) i != endi; ++i)
keys.push_back(i.key()); keys.push_back(i.key());
qSort(keys); std::sort(keys.begin(), keys.end());
QVector< ::Qt::Key>::const_iterator it = keys.begin(), end = keys.end(); QVector< ::Qt::Key>::const_iterator it = keys.begin(), end = keys.end();
QString res = keyString(*it); QString res = keyString(*it);
@ -3544,7 +3544,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() restoreStateFromFile() to restore this state later (usually in your init()
method). 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. saving that normally occurs on exit.
If more than one viewer are created by the application, this function will If more than one viewer are created by the application, this function will
@ -3576,7 +3576,7 @@ Use restoreStateFromFile() to restore this viewer state.
This method is automatically called when a viewer is closed (using Escape or 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 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 CGAL_INLINE_FUNCTION
void CGAL::QGLViewer::saveStateToFile() { void CGAL::QGLViewer::saveStateToFile() {
QString name = stateFileName(); QString name = stateFileName();

View File

@ -145,7 +145,7 @@ MainWindow::MainWindow(bool verbose, QWidget* parent)
sceneView = ui->sceneView; sceneView = ui->sceneView;
viewer = ui->viewer; viewer = ui->viewer;
// do not save the state of the viewer (anoying) // do not save the state of the viewer (anoying)
viewer->setStateFileName(QString::null); viewer->setStateFileName(QString());
// setup scene // setup scene
scene = new Scene(this); scene = new Scene(this);
@ -677,7 +677,7 @@ void MainWindow::updateMenus()
} }
// sort the operations menu by name // sort the operations menu by name
as = ui->menuOperations->actions(); as = ui->menuOperations->actions();
qSort(as.begin(), as.end(), actionsByName); std::sort(as.begin(), as.end(), actionsByName);
ui->menuOperations->clear(); ui->menuOperations->clear();
ui->menuOperations->addActions(as); ui->menuOperations->addActions(as);
} }
@ -1990,9 +1990,9 @@ void MainWindow::on_actionLoadPlugin_triggered()
void MainWindow::recurseExpand(QModelIndex index) void MainWindow::recurseExpand(QModelIndex index)
{ {
int row = index.row(); 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 = CGAL::Three::Scene_group_item* group =
qobject_cast<CGAL::Three::Scene_group_item*>(scene->item(scene->getIdFromModelIndex(index))); qobject_cast<CGAL::Three::Scene_group_item*>(scene->item(scene->getIdFromModelIndex(index)));
@ -2171,10 +2171,17 @@ void MainWindow::resetHeader()
sceneView->header()->setSectionResizeMode(Scene::RenderingModeColumn, QHeaderView::ResizeToContents); sceneView->header()->setSectionResizeMode(Scene::RenderingModeColumn, QHeaderView::ResizeToContents);
sceneView->header()->setSectionResizeMode(Scene::ABColumn, QHeaderView::Fixed); sceneView->header()->setSectionResizeMode(Scene::ABColumn, QHeaderView::Fixed);
sceneView->header()->setSectionResizeMode(Scene::VisibleColumn, 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->header()->resizeSection(Scene::ColorColumn, sceneView->header()->fontMetrics().width("_#_"));
sceneView->resizeColumnToContents(Scene::RenderingModeColumn); sceneView->resizeColumnToContents(Scene::RenderingModeColumn);
sceneView->header()->resizeSection(Scene::ABColumn, sceneView->header()->fontMetrics().width(QString("_AB_"))); sceneView->header()->resizeSection(Scene::ABColumn, sceneView->header()->fontMetrics().width(QString("_AB_")));
sceneView->header()->resizeSection(Scene::VisibleColumn, sceneView->header()->fontMetrics().width(QString("_View_"))); sceneView->header()->resizeSection(Scene::VisibleColumn, sceneView->header()->fontMetrics().width(QString("_View_")));
#endif
} }
void MainWindow::reset_default_loaders() void MainWindow::reset_default_loaders()

View File

@ -577,7 +577,11 @@ private:
// Find the right width for the label to accommodate at least 9999 // Find the right width for the label to accommodate at least 9999
QFontMetrics metric = x_cubeLabel->fontMetrics(); 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."))); x_cubeLabel->setFixedWidth(metric.width(QString(".9999.")));
#endif
x_cubeLabel->setText("0"); x_cubeLabel->setText("0");
x_cubeLabel->setValidator(validator); x_cubeLabel->setValidator(validator);
@ -603,7 +607,11 @@ private:
// Find the right width for the label to accommodate at least 9999 // Find the right width for the label to accommodate at least 9999
QFontMetrics metric = y_cubeLabel->fontMetrics(); 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."))); y_cubeLabel->setFixedWidth(metric.width(QString(".9999.")));
#endif
y_cubeLabel->setText("0"); y_cubeLabel->setText("0");
y_cubeLabel->setValidator(validator); y_cubeLabel->setValidator(validator);
y_slider = new QSlider(mw); y_slider = new QSlider(mw);
@ -628,7 +636,11 @@ private:
// Find the right width for the label to accommodate at least 9999 // Find the right width for the label to accommodate at least 9999
QFontMetrics metric = z_cubeLabel->fontMetrics(); 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."))); z_cubeLabel->setFixedWidth(metric.width(QString(".9999.")));
#endif
z_cubeLabel->setText("0"); z_cubeLabel->setText("0");
z_cubeLabel->setValidator(validator); z_cubeLabel->setValidator(validator);
z_slider = new QSlider(mw); z_slider = new QSlider(mw);

View File

@ -817,7 +817,7 @@ Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer)
QList<float> depths = picked_item_IDs.keys(); QList<float> depths = picked_item_IDs.keys();
if(!depths.isEmpty()) if(!depths.isEmpty())
{ {
qSort(depths); std::sort(depths.begin(), depths.end());
int id = picked_item_IDs[depths.first()]; int id = picked_item_IDs[depths.first()];
setSelectedItemIndex(id); setSelectedItemIndex(id);
viewer->setSelectedName(id); viewer->setSelectedName(id);

View File

@ -1491,7 +1491,7 @@ void Scene_c3t3_item_priv::computeIntersection(const Primitive& facet)
Tr::Cell_handle ch = facet.id().first; Tr::Cell_handle ch = facet.id().first;
if(intersected_cells.find(ch) == intersected_cells.end()) if(intersected_cells.find(ch) == intersected_cells.end())
{ {
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& pa = wp2p(ch->vertex(0)->point());
const Tr::Bare_point& pb = wp2p(ch->vertex(1)->point()); const Tr::Bare_point& pb = wp2p(ch->vertex(1)->point());
@ -1516,7 +1516,7 @@ void Scene_c3t3_item_priv::computeIntersection(const Primitive& facet)
const Tr::Bare_point& pc = wp2p(nh->vertex(2)->point()); const Tr::Bare_point& pc = wp2p(nh->vertex(2)->point());
const Tr::Bare_point& pd = wp2p(nh->vertex(3)->point()); const Tr::Bare_point& pd = wp2p(nh->vertex(3)->point());
QColor c = this->colors_subdomains[nh->subdomain_index()].light(50); QColor c = this->colors_subdomains[nh->subdomain_index()].lighter(50);
CGAL::Color color(UC(c.red()), UC(c.green()), UC(c.blue())); CGAL::Color color(UC(c.red()), UC(c.green()), UC(c.blue()));

View File

@ -973,7 +973,13 @@ void Viewer::drawVisualHints()
//Prints the displayMessage //Prints the displayMessage
QFont font = QFont(); QFont font = QFont();
QFontMetrics fm(font); 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), float(height()-20),
0, d->message, false, 0, d->message, false,
QFont(), Qt::gray ); QFont(), Qt::gray );

View File

@ -26,7 +26,7 @@ MainWindow::MainWindow(QWidget* parent)
m_pViewer = ui->viewer; m_pViewer = ui->viewer;
// does not save the state of the viewer // does not save the state of the viewer
m_pViewer->setStateFileName(QString::null); m_pViewer->setStateFileName(QString());
// accepts drop events // accepts drop events
setAcceptDrops(true); setAcceptDrops(true);

View File

@ -30,6 +30,7 @@
#include <CGAL/Three/Viewer_interface.h> #include <CGAL/Three/Viewer_interface.h>
#include <CGAL/Three/Scene_interface.h> #include <CGAL/Three/Scene_interface.h>
#include <QtGlobal>
class QVector3D; class QVector3D;
namespace CGAL{ 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) :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); 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()); _height = float(fm.height());
} }
//!\brief Accessor for the string //!\brief Accessor for the string

View File

@ -1766,7 +1766,7 @@ void Viewer::endSelection(const QPoint& p)
QList<float> depths = picked_IDs.keys(); QList<float> depths = picked_IDs.keys();
if(!depths.isEmpty()) if(!depths.isEmpty())
{ {
qSort(depths); std::sort(depths.begin(), depths.end());
id = picked_IDs[depths.first()]; id = picked_IDs[depths.first()];
picked = true; picked = true;
} }
@ -2267,7 +2267,7 @@ void Viewer::keyPressEvent(QKeyEvent *event)
else if( m_curMode == SELECT else if( m_curMode == SELECT
&& event->key()==Qt::Key_Delete && modifiers==Qt::NoButton ) { && event->key()==Qt::Key_Delete && modifiers==Qt::NoButton ) {
// sort selected id's in descending order // sort selected id's in descending order
qSort(m_vidSeled.begin(), m_vidSeled.end(), qGreater<int>()); std::sort(m_vidSeled.begin(), m_vidSeled.end(), std::greater<int>());
for(QList<int>::iterator vit=m_vidSeled.begin(); vit<m_vidSeled.end(); ++vit) { for(QList<int>::iterator vit=m_vidSeled.begin(); vit<m_vidSeled.end(); ++vit) {
// remove the selected point from DT and vertex_handle_array // remove the selected point from DT and vertex_handle_array
// note: QList::takeAt will removes the item at index position i and returns it. // note: QList::takeAt will removes the item at index position i and returns it.