format FocusController

This commit is contained in:
Cyril Anisimov 2024-12-16 22:12:15 +01:00
parent a57e94e4f2
commit 11d20974f0
2 changed files with 56 additions and 69 deletions

View file

@ -1,14 +1,9 @@
#ifndef FOCUSCONTROLLER_H
#define FOCUSCONTROLLER_H
#include <QObject>
#include <QStack>
#include <QSharedPointer>
#include "ui/controllers/listViewFocusController.h"
class QQuickItem;
class QQmlApplicationEngine;
class ListViewFocusController;
#include <QQmlApplicationEngine>
/*!
* \brief The FocusController class makes focus control more straightforward
@ -20,7 +15,7 @@ class FocusController : public QObject
{
Q_OBJECT
public:
explicit FocusController(QQmlApplicationEngine* engine, QObject *parent = nullptr);
explicit FocusController(QQmlApplicationEngine *engine, QObject *parent = nullptr);
~FocusController() override = default;
Q_INVOKABLE void nextKeyTabItem();
@ -29,10 +24,10 @@ public:
Q_INVOKABLE void nextKeyDownItem();
Q_INVOKABLE void nextKeyLeftItem();
Q_INVOKABLE void nextKeyRightItem();
Q_INVOKABLE void setFocusItem(QQuickItem* item);
Q_INVOKABLE void setFocusItem(QQuickItem *item);
Q_INVOKABLE void setFocusOnDefaultItem();
Q_INVOKABLE void pushRootObject(QObject* object);
Q_INVOKABLE void dropRootObject(QObject* object);
Q_INVOKABLE void pushRootObject(QObject *object);
Q_INVOKABLE void dropRootObject(QObject *object);
Q_INVOKABLE void resetRootObject();
private:
@ -48,12 +43,12 @@ private:
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
QStack<QObject*> m_rootObjects;
QList<QObject *> m_focusChain; // List of current objects to be focused
QQuickItem *m_focusedItem; // Pointer to the active focus item
QStack<QObject *> m_rootObjects;
QSharedPointer<QQuickItem> m_defaultFocusItem;
ListViewFocusController* m_lvfc; // ListView focus manager
ListViewFocusController *m_lvfc; // ListView focus manager
signals:
void focusedItemChanged();