diff --git a/qt/arbitration_widget.cpp b/qt/arbitration_widget.cpp index e0bad4d..00fd042 100644 --- a/qt/arbitration_widget.cpp +++ b/qt/arbitration_widget.cpp @@ -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(); diff --git a/qt/arbitration_widget.h b/qt/arbitration_widget.h index 04de24b..7c70c95 100644 --- a/qt/arbitration_widget.h +++ b/qt/arbitration_widget.h @@ -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); diff --git a/qt/ui/arbitration_widget.ui b/qt/ui/arbitration_widget.ui index dbb2515..e668e35 100644 --- a/qt/ui/arbitration_widget.ui +++ b/qt/ui/arbitration_widget.ui @@ -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>