mirror of
git://git.savannah.nongnu.org/eliot.git
synced 2025-02-05 08:48:28 +01:00
Arbitration: after the end of turn, give the focus to the rack and select all the letters
This commit is contained in:
parent
537d00714b
commit
7e37cde0c0
4 changed files with 28 additions and 1 deletions
|
@ -630,6 +630,6 @@ void ArbitAssignments::endTurn()
|
|||
// FIXME: shouldn't be done here
|
||||
setEnabled(!m_game->isFinished());
|
||||
|
||||
emit gameUpdated();
|
||||
emit endOfTurn();
|
||||
}
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@ signals:
|
|||
void gameUpdated();
|
||||
void notifyProblem(QString iMsg);
|
||||
void notifyInfo(QString iMsg);
|
||||
void endOfTurn();
|
||||
|
||||
public slots:
|
||||
void refresh();
|
||||
|
|
|
@ -66,6 +66,8 @@ ArbitrationWidget::ArbitrationWidget(QWidget *parent,
|
|||
this, SIGNAL(notifyProblem(QString)));
|
||||
QObject::connect(m_assignmentsWidget, SIGNAL(notifyInfo(QString)),
|
||||
this, SIGNAL(notifyInfo(QString)));
|
||||
QObject::connect(m_assignmentsWidget, SIGNAL(endOfTurn()),
|
||||
this, SLOT(endOfTurnRefresh()));
|
||||
|
||||
m_keyAccum = new KeyAccumulator(this, 400);
|
||||
|
||||
|
@ -204,6 +206,11 @@ ArbitrationWidget::ArbitrationWidget(QWidget *parent,
|
|||
this, SIGNAL(requestDefinition(QString)));
|
||||
|
||||
refresh();
|
||||
|
||||
// Give focus to the rack
|
||||
// FIXME: for some reason, the focus gets lost later...
|
||||
lineEditRack->setFocus();
|
||||
lineEditRack->selectAll();
|
||||
}
|
||||
|
||||
|
||||
|
@ -213,9 +220,16 @@ void ArbitrationWidget::refresh()
|
|||
// Update the rack only if needed, to avoid losing cursor position
|
||||
QString qrack = qfw(pldRack.toString(PlayedRack::RACK_SIMPLE));
|
||||
if (qrack != lineEditRack->text()) {
|
||||
// Save the selection status
|
||||
bool isAllselected = lineEditRack->text() == lineEditRack->selectedText();
|
||||
|
||||
// Must be done before updateResultsModel(), because it will
|
||||
// indirectly call the clearResults() slot
|
||||
lineEditRack->setText(qrack);
|
||||
|
||||
// Restore the selection
|
||||
if (isAllselected)
|
||||
lineEditRack->selectAll();
|
||||
}
|
||||
|
||||
updateResultsModel();
|
||||
|
@ -592,6 +606,17 @@ void ArbitrationWidget::selectTableNumber(int key)
|
|||
}
|
||||
|
||||
|
||||
void ArbitrationWidget::endOfTurnRefresh()
|
||||
{
|
||||
// Refresh everything
|
||||
emit gameUpdated();
|
||||
|
||||
// Give focus to the rack
|
||||
lineEditRack->setFocus();
|
||||
lineEditRack->selectAll();
|
||||
}
|
||||
|
||||
|
||||
void ArbitrationWidget::updateSelectedMove()
|
||||
{
|
||||
bool hasSelection = treeViewResults->selectionModel()->hasSelection();
|
||||
|
|
|
@ -72,6 +72,7 @@ private slots:
|
|||
void updateCoordModel(const QString&);
|
||||
void populateResultsMenu(QMenu &iMenu, const QPoint &iPoint);
|
||||
void selectTableNumber(int key);
|
||||
void endOfTurnRefresh();
|
||||
|
||||
private:
|
||||
/// Encapsulated game, can be NULL
|
||||
|
|
Loading…
Add table
Reference in a new issue