refactor focusController to make the logic more
straightforward
This commit is contained in:
parent
dc6c1cdf49
commit
5e9202f6ac
2 changed files with 178 additions and 152 deletions
|
|
@ -29,10 +29,11 @@ public:
|
|||
Q_INVOKABLE void nextKeyDownItem();
|
||||
Q_INVOKABLE void nextKeyLeftItem();
|
||||
Q_INVOKABLE void nextKeyRightItem();
|
||||
Q_INVOKABLE void setFocusItem(QQuickItem* item);
|
||||
Q_INVOKABLE void setFocusOnDefaultItem();
|
||||
Q_INVOKABLE void resetRootObject();
|
||||
Q_INVOKABLE void pushRootObject(QObject* object);
|
||||
Q_INVOKABLE void dropRootObject(QObject* object);
|
||||
Q_INVOKABLE void resetRootObject();
|
||||
|
||||
private:
|
||||
enum class Direction {
|
||||
|
|
@ -40,20 +41,22 @@ private:
|
|||
Backward,
|
||||
};
|
||||
|
||||
void reload(Direction direction);
|
||||
void nextItem(Direction direction);
|
||||
void focusNextListViewItem();
|
||||
void focusPreviousListViewItem();
|
||||
void reload(Direction direction);
|
||||
void resetListView();
|
||||
void dropListView();
|
||||
|
||||
QSharedPointer<QQmlApplicationEngine> m_engine; // Pointer to engine to get root object
|
||||
QList<QObject*> m_focusChain; // List of current objects to be focused
|
||||
QQuickItem* m_focusedItem; // Pointer to the active focus item
|
||||
qsizetype m_focusedItemIndex; // Active focus item's index in focus chain
|
||||
QStack<QObject*> m_rootObjects;
|
||||
QSharedPointer<QQuickItem> m_defaultFocusItem;
|
||||
|
||||
ListViewFocusController* m_lvfc; // ListView focus manager
|
||||
|
||||
signals:
|
||||
void focusedItemChanged();
|
||||
};
|
||||
|
||||
#endif // FOCUSCONTROLLER_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue