Fix a few warnings with recent Qt5 versions

This commit is contained in:
Olivier Teuliere 2020-04-11 09:42:14 +02:00
parent 0a1a46942e
commit 757d9b26be
7 changed files with 13 additions and 9 deletions

View file

@ -108,7 +108,7 @@ ArbitrationWidget::ArbitrationWidget(QWidget *parent,
m_resultsModel->setHeaderData(1, Qt::Horizontal, _q("Ref"), Qt::DisplayRole);
m_resultsModel->setHeaderData(2, Qt::Horizontal, _q("Points"), Qt::DisplayRole);
m_resultsModel->setHeaderData(3, Qt::Horizontal, _q("Status"), Qt::DisplayRole);
treeViewResults->sortByColumn(2);
treeViewResults->sortByColumn(2, Qt::DescendingOrder);
treeViewResults->setColumnWidth(0, 120);
treeViewResults->setColumnWidth(1, 40);

View file

@ -22,10 +22,11 @@
#include <QApplication>
#include <QAction>
#include <QGuiApplication>
#include <QWidget>
#include <QVBoxLayout>
#include <QCloseEvent>
#include <QDesktopWidget>
#include <QScreen>
#include <QSettings>
#include "aux_window.h"
@ -108,7 +109,7 @@ void AuxWindow::readSettings()
QSize size = settings.value("size").toSize();
if (size.isValid())
resize(size);
const QRect &desktopRect = QApplication::desktop()->screenGeometry();
const QRect &desktopRect = qGuiApp->primaryScreen()->geometry();
QPoint point = settings.value("pos", QPoint(20, 20)).toPoint();
// If the position was saved when an external monitor was plugged, and
// is restored when the monitor is not there anymore, the window could

View file

@ -20,6 +20,7 @@
#include "config.h"
#include <QGuiApplication>
#include <QLabel>
#include <QFrame>
#include <QMessageBox>
@ -31,7 +32,7 @@
#include <QPrinter>
#include <QPainter>
#include <QDesktopServices>
#include <QDesktopWidget>
#include <QScreen>
#include <QSettings>
#include <QUrl>
@ -656,7 +657,7 @@ void MainWindow::readSettings()
QSize size = settings.value("size").toSize();
if (size.isValid())
resize(size);
const QRect &desktopRect = QApplication::desktop()->screenGeometry();
const QRect &desktopRect = qGuiApp->primaryScreen()->geometry();
QPoint point = settings.value("pos", QPoint(20, 20)).toPoint();
// If the position was saved when an external monitor was plugged, and
// is restored when the monitor is not there anymore, the window could
@ -1114,7 +1115,7 @@ void MainWindow::print(QPrinter *printer)
int curHeight = (LINE_HEIGHT + textHeight + 1) / 2;
for (unsigned int i = 0; i < nbCols; ++i)
{
int textWidth = fm.width(colTitles[i]);
int textWidth = fm.horizontalAdvance(colTitles[i]);
painter.drawText(curWidth + (colWidths[i] - textWidth) / 2,
curHeight, colTitles[i]);
curWidth += colWidths[i];

View file

@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/
#include <QAction>
#include <QCompleter>
#include <QFileSystemModel>
#include <QFileDialog>

View file

@ -506,7 +506,7 @@ void StatsWidget::flipTable()
m_table->setModel(proxy);
// Sort by ranking (last column)
const int col = m_flippedModel->columnCount() - 1;
m_table->sortByColumn(col);
m_table->sortByColumn(col, Qt::AscendingOrder);
m_table->horizontalHeader()->setSortIndicator(col, Qt::AscendingOrder);
}
refresh();

View file

@ -105,7 +105,7 @@ ToppingWidget::ToppingWidget(QWidget *parent, PlayModel &iPlayModel,
m_model->setHeaderData(1, Qt::Horizontal, _q("Word"), Qt::DisplayRole);
m_model->setHeaderData(2, Qt::Horizontal, _q("Ref"), Qt::DisplayRole);
m_model->setHeaderData(3, Qt::Horizontal, _q("Points"), Qt::DisplayRole);
tableViewMoves->sortByColumn(3);
tableViewMoves->sortByColumn(3, Qt::DescendingOrder);
// XXX: why is this needed? It is not needed in the ArbitrationWidget class
tableViewMoves->horizontalHeader()->setSortIndicator(3, Qt::DescendingOrder);

View file

@ -21,6 +21,7 @@
#include <QStandardItemModel>
#include <QMenu>
#include <QHeaderView>
#include <Qt>
#include "training_widget.h"
#include "qtcommon.h"
@ -184,7 +185,7 @@ void TrainingWidget::updateModel()
m_model->removeRows(0, m_model->rowCount());
// Force the sort column
treeViewResults->sortByColumn(2);
treeViewResults->sortByColumn(2, Qt::DescendingOrder);
if (m_game == NULL)
return;