summaryrefslogtreecommitdiff
path: root/quacker/boarddisplay.cpp
diff options
context:
space:
mode:
authorJohn Fultz <jfultz@wolfram.com>2023-07-18 00:44:06 -0500
committerJohn Fultz <jfultz@wolfram.com>2023-07-18 00:44:06 -0500
commit53f394839396edd537785fc40db3090839dd7c04 (patch)
tree4198dc35fd903fbd537d798a5de06afb2e7b3253 /quacker/boarddisplay.cpp
parenta68140dfb546b8a89c48bfe99d7b56d9c2908569 (diff)
Fix Qt6 MOC compilation on some platforms.
That was super painful. It seems that some of the Quackle types that have custom operator==() give fits to the MOC compiler when those types are used as arguments for slots and/or signals (or maybe it's only when they're connected in a certain way...frankly, I never did figure this out precisely to my satisfaction). The compilers provide very little help in resolving this problem. Once I understood the problem, VS22 was giving me just the tiniest morsel, enough that I could hunt down the offending slot/signal (it wasn't even giving me the name of the slot/signal...just the type it was trying to use). I've changed all offending functions to use const pointers to types instead of const references, and this makes Qt happy. I couldn't find any info on the web directly about this, but here's the closest I did find, which suggests that this is related to increased functionality in Qt6 regarding reflection. https://forum.qt.io/topic/141434/ This fixes my VC++22 x86-64 build. Hopefully it fixes all of the others, too.
Diffstat (limited to 'quacker/boarddisplay.cpp')
-rw-r--r--quacker/boarddisplay.cpp29
1 files changed, 15 insertions, 14 deletions
diff --git a/quacker/boarddisplay.cpp b/quacker/boarddisplay.cpp
index 677179e..491b040 100644
--- a/quacker/boarddisplay.cpp
+++ b/quacker/boarddisplay.cpp
@@ -66,20 +66,20 @@ BoardWithQuickEntry::~BoardWithQuickEntry()
{
}
-void BoardWithQuickEntry::positionChanged(const Quackle::GamePosition &position)
+void BoardWithQuickEntry::positionChanged(const Quackle::GamePosition *position)
{
View::positionChanged(position);
- setLocalCandidate(position.moveMade());
+ setLocalCandidate(&position->moveMade());
}
-void BoardWithQuickEntry::setLocalCandidate(const Quackle::Move &candidate)
+void BoardWithQuickEntry::setLocalCandidate(const Quackle::Move *candidate)
{
- m_localCandidateMove = candidate;
+ m_localCandidateMove = *candidate;
- if (candidate.isAMove())
+ if (candidate->isAMove())
{
- m_lineEdit->setText(QuackleIO::Util::moveToDetailedString(candidate));
- m_commitButton->setText(tr("Commit %1").arg(QuackleIO::Util::moveToDetailedString(candidate)));
+ m_lineEdit->setText(QuackleIO::Util::moveToDetailedString(*candidate));
+ m_commitButton->setText(tr("Commit %1").arg(QuackleIO::Util::moveToDetailedString(*candidate)));
}
else
{
@@ -87,7 +87,7 @@ void BoardWithQuickEntry::setLocalCandidate(const Quackle::Move &candidate)
m_commitButton->setText(tr("Commit"));
}
- m_commitButton->setEnabled(candidate.isAMove());
+ m_commitButton->setEnabled(candidate->isAMove());
}
void BoardWithQuickEntry::quickEditReturnPressed()
@@ -107,18 +107,19 @@ void BoardWithQuickEntry::quickEditShiftReturnPressed()
void BoardWithQuickEntry::plusFive()
{
m_localCandidateMove.setScoreAddition(m_localCandidateMove.scoreAddition() + 5);
- emit setCandidateMove(m_localCandidateMove, nullptr);
+ emit setCandidateMove(&m_localCandidateMove, nullptr);
}
void BoardWithQuickEntry::performCommit()
{
- emit setCandidateMove(m_localCandidateMove, nullptr);
+ emit setCandidateMove(&m_localCandidateMove, nullptr);
emit commit();
}
void BoardWithQuickEntry::reset()
{
- emit setCandidateMove(Quackle::Move::createNonmove(), nullptr);
+ Quackle::Move move = Quackle::Move::createNonmove();
+ emit setCandidateMove(&move, nullptr);
}
void BoardWithQuickEntry::provideHelp()
@@ -207,7 +208,7 @@ void BoardWithQuickEntry::processCommand(const QString &command)
}
if (move.isAMove())
- emit setCandidateMove(move, nullptr);
+ emit setCandidateMove(&move, nullptr);
}
///////////
@@ -223,11 +224,11 @@ TextBoard::TextBoard(QWidget *parent)
m_textEdit->setReadOnly(true);
}
-void TextBoard::positionChanged(const Quackle::GamePosition &position)
+void TextBoard::positionChanged(const Quackle::GamePosition *position)
{
BoardWithQuickEntry::positionChanged(position);
//m_textEdit->setHtml(QString("<html><font size=\"+4\"><pre>%1</pre></font></html>").arg(QuackleIO::Util::uvStringToQString(position.boardAfterMoveMade().toString())));
- m_textEdit->setPlainText(QString("%1").arg(QuackleIO::Util::uvStringToQString(position.boardAfterMoveMade().toString())));
+ m_textEdit->setPlainText(QString("%1").arg(QuackleIO::Util::uvStringToQString(position->boardAfterMoveMade().toString())));
}
///////////