mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-11 16:44:48 -07:00
Deal with recent Qt methods deprecation (#3801)
* Deal with recent Qt methods deprecation * Use std::sort, std::less instead of qSort/qLess * Use QFontMetrics::horizontalAdvance instead of ::width * Use qApp->primaryScreen() instead of QDesktopWidget * use lambas instead of QSignalMapper * Use QTreeWidgetItem::setForeground instead of ::setTextColor * Use QDir::setPath instead of operator=(QString) * Use QList::swapItemsAt instead of ::swap * fix error
This commit is contained in:
parent
f54165025e
commit
b6df5a4ac3
17 changed files with 71 additions and 40 deletions
|
|
@ -5,7 +5,12 @@
|
|||
#include "cardinfowidget.h"
|
||||
#include "carditem.h"
|
||||
#include "main.h"
|
||||
#include <QApplication>
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 13, 0))
|
||||
#include <QScreen>
|
||||
#else
|
||||
#include <QDesktopWidget>
|
||||
#endif
|
||||
#include <QVBoxLayout>
|
||||
|
||||
CardInfoWidget::CardInfoWidget(const QString &cardName, QWidget *parent, Qt::WindowFlags flags)
|
||||
|
|
@ -27,8 +32,13 @@ CardInfoWidget::CardInfoWidget(const QString &cardName, QWidget *parent, Qt::Win
|
|||
setLayout(layout);
|
||||
|
||||
setFrameStyle(QFrame::Panel | QFrame::Raised);
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 13, 0))
|
||||
int pixmapHeight = qApp->primaryScreen()->geometry().height() / 3;
|
||||
#else
|
||||
QDesktopWidget desktopWidget;
|
||||
int pixmapHeight = desktopWidget.screenGeometry().height() / 3;
|
||||
#endif
|
||||
int pixmapWidth = static_cast<int>(pixmapHeight / aspectRatio);
|
||||
pic->setFixedWidth(pixmapWidth);
|
||||
pic->setFixedHeight(pixmapHeight);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue