restable Ctrl+i shortcuts to jump from results to row i
This commit is contained in:
parent
c19229a59f
commit
84815d4aa6
@ -594,6 +594,17 @@ void ResTable::init()
|
||||
connect(&SCBase::scBase(), SIGNAL(shortcutsChanged()),
|
||||
this, SLOT(onNewShortcuts()));
|
||||
|
||||
new QShortcut(QKeySequence("Ctrl+0"), this, SLOT(setCurrentRow0()));
|
||||
new QShortcut(QKeySequence("Ctrl+1"), this, SLOT(setCurrentRow1()));
|
||||
new QShortcut(QKeySequence("Ctrl+2"), this, SLOT(setCurrentRow2()));
|
||||
new QShortcut(QKeySequence("Ctrl+3"), this, SLOT(setCurrentRow3()));
|
||||
new QShortcut(QKeySequence("Ctrl+4"), this, SLOT(setCurrentRow4()));
|
||||
new QShortcut(QKeySequence("Ctrl+5"), this, SLOT(setCurrentRow5()));
|
||||
new QShortcut(QKeySequence("Ctrl+6"), this, SLOT(setCurrentRow6()));
|
||||
new QShortcut(QKeySequence("Ctrl+7"), this, SLOT(setCurrentRow7()));
|
||||
new QShortcut(QKeySequence("Ctrl+8"), this, SLOT(setCurrentRow8()));
|
||||
new QShortcut(QKeySequence("Ctrl+9"), this, SLOT(setCurrentRow9()));
|
||||
|
||||
connect(tableView, SIGNAL(customContextMenuRequested(const QPoint&)),
|
||||
this, SLOT(createPopupMenu(const QPoint&)));
|
||||
|
||||
@ -727,6 +738,25 @@ void ResTable::onUiPrefsChanged()
|
||||
}
|
||||
}
|
||||
|
||||
#define SETCURRENTROW(INDEX) \
|
||||
void ResTable::setCurrentRow##INDEX() \
|
||||
{ \
|
||||
tableView->setFocus(Qt::ShortcutFocusReason); \
|
||||
tableView->selectionModel()->setCurrentIndex( \
|
||||
m_model->index(INDEX, 0), \
|
||||
QItemSelectionModel::ClearAndSelect|QItemSelectionModel::Rows); \
|
||||
}
|
||||
SETCURRENTROW(0)
|
||||
SETCURRENTROW(1)
|
||||
SETCURRENTROW(2)
|
||||
SETCURRENTROW(3)
|
||||
SETCURRENTROW(4)
|
||||
SETCURRENTROW(5)
|
||||
SETCURRENTROW(6)
|
||||
SETCURRENTROW(7)
|
||||
SETCURRENTROW(8)
|
||||
SETCURRENTROW(9)
|
||||
|
||||
int ResTable::getDetailDocNumOrTopRow()
|
||||
{
|
||||
if (m_detaildocnum >= 0)
|
||||
|
||||
@ -32,11 +32,12 @@
|
||||
|
||||
class ResTable;
|
||||
|
||||
typedef std::string (FieldGetter)(const std::string& fldname, const Rcl::Doc& doc);
|
||||
typedef std::string (FieldGetter)(
|
||||
const std::string& fldname, const Rcl::Doc& doc);
|
||||
|
||||
class RecollModel : public QAbstractTableModel {
|
||||
|
||||
Q_OBJECT
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
RecollModel(const QStringList fields, ResTable *tb, QObject *parent = 0);
|
||||
@ -45,9 +46,9 @@ public:
|
||||
virtual int rowCount (const QModelIndex& = QModelIndex()) const;
|
||||
virtual int columnCount(const QModelIndex& = QModelIndex()) const;
|
||||
virtual QVariant headerData (int col, Qt::Orientation orientation,
|
||||
int role = Qt::DisplayRole ) const;
|
||||
int role = Qt::DisplayRole ) const;
|
||||
virtual QVariant data(const QModelIndex& index,
|
||||
int role = Qt::DisplayRole ) const;
|
||||
int role = Qt::DisplayRole ) const;
|
||||
virtual void saveAsCSV(std::fstream& fp);
|
||||
virtual void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
|
||||
// Specific methods
|
||||
@ -95,10 +96,10 @@ class ResTable;
|
||||
class ResTableDetailArea : public QTextBrowser {
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
public:
|
||||
ResTableDetailArea(ResTable* parent = 0);
|
||||
|
||||
public slots:
|
||||
public slots:
|
||||
virtual void createPopupMenu(const QPoint& pos);
|
||||
virtual void setFont();
|
||||
virtual void init();
|
||||
@ -115,17 +116,14 @@ class QShortcut;
|
||||
|
||||
class ResTable : public QWidget, public Ui::ResTable
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
ResTable(QWidget* parent = 0)
|
||||
: QWidget(parent),
|
||||
m_model(0), m_pager(0), m_detail(0), m_detaildocnum(-1),
|
||||
m_rclmain(0), m_ismainres(true)
|
||||
{
|
||||
setupUi(this);
|
||||
init();
|
||||
}
|
||||
: QWidget(parent) {
|
||||
setupUi(this);
|
||||
init();
|
||||
}
|
||||
|
||||
virtual ~ResTable() {}
|
||||
virtual RecollModel *getModel() {return m_model;}
|
||||
@ -169,6 +167,16 @@ public slots:
|
||||
virtual void takeFocus();
|
||||
virtual void onUiPrefsChanged();
|
||||
virtual void onNewShortcuts();
|
||||
virtual void setCurrentRow0();
|
||||
virtual void setCurrentRow1();
|
||||
virtual void setCurrentRow2();
|
||||
virtual void setCurrentRow3();
|
||||
virtual void setCurrentRow4();
|
||||
virtual void setCurrentRow5();
|
||||
virtual void setCurrentRow6();
|
||||
virtual void setCurrentRow7();
|
||||
virtual void setCurrentRow8();
|
||||
virtual void setCurrentRow9();
|
||||
|
||||
signals:
|
||||
void docPreviewClicked(int, Rcl::Doc, int);
|
||||
@ -184,18 +192,21 @@ signals:
|
||||
|
||||
friend class ResTablePager;
|
||||
friend class ResTableDetailArea;
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject* obj, QEvent* event);
|
||||
|
||||
private:
|
||||
void init();
|
||||
|
||||
RecollModel *m_model{nullptr};
|
||||
ResTablePager *m_pager{nullptr};
|
||||
ResTableDetailArea *m_detail{nullptr};
|
||||
int m_detaildocnum;
|
||||
int m_detaildocnum{-1};
|
||||
Rcl::Doc m_detaildoc;
|
||||
int m_popcolumn;
|
||||
int m_popcolumn{0};
|
||||
RclMain *m_rclmain{nullptr};
|
||||
bool m_ismainres;
|
||||
bool m_ismainres{true};
|
||||
QShortcut *m_opensc{nullptr};
|
||||
QShortcut *m_openquitsc{nullptr};
|
||||
QShortcut *m_previewsc{nullptr};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user