Commit 44d6bb2d authored by Michael Pyne's avatar Michael Pyne

Remove more compiler warnings for deprecated functions/uses.

Still need to get rid of QSignalMapper using lambdas but that will need
more thought.
parent f10458fa
...@@ -480,7 +480,12 @@ void CollectionListItem::refresh() ...@@ -480,7 +480,12 @@ void CollectionListItem::refresh()
sharedData()->metadata[id] = toLower; sharedData()->metadata[id] = toLower;
} }
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
int newWidth = treeWidget()->fontMetrics().horizontalAdvance(text(i));
#else
// .width is deprecated in Qt 5.11 or later
int newWidth = treeWidget()->fontMetrics().width(text(i)); int newWidth = treeWidget()->fontMetrics().width(text(i));
#endif
if(newWidth != sharedData()->cachedWidths[i]) if(newWidth != sharedData()->cachedWidths[i])
playlist()->slotWeightDirty(i); playlist()->slotWeightDirty(i);
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <QDesktopWidget> #include <QDesktopWidget>
#include <QImage> #include <QImage>
#include <QScopedPointer> #include <QScopedPointer>
#include <QScreen>
#include <taglib/mpegfile.h> #include <taglib/mpegfile.h>
#include <taglib/tstring.h> #include <taglib/tstring.h>
...@@ -425,7 +426,8 @@ void CoverInfo::popup() const ...@@ -425,7 +426,8 @@ void CoverInfo::popup() const
{ {
QPixmap image = pixmap(FullSize); QPixmap image = pixmap(FullSize);
QPoint mouse = QCursor::pos(); QPoint mouse = QCursor::pos();
QRect desktop = QApplication::desktop()->screenGeometry(mouse); QScreen *primaryScreen = QApplication::primaryScreen();
QRect desktop = primaryScreen->availableGeometry();
int x = mouse.x(); int x = mouse.x();
int y = mouse.y(); int y = mouse.y();
......
...@@ -378,7 +378,7 @@ QPixmap CoverManager::coverFromData(const CoverData &coverData, Size size) ...@@ -378,7 +378,7 @@ QPixmap CoverManager::coverFromData(const CoverData &coverData, Size size)
// Check in cache for the pixmap. // Check in cache for the pixmap.
QPixmap pix; QPixmap pix;
if(QPixmapCache::find(path, pix)) if(QPixmapCache::find(path, &pix))
return pix; return pix;
// Not in cache, load it and add it. // Not in cache, load it and add it.
......
...@@ -1643,9 +1643,18 @@ void Playlist::slotUpdateColumnWidths() ...@@ -1643,9 +1643,18 @@ void Playlist::slotUpdateColumnWidths()
visibleColumns.append(i); visibleColumns.append(i);
} }
// convenience handler for deprecated text metrics
const auto textWidth = [](const QFontMetrics &fm, const QString &text) {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
return fm.horizontalAdvance(text);
#else
return fm.width(text);
#endif
};
if(count() == 0) { if(count() == 0) {
foreach(int column, visibleColumns) foreach(int column, visibleColumns)
setColumnWidth(column, header()->fontMetrics().width(headerItem()->text(column)) + 10); setColumnWidth(column, textWidth(header()->fontMetrics(),headerItem()->text(column)) + 10);
return; return;
} }
...@@ -1666,7 +1675,7 @@ void Playlist::slotUpdateColumnWidths() ...@@ -1666,7 +1675,7 @@ void Playlist::slotUpdateColumnWidths()
int minimumFixedWidthTotal = 0; int minimumFixedWidthTotal = 0;
foreach(int column, visibleColumns) { foreach(int column, visibleColumns) {
minimumWidth[column] = header()->fontMetrics().width(headerItem()->text(column)) + 10; minimumWidth[column] = textWidth(header()->fontMetrics(), headerItem()->text(column)) + 10;
minimumWidthTotal += minimumWidth[column]; minimumWidthTotal += minimumWidth[column];
minimumFixedWidth[column] = qMax(minimumWidth[column], m_columnFixedWidths[column]); minimumFixedWidth[column] = qMax(minimumWidth[column], m_columnFixedWidths[column]);
......
...@@ -99,6 +99,8 @@ public: ...@@ -99,6 +99,8 @@ public:
TagRenamerOptions(const CategoryID &category); TagRenamerOptions(const CategoryID &category);
TagRenamerOptions(const TagRenamerOptions &other); TagRenamerOptions(const TagRenamerOptions &other);
TagRenamerOptions& operator=(const TagRenamerOptions &) = default;
QString prefix() const { return m_prefix; } QString prefix() const { return m_prefix; }
QString suffix() const { return m_suffix; } QString suffix() const { return m_suffix; }
QString emptyText() const { return m_emptyText; } QString emptyText() const { return m_emptyText; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment