mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-07 18:43:26 -08:00
Fix remaining review threads on the report queue dashboard
- Read the raw report status from Qt::UserRole in DlgMyReports, so regular users can comment on their own open reports again. - Exclude the server's depth-0 seed row from the related-alt count. - Dim only IP matches shared by more than the pair, not every IP match. - Activate alts rows on double-click or Enter instead of `activated`, which fires on a single click on single-click platforms. - Fold the reported-user bolding pass into the fill loop.
This commit is contained in:
parent
31878eb880
commit
4d645e7513
8 changed files with 81 additions and 10 deletions
|
|
@ -0,0 +1,28 @@
|
|||
#include "table_activation.h"
|
||||
|
||||
#include <QKeySequence>
|
||||
#include <QShortcut>
|
||||
#include <QTableWidget>
|
||||
|
||||
namespace
|
||||
{
|
||||
void addActivationShortcut(QTableWidget *table,
|
||||
QObject *context,
|
||||
int key,
|
||||
const std::function<void(const QModelIndex &)> &handler)
|
||||
{
|
||||
auto *shortcut = new QShortcut(QKeySequence(key), table);
|
||||
// The table's viewport takes focus, so match children as well.
|
||||
shortcut->setContext(Qt::WidgetWithChildrenShortcut);
|
||||
QObject::connect(shortcut, &QShortcut::activated, context, [table, handler] { handler(table->currentIndex()); });
|
||||
}
|
||||
} // namespace
|
||||
|
||||
void connectTableActivation(QTableWidget *table,
|
||||
QObject *context,
|
||||
const std::function<void(const QModelIndex &)> &handler)
|
||||
{
|
||||
QObject::connect(table, &QTableWidget::doubleClicked, context, handler);
|
||||
addActivationShortcut(table, context, Qt::Key_Return, handler);
|
||||
addActivationShortcut(table, context, Qt::Key_Enter, handler);
|
||||
}
|
||||
32
cockatrice/src/interface/widgets/utility/table_activation.h
Normal file
32
cockatrice/src/interface/widgets/utility/table_activation.h
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
/**
|
||||
* @file table_activation.h
|
||||
* @brief Row activation for tables that must not navigate on a single click.
|
||||
*/
|
||||
|
||||
#ifndef TABLE_ACTIVATION_H
|
||||
#define TABLE_ACTIVATION_H
|
||||
|
||||
#include <functional>
|
||||
|
||||
class QModelIndex;
|
||||
class QObject;
|
||||
class QTableWidget;
|
||||
|
||||
/**
|
||||
* @brief Call @p handler on double-click or Enter, never on a single click.
|
||||
*
|
||||
* QAbstractItemView::activated fires on a single click on platforms where
|
||||
* SH_ItemView_ActivateItemOnSingleClick is set, so navigation actions must not
|
||||
* use it. This connects doubleClicked and installs Return/Enter shortcuts that
|
||||
* forward the current index.
|
||||
*
|
||||
* @param table The table whose rows activate.
|
||||
* @param context Object that owns the connections; the handler is disconnected
|
||||
* with it.
|
||||
* @param handler Receives the activated row's index, which may be invalid.
|
||||
*/
|
||||
void connectTableActivation(QTableWidget *table,
|
||||
QObject *context,
|
||||
const std::function<void(const QModelIndex &)> &handler);
|
||||
|
||||
#endif // TABLE_ACTIVATION_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue