mirror of https://github.com/CGAL/cgal
Merge branch 'CGAL_Qt-Fix_deprecation_warnings-GF' into CGAL_Qt-Fix_deprecation_warnings-4.14-GF
This commit is contained in:
commit
261c596cfc
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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<CGAL::Three::Scene_group_item*>(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()
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -850,7 +850,7 @@ Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer)
|
|||
QList<float> 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);
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include <CGAL/Three/Viewer_interface.h>
|
||||
#include <CGAL/Three/Scene_interface.h>
|
||||
#include <QtGlobal>
|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -1766,7 +1766,7 @@ void Viewer::endSelection(const QPoint& p)
|
|||
QList<float> 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<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) {
|
||||
// remove the selected point from DT and vertex_handle_array
|
||||
// note: QList::takeAt will removes the item at index position i and returns it.
|
||||
|
|
|
|||
Loading…
Reference in New Issue