mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-10 08:14:47 -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
|
|
@ -26,7 +26,6 @@
|
|||
#include <QPainter>
|
||||
#include <QRegularExpression>
|
||||
#include <QRegularExpressionMatch>
|
||||
#include <QSignalMapper>
|
||||
|
||||
#include "pb/command_attach_card.pb.h"
|
||||
#include "pb/command_change_zone_properties.pb.h"
|
||||
|
|
@ -3128,13 +3127,11 @@ void Player::addRelatedCardView(const CardItem *card, QMenu *cardMenu)
|
|||
cardMenu->addSeparator();
|
||||
auto viewRelatedCards = new QMenu(tr("View related cards"));
|
||||
cardMenu->addMenu(viewRelatedCards);
|
||||
auto *signalMapper = new QSignalMapper(this);
|
||||
for (const CardRelation *relatedCard : relatedCards) {
|
||||
QAction *viewCard = viewRelatedCards->addAction(relatedCard->getName());
|
||||
connect(viewCard, SIGNAL(triggered()), signalMapper, SLOT(map()));
|
||||
signalMapper->setMapping(viewCard, relatedCard->getName());
|
||||
QString relatedCardName = relatedCard->getName();
|
||||
QAction *viewCard = viewRelatedCards->addAction(relatedCardName);
|
||||
connect(viewCard, &QAction::triggered, game, [this, relatedCardName] { game->viewCardInfo(relatedCardName); });
|
||||
}
|
||||
connect(signalMapper, SIGNAL(mapped(const QString &)), game, SLOT(viewCardInfo(const QString &)));
|
||||
}
|
||||
|
||||
void Player::addRelatedCardActions(const CardItem *card, QMenu *cardMenu)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue