summaryrefslogtreecommitdiff
path: root/quacker/graphicalboard.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/graphicalboard.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/graphicalboard.cpp')
-rw-r--r--quacker/graphicalboard.cpp31
1 files changed, 17 insertions, 14 deletions
diff --git a/quacker/graphicalboard.cpp b/quacker/graphicalboard.cpp
index 6b1d14b..1334def 100644
--- a/quacker/graphicalboard.cpp
+++ b/quacker/graphicalboard.cpp
@@ -43,7 +43,7 @@ GraphicalBoard::GraphicalBoard(QWidget *parent)
: BoardWithQuickEntry(parent)
{
m_boardFrame = new GraphicalBoardFrame;
- connect(m_boardFrame, SIGNAL(localCandidateChanged(const Quackle::Move &)), this, SLOT(setLocalCandidate(const Quackle::Move &)));
+ connect(m_boardFrame, SIGNAL(localCandidateChanged(const Quackle::Move *)), this, SLOT(setLocalCandidate(const Quackle::Move *)));
m_boardWrapper = new QWidget;
@@ -110,21 +110,21 @@ GraphicalBoardFrame::~GraphicalBoardFrame()
void GraphicalBoardFrame::staticDrawPosition(const Quackle::GamePosition &position, const QSize &size, QPixmap *pixmap)
{
GraphicalBoardFrame doozy;
- doozy.positionChanged(position);
+ doozy.positionChanged(&position);
doozy.expandToSize(size);
doozy.generateBoardPixmap(pixmap);
}
-void GraphicalBoardFrame::positionChanged(const Quackle::GamePosition &position)
+void GraphicalBoardFrame::positionChanged(const Quackle::GamePosition *position)
{
- m_board = position.board();
- m_rack = position.currentPlayer().rack();
- m_ignoreRack = !position.currentPlayer().racksAreKnown();
+ m_board = position->board();
+ m_rack = position->currentPlayer().rack();
+ m_ignoreRack = !position->currentPlayer().racksAreKnown();
m_board.updateBritishness();
resetArrow();
- m_candidate = position.moveMade();
+ m_candidate = position->moveMade();
prepare();
}
@@ -649,21 +649,22 @@ void GraphicalBoardFrame::prettifyAndSetLocalCandidate(const Quackle::Move &cand
if (m_candidate.wordTilesWithNoPlayThru().length() == 1)
{
- emit localCandidateChanged(flip(m_candidate));
+ const Quackle::Move &move = flip(m_candidate);
+ emit localCandidateChanged(&move);
emit statusMessage(tr("Press Enter to add %1 to candidate list, or Control+Enter to commit to it immediately.").arg(QuackleIO::Util::moveToDetailedString(flip(m_candidate))));
}
else
{
- emit localCandidateChanged(m_candidate);
+ emit localCandidateChanged(&m_candidate);
emit statusMessage(tr("Press Enter to add %1 to candidate list, or Control+Enter to commit to it immediately.").arg(QuackleIO::Util::moveToDetailedString(m_candidate)));
}
}
-void GraphicalBoardFrame::setLocalCandidate(const Quackle::Move &candidate)
+void GraphicalBoardFrame::setLocalCandidate(const Quackle::Move *candidate)
{
- m_candidate = candidate;
+ m_candidate = *candidate;
resetArrow();
prepare();
}
@@ -748,7 +749,8 @@ void GraphicalBoardFrame::backspaceHandler()
void GraphicalBoardFrame::deleteHandler()
{
- setLocalCandidate(Quackle::Move::createNonmove());
+ const Quackle::Move move = Quackle::Move::createNonmove();
+ setLocalCandidate(&move);
}
void GraphicalBoardFrame::submitHandler()
@@ -771,11 +773,12 @@ void GraphicalBoardFrame::setGlobalCandidate(bool *carryOn)
if (m_candidate.wordTilesWithNoPlayThru().length() == 1)
{
- emit setCandidateMove(flip(m_candidate), carryOn);
+ Quackle::Move flippedMove = flip(m_candidate);
+ emit setCandidateMove(&flippedMove, carryOn);
}
else
{
- emit setCandidateMove(m_candidate, carryOn);
+ emit setCandidateMove(&m_candidate, carryOn);
}
}