Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove outdated Qt version checks #8402

Merged
merged 6 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,10 @@ void CurveInputMethod::beginInput_()

static inline void clearPainterPath(QPainterPath& ppath)
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 13, 0))
ppath.clear();
#else
ppath = {};
#endif
}


void CurveInputMethod::reset()
{
this->resetInput();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,7 @@ void GridGraphicsItem::setSpacing(int spacing_)
static inline qreal
horizontalAdvance(const QFontMetrics& fm, const QString& text)
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
return fm.horizontalAdvance(text);
#else
return fm.boundingRect(text).width();
#endif
}

void GridGraphicsItem::paint(
Expand Down
2 changes: 0 additions & 2 deletions GraphicsView/include/CGAL/Qt/qglviewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -478,15 +478,13 @@ public Q_SLOTS:
qreal bufferTextureMaxU() const { return bufferTextureMaxU_; }
/*! Same as bufferTextureMaxU(), but for the v texture coordinate. */
qreal bufferTextureMaxV() const { return bufferTextureMaxV_; }
#if (QT_VERSION >= QT_VERSION_CHECK(5, 4, 0))
// These methods are part of the QGLWidget public API.
// As of version 2.7.0, the use of QOpenGLWidget instead means that they have
// to be provided for backward compatibility.
void renderText(int x, int y, const QString &str,
const QFont &font = QFont());
void renderText(double x, double y, double z, const QString &str,
const QFont &font = QFont());
#endif

public Q_SLOTS:
void copyBufferToTexture(GLint, GLenum = GL_NONE);
Expand Down
2 changes: 0 additions & 2 deletions GraphicsView/include/CGAL/Qt/qglviewer_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,6 @@ CGAL_INLINE_FUNCTION
void CGAL::QGLViewer::drawLight(GLenum, qreal ) const {
}

#if (QT_VERSION >= QT_VERSION_CHECK(5, 4, 0))
CGAL_INLINE_FUNCTION
void CGAL::QGLViewer::renderText(int x, int y, const QString &str,
const QFont &font) {
Expand All @@ -742,7 +741,6 @@ void CGAL::QGLViewer::renderText(double x, double y, double z, const QString &st
const Vec proj = camera_->projectedCoordinatesOf(Vec(x, y, z));
renderText(int(proj.x), int(proj.y), str, font);
}
#endif

/*! Draws \p text at position \p x, \p y (expressed in screen coordinates
pixels, origin in the upper left corner of the widget).
Expand Down
4 changes: 1 addition & 3 deletions Lab/demo/Lab/CGAL_Lab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ int& code_to_call_before_creation_of_QCoreApplication(int& i) {
fmt.setOption(QSurfaceFormat::DebugContext);
QSurfaceFormat::setDefaultFormat(fmt);

//for windows
#if (QT_VERSION >= QT_VERSION_CHECK(5, 3, 0))
// for windows
QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL);
#endif

return i;
}
Expand Down
15 changes: 0 additions & 15 deletions Lab/demo/Lab/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -663,15 +663,7 @@ void MainWindow::loadPlugins()
}
}
QString env_path = qgetenv("LAB_DEMO_PLUGINS_PATH");
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
QChar separator = QDir::listSeparator();
#else
#if defined(_WIN32)
QChar separator = ';';
#else
QChar separator = ':';
#endif
#endif
if(!env_path.isEmpty()) {
#if defined(_WIN32)
QString path = qgetenv("PATH");
Expand Down Expand Up @@ -2652,17 +2644,10 @@ 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()
Expand Down
12 changes: 0 additions & 12 deletions Lab/demo/Lab/Plugins/Mesh_3/Io_image_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -705,11 +705,7 @@ public Q_SLOTS:

// 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);

Expand All @@ -735,11 +731,7 @@ public Q_SLOTS:

// 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);
Expand All @@ -764,11 +756,7 @@ public Q_SLOTS:

// 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);
Expand Down
4 changes: 0 additions & 4 deletions Lab/demo/Lab/Plugins/PMP/Engrave_text_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,7 @@ class Navigation : public CGAL::Qt::GraphicsViewNavigation
}
case QEvent::Wheel: {
QWheelEvent* event = static_cast<QWheelEvent*>(ev);
#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);
Expand Down
4 changes: 0 additions & 4 deletions Lab/demo/Lab/Plugins/Surface_mesh/Parameterization_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,7 @@ class Navigation : public CGAL::Qt::GraphicsViewNavigation
}
case QEvent::Wheel: {
QWheelEvent* event = static_cast<QWheelEvent*>(ev);
#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);
Expand Down
8 changes: 1 addition & 7 deletions Lab/demo/Lab/Viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1152,13 +1152,7 @@ void Viewer::drawVisualHints()
//Prints the displayMessage
QFont font = QFont();
QFontMetrics fm(font);
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
,
TextItem *message_text = new TextItem(float(10 + fm.horizontalAdvance(d->message)/2),
float(height()-20),
0, d->message, false,
QFont(), Qt::gray );
Expand Down
5 changes: 0 additions & 5 deletions Three/include/CGAL/Three/TextRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,7 @@ 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);
#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
Expand Down
4 changes: 0 additions & 4 deletions Three/include/CGAL/Three/Three.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,7 @@
# 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{
Expand Down