mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-01-14 08:50:08 -05:00
Select the first entry when the model has been reset.
This avoids overriding setEntryList().
This commit is contained in:
parent
6e206704f9
commit
138ca8d3a3
@ -26,13 +26,8 @@ AutoTypeSelectView::AutoTypeSelectView(QWidget* parent)
|
|||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
setAllColumnsShowFocus(true);
|
setAllColumnsShowFocus(true);
|
||||||
setDragEnabled(false);
|
setDragEnabled(false);
|
||||||
}
|
|
||||||
|
|
||||||
void AutoTypeSelectView::setEntryList(const QList<Entry*>& entries)
|
connect(model(), SIGNAL(modelReset()), SLOT(selectFirstEntry()));
|
||||||
{
|
|
||||||
EntryView::setEntryList(entries);
|
|
||||||
|
|
||||||
setCurrentIndex(model()->index(0, 0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutoTypeSelectView::mouseMoveEvent(QMouseEvent* event)
|
void AutoTypeSelectView::mouseMoveEvent(QMouseEvent* event)
|
||||||
@ -49,3 +44,12 @@ void AutoTypeSelectView::mouseMoveEvent(QMouseEvent* event)
|
|||||||
|
|
||||||
EntryView::mouseMoveEvent(event);
|
EntryView::mouseMoveEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AutoTypeSelectView::selectFirstEntry()
|
||||||
|
{
|
||||||
|
QModelIndex index = model()->index(0, 0);
|
||||||
|
|
||||||
|
if (index.isValid()) {
|
||||||
|
setCurrentIndex(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -29,10 +29,12 @@ class AutoTypeSelectView : public EntryView
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AutoTypeSelectView(QWidget* parent = Q_NULLPTR);
|
explicit AutoTypeSelectView(QWidget* parent = Q_NULLPTR);
|
||||||
void setEntryList(const QList<Entry*>& entries) Q_DECL_OVERRIDE;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void mouseMoveEvent(QMouseEvent* event) Q_DECL_OVERRIDE;
|
void mouseMoveEvent(QMouseEvent* event) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void selectFirstEntry();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // KEEPASSX_AUTOTYPESELECTVIEW_H
|
#endif // KEEPASSX_AUTOTYPESELECTVIEW_H
|
||||||
|
Loading…
Reference in New Issue
Block a user