Arbitration: a click on the master move previews it on the board

This commit is contained in:
Olivier Teulière 2012-03-18 01:00:25 +01:00
parent 35acc7b7a3
commit e77923674f
3 changed files with 24 additions and 1 deletions

View file

@ -145,6 +145,9 @@ ArbitrationWidget::ArbitrationWidget(QWidget *parent,
QObject::connect(treeViewResults->selectionModel(),
SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)),
this, SLOT(showPreview(const QItemSelection&)));
// Display a preview of the master word when clicked
QObject::connect(labelMasterMove, SIGNAL(clicked()),
this, SLOT(showMasterPreview()));
// Dynamic filter for search results
QObject::connect(lineEditFilter, SIGNAL(textChanged(const QString&)),
@ -747,6 +750,18 @@ void ArbitrationWidget::showPreview(const QItemSelection &iSelected)
}
void ArbitrationWidget::showMasterPreview()
{
const Move &move = m_game->duplicateGetMasterMove();
if (move.getType() == Move::VALID_ROUND)
{
treeViewResults->clearSelection();
m_game->setTestRound(move.getRound());
}
emit gameUpdated();
}
Rack ArbitrationWidget::getRack() const
{
return m_game->getHistory().getCurrentRack().getRack();

View file

@ -67,6 +67,7 @@ private slots:
void enableAssignmentButtons();
void clearResults();
void showPreview(const QItemSelection &);
void showMasterPreview();
void updateCoordText(const Coord&, const Coord&);
void updateCoordModel(const QString&);
void populateResultsMenu(QMenu &iMenu, const QPoint &iPoint);

View file

@ -174,7 +174,7 @@
</widget>
</item>
<item>
<widget class="QLabel" name="labelMasterMove">
<widget class="ClickableLabel" name="labelMasterMove">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
@ -290,6 +290,13 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>ClickableLabel</class>
<extends>QLabel</extends>
<header location="global">misc_helpers.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>lineEditRack</tabstop>
<tabstop>buttonRandom</tabstop>