mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-25 15:29:44 -05:00
Add signal EntryView::entryActivated().
This commit is contained in:
parent
1ee0c804be
commit
24158bb032
@ -26,6 +26,12 @@ EntryModel::EntryModel(QObject* parent)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Entry* EntryModel::entryFromIndex(const QModelIndex& index) const
|
||||||
|
{
|
||||||
|
Q_ASSERT(index.isValid() && index.row() < m_group->entries().size());
|
||||||
|
return m_group->entries().at(index.row());
|
||||||
|
}
|
||||||
|
|
||||||
void EntryModel::setGroup(Group* group)
|
void EntryModel::setGroup(Group* group)
|
||||||
{
|
{
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
@ -66,7 +72,7 @@ QVariant EntryModel::data(const QModelIndex& index, int role) const
|
|||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
Entry* entry = m_group->entries().at(index.row());
|
Entry* entry = entryFromIndex(index);
|
||||||
|
|
||||||
// TODO implement other columns
|
// TODO implement other columns
|
||||||
if (role == Qt::DisplayRole) {
|
if (role == Qt::DisplayRole) {
|
||||||
|
@ -29,6 +29,8 @@ class EntryModel : public QAbstractTableModel
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit EntryModel(QObject* parent = 0);
|
explicit EntryModel(QObject* parent = 0);
|
||||||
|
Entry* entryFromIndex(const QModelIndex& index) const;
|
||||||
|
|
||||||
int rowCount(const QModelIndex& parent = QModelIndex()) const;
|
int rowCount(const QModelIndex& parent = QModelIndex()) const;
|
||||||
int columnCount(const QModelIndex& parent = QModelIndex()) const;
|
int columnCount(const QModelIndex& parent = QModelIndex()) const;
|
||||||
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
|
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
|
||||||
|
@ -34,6 +34,11 @@ void EntryView::setGroup(Group* group)
|
|||||||
m_model->setGroup(group);
|
m_model->setGroup(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EntryView::emitEntryActivated(const QModelIndex& index)
|
||||||
|
{
|
||||||
|
Q_EMIT entryActivated(m_model->entryFromIndex(index));
|
||||||
|
}
|
||||||
|
|
||||||
void EntryView::setModel(QAbstractItemModel* model)
|
void EntryView::setModel(QAbstractItemModel* model)
|
||||||
{
|
{
|
||||||
Q_UNUSED(model);
|
Q_UNUSED(model);
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include <QtGui/QTreeView>
|
#include <QtGui/QTreeView>
|
||||||
|
|
||||||
|
class Entry;
|
||||||
class EntryModel;
|
class EntryModel;
|
||||||
class Group;
|
class Group;
|
||||||
|
|
||||||
@ -34,6 +35,12 @@ public:
|
|||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void setGroup(Group* group);
|
void setGroup(Group* group);
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void emitEntryActivated(const QModelIndex& index);
|
||||||
|
|
||||||
|
Q_SIGNALS:
|
||||||
|
void entryActivated(Entry* entry);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
EntryModel* m_model;
|
EntryModel* m_model;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user