add reverse focus change to FocusController
This commit is contained in:
parent
78a4caa47e
commit
f189f7b6af
2 changed files with 160 additions and 106 deletions
|
|
@ -60,12 +60,12 @@ bool isOnTheScene(QObject* object)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!item->isVisible()) {
|
if (!item->isVisible()) {
|
||||||
qInfo() << "The item is not visible: " << item;
|
// qDebug() << "===>> The item is not visible: " << item;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QRectF itemRect = item->mapRectToScene(item->childrenRect());
|
QRectF itemRect = item->mapRectToScene(item->childrenRect());
|
||||||
|
|
||||||
QQuickWindow* window = item->window();
|
QQuickWindow* window = item->window();
|
||||||
if (!window) {
|
if (!window) {
|
||||||
qWarning() << "Couldn't get the window on the Scene check";
|
qWarning() << "Couldn't get the window on the Scene check";
|
||||||
|
|
@ -118,7 +118,7 @@ QList<QObject*> getSubChain(QObject* item)
|
||||||
&& isFocusable(child)
|
&& isFocusable(child)
|
||||||
&& (isOnTheScene(child))
|
&& (isOnTheScene(child))
|
||||||
&& isEnabled(child)
|
&& isEnabled(child)
|
||||||
) {
|
) {
|
||||||
res.append(child);
|
res.append(child);
|
||||||
} else {
|
} else {
|
||||||
res.append(getSubChain(child));
|
res.append(getSubChain(child));
|
||||||
|
|
@ -153,13 +153,17 @@ public:
|
||||||
~ListViewFocusController();
|
~ListViewFocusController();
|
||||||
|
|
||||||
void incrementIndex();
|
void incrementIndex();
|
||||||
void decrementCurrentIndex();
|
void decrementIndex();
|
||||||
void positionViewAtIndex();
|
void positionViewAtIndex();
|
||||||
void focusNextItem();
|
void focusNextItem();
|
||||||
void focusPreviousItem();
|
void focusPreviousItem();
|
||||||
void resetFocusChain();
|
void resetFocusChain();
|
||||||
|
bool isListViewFirstFocusItem();
|
||||||
|
bool isDelegateFirstFocusItem();
|
||||||
bool isListViewLastFocusItem();
|
bool isListViewLastFocusItem();
|
||||||
bool isDelegateLastFocusItem();
|
bool isDelegateLastFocusItem();
|
||||||
|
bool isReturnNeeded();
|
||||||
|
void viewToBegin();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int size() const;
|
int size() const;
|
||||||
|
|
@ -173,6 +177,7 @@ private:
|
||||||
QQuickItem* m_focusedItem;
|
QQuickItem* m_focusedItem;
|
||||||
qsizetype m_focusedItemIndex;
|
qsizetype m_focusedItemIndex;
|
||||||
qsizetype m_delegateIndex;
|
qsizetype m_delegateIndex;
|
||||||
|
bool m_isReturnNeeded;
|
||||||
};
|
};
|
||||||
|
|
||||||
ListViewFocusController::ListViewFocusController(QQuickItem* listView, QObject* parent)
|
ListViewFocusController::ListViewFocusController(QQuickItem* listView, QObject* parent)
|
||||||
|
|
@ -182,6 +187,7 @@ ListViewFocusController::ListViewFocusController(QQuickItem* listView, QObject*
|
||||||
, m_focusedItem{nullptr}
|
, m_focusedItem{nullptr}
|
||||||
, m_focusedItemIndex{-1}
|
, m_focusedItemIndex{-1}
|
||||||
, m_delegateIndex{0}
|
, m_delegateIndex{0}
|
||||||
|
, m_isReturnNeeded{false}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -212,7 +218,7 @@ void ListViewFocusController::incrementIndex()
|
||||||
m_delegateIndex++;
|
m_delegateIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ListViewFocusController::decrementCurrentIndex()
|
void ListViewFocusController::decrementIndex()
|
||||||
{
|
{
|
||||||
m_delegateIndex--;
|
m_delegateIndex--;
|
||||||
}
|
}
|
||||||
|
|
@ -241,11 +247,17 @@ QQuickItem* ListViewFocusController::focusedItem()
|
||||||
void ListViewFocusController::focusNextItem()
|
void ListViewFocusController::focusNextItem()
|
||||||
{
|
{
|
||||||
if (m_focusChain.empty()) {
|
if (m_focusChain.empty()) {
|
||||||
qDebug() << "Empty focusChain with current delegate: " << currentDelegate();
|
qDebug() << "Empty focusChain with current delegate: " << currentDelegate() << "Scanning for elements...";
|
||||||
m_focusChain = getSubChain(currentDelegate());
|
m_focusChain = getSubChain(currentDelegate());
|
||||||
}
|
}
|
||||||
|
if (m_focusChain.empty()) {
|
||||||
|
qWarning() << "No elements found. Returning from ListView...";
|
||||||
|
m_isReturnNeeded = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
m_focusedItemIndex++;
|
m_focusedItemIndex++;
|
||||||
m_focusedItem = qobject_cast<QQuickItem*>(m_focusChain.at(m_focusedItemIndex));
|
m_focusedItem = qobject_cast<QQuickItem*>(m_focusChain.at(m_focusedItemIndex));
|
||||||
|
qDebug() << "==>> Focused Item: " << m_focusedItem << " with Index: " << m_focusedItemIndex;
|
||||||
m_focusedItem->forceActiveFocus();
|
m_focusedItem->forceActiveFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -261,16 +273,36 @@ void ListViewFocusController::resetFocusChain()
|
||||||
m_focusedItemIndex = -1;
|
m_focusedItemIndex = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ListViewFocusController::isDelegateFirstFocusItem()
|
||||||
|
{
|
||||||
|
return m_focusedItem && (m_focusedItem == m_focusChain.first());
|
||||||
|
}
|
||||||
|
|
||||||
bool ListViewFocusController::isDelegateLastFocusItem()
|
bool ListViewFocusController::isDelegateLastFocusItem()
|
||||||
{
|
{
|
||||||
return m_focusedItem && (m_focusedItem == m_focusChain.last());
|
return m_focusedItem && (m_focusedItem == m_focusChain.last());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ListViewFocusController::isListViewFirstFocusItem()
|
||||||
|
{
|
||||||
|
return (m_delegateIndex == 0) && isDelegateFirstFocusItem();
|
||||||
|
}
|
||||||
|
|
||||||
bool ListViewFocusController::isListViewLastFocusItem()
|
bool ListViewFocusController::isListViewLastFocusItem()
|
||||||
{
|
{
|
||||||
return (m_delegateIndex == size() - 1) && isDelegateLastFocusItem();
|
return (m_delegateIndex == size() - 1) && isDelegateLastFocusItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ListViewFocusController::isReturnNeeded()
|
||||||
|
{
|
||||||
|
return m_isReturnNeeded;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ListViewFocusController::viewToBegin()
|
||||||
|
{
|
||||||
|
QMetaObject::invokeMethod(m_listView, "positionViewAtBeginning", Qt::AutoConnection);
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
FocusController::FocusController(QQmlApplicationEngine* engine, QObject *parent)
|
FocusController::FocusController(QQmlApplicationEngine* engine, QObject *parent)
|
||||||
|
|
@ -279,35 +311,31 @@ FocusController::FocusController(QQmlApplicationEngine* engine, QObject *parent)
|
||||||
, m_focusChain{}
|
, m_focusChain{}
|
||||||
, m_focusedItem{nullptr}
|
, m_focusedItem{nullptr}
|
||||||
, m_focusedItemIndex{-1}
|
, m_focusedItemIndex{-1}
|
||||||
, m_rootItem{nullptr}
|
, m_rootObjects{}
|
||||||
|
, m_defaultFocusItem{QSharedPointer<QQuickItem>()}
|
||||||
, m_lvfc{nullptr}
|
, m_lvfc{nullptr}
|
||||||
{
|
{
|
||||||
connect(this, &FocusController::rootItemChanged, this, &FocusController::reload);
|
// connect(this, &FocusController::rootItemChanged, this, &FocusController::onReload);
|
||||||
|
QObject::connect(m_engine.get(), &QQmlApplicationEngine::objectCreated, this, [this](QObject *object, const QUrl &url){
|
||||||
|
qDebug() << "===>> () CREATED " << object << " : " << url;
|
||||||
|
QQuickItem* newDefaultFocusItem = object->findChild<QQuickItem*>("defaultFocusItem");
|
||||||
|
if(newDefaultFocusItem && m_defaultFocusItem != newDefaultFocusItem) {
|
||||||
|
m_defaultFocusItem.reset(newDefaultFocusItem);
|
||||||
|
qDebug() << "===>> [] NEW DEFAULT FOCUS ITEM " << m_defaultFocusItem;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void FocusController::resetFocus()
|
void FocusController::nextItem(bool isForwardOrder)
|
||||||
{
|
|
||||||
reload();
|
|
||||||
if (m_focusChain.empty()) {
|
|
||||||
qWarning() << "There is no focusable elements";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(m_focusedItemIndex == -1) {
|
|
||||||
m_focusedItemIndex = 0;
|
|
||||||
m_focusedItem = qobject_cast<QQuickItem*>(m_focusChain.at(m_focusedItemIndex));
|
|
||||||
m_focusedItem->forceActiveFocus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void FocusController::nextKeyTabItem()
|
|
||||||
{
|
{
|
||||||
if (m_lvfc) {
|
if (m_lvfc) {
|
||||||
focusNextListViewItem();
|
isForwardOrder ? focusNextListViewItem() : focusPreviousListViewItem();
|
||||||
|
qDebug() << "===>> [handling the ListView]";
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
reload();
|
reload(isForwardOrder);
|
||||||
|
|
||||||
if(m_focusChain.empty()) {
|
if(m_focusChain.empty()) {
|
||||||
qWarning() << "There are no items to navigate";
|
qWarning() << "There are no items to navigate";
|
||||||
|
|
@ -325,29 +353,49 @@ void FocusController::nextKeyTabItem()
|
||||||
m_focusedItem = qobject_cast<QQuickItem*>(m_focusChain.at(m_focusedItemIndex));
|
m_focusedItem = qobject_cast<QQuickItem*>(m_focusChain.at(m_focusedItemIndex));
|
||||||
|
|
||||||
if(m_focusedItem == nullptr) {
|
if(m_focusedItem == nullptr) {
|
||||||
qWarning() << "Failed to get item to focus on";
|
qWarning() << "Failed to get item to focus on. Setting focus on default";
|
||||||
|
m_focusedItem = m_defaultFocusItem.get();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isListView(m_focusedItem)) {
|
if(isListView(m_focusedItem)) {
|
||||||
|
qDebug() << "===>> [Found ListView]";
|
||||||
m_lvfc = new ListViewFocusController(m_focusedItem, this);
|
m_lvfc = new ListViewFocusController(m_focusedItem, this);
|
||||||
focusNextListViewItem();
|
if(isForwardOrder) {
|
||||||
|
m_lvfc->viewToBegin();
|
||||||
|
focusNextListViewItem();
|
||||||
|
} else {
|
||||||
|
focusPreviousListViewItem();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qDebug() << "===>> Focused Item: " << m_focusedItem;
|
||||||
m_focusedItem->forceActiveFocus(Qt::TabFocusReason);
|
m_focusedItem->forceActiveFocus(Qt::TabFocusReason);
|
||||||
|
|
||||||
printItems(m_focusChain, m_focusedItem);
|
printItems(m_focusChain, m_focusedItem);
|
||||||
|
|
||||||
|
const auto w = m_defaultFocusItem->window();
|
||||||
|
|
||||||
|
qDebug() << "===>> CURRENT ACTIVE ITEM: " << w->activeFocusItem();
|
||||||
|
qDebug() << "===>> CURRENT FOCUS OBJECT: " << w->focusObject();
|
||||||
|
if(m_rootObjects.empty()) {
|
||||||
|
qDebug() << "===>> ROOT OBJECT IS DEFAULT";
|
||||||
|
} else {
|
||||||
|
qDebug() << "===>> ROOT OBJECT: " << m_rootObjects.top();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FocusController::focusNextListViewItem()
|
void FocusController::focusNextListViewItem()
|
||||||
{
|
{
|
||||||
m_lvfc->focusNextItem();
|
m_lvfc->focusNextItem();
|
||||||
|
|
||||||
if (m_lvfc->isListViewLastFocusItem()) {
|
if (m_lvfc->isListViewLastFocusItem() || m_lvfc->isReturnNeeded()) {
|
||||||
|
qDebug() << "===>> [Last item in ListView was reached]";
|
||||||
delete m_lvfc;
|
delete m_lvfc;
|
||||||
m_lvfc = nullptr;
|
m_lvfc = nullptr;
|
||||||
} else if (m_lvfc->isDelegateLastFocusItem()) {
|
} else if (m_lvfc->isDelegateLastFocusItem()) {
|
||||||
|
qDebug() << "===>> [End of delegate elements was reached. Going to the next delegate]";
|
||||||
m_lvfc->resetFocusChain();
|
m_lvfc->resetFocusChain();
|
||||||
m_lvfc->incrementIndex();
|
m_lvfc->incrementIndex();
|
||||||
m_lvfc->positionViewAtIndex();
|
m_lvfc->positionViewAtIndex();
|
||||||
|
|
@ -356,110 +404,121 @@ void FocusController::focusNextListViewItem()
|
||||||
|
|
||||||
void FocusController::focusPreviousListViewItem()
|
void FocusController::focusPreviousListViewItem()
|
||||||
{
|
{
|
||||||
// TODO: implement
|
m_lvfc->focusPreviousItem();
|
||||||
|
|
||||||
|
if (m_lvfc->isListViewFirstFocusItem() || m_lvfc->isReturnNeeded()) {
|
||||||
|
delete m_lvfc;
|
||||||
|
m_lvfc = nullptr;
|
||||||
|
} else if (m_lvfc->isDelegateFirstFocusItem()) {
|
||||||
|
m_lvfc->resetFocusChain();
|
||||||
|
m_lvfc->decrementIndex();
|
||||||
|
m_lvfc->positionViewAtIndex();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FocusController::nextKeyTabItem()
|
||||||
|
{
|
||||||
|
nextItem(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FocusController::previousKeyTabItem()
|
void FocusController::previousKeyTabItem()
|
||||||
{
|
{
|
||||||
reload();
|
nextItem(false);
|
||||||
|
|
||||||
if(m_focusChain.empty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_focusedItemIndex <= 0) {
|
|
||||||
m_focusedItemIndex = m_focusChain.size() - 1;
|
|
||||||
} else {
|
|
||||||
m_focusedItemIndex--;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_focusedItem = qobject_cast<QQuickItem*>(m_focusChain.at(m_focusedItemIndex));
|
|
||||||
m_focusedItem->forceActiveFocus(Qt::TabFocusReason);
|
|
||||||
|
|
||||||
qDebug() << "===>> Current focus was changed to " << m_focusedItem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FocusController::nextKeyUpItem()
|
void FocusController::nextKeyUpItem()
|
||||||
{
|
{
|
||||||
previousKeyTabItem();
|
nextItem(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FocusController::nextKeyDownItem()
|
void FocusController::nextKeyDownItem()
|
||||||
{
|
{
|
||||||
nextKeyTabItem();
|
nextItem(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FocusController::nextKeyLeftItem()
|
void FocusController::nextKeyLeftItem()
|
||||||
{
|
{
|
||||||
previousKeyTabItem();
|
nextItem(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FocusController::nextKeyRightItem()
|
void FocusController::nextKeyRightItem()
|
||||||
{
|
{
|
||||||
nextKeyTabItem();
|
nextItem(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FocusController::reload()
|
void FocusController::setFocusOnDefaultItem()
|
||||||
{
|
{
|
||||||
m_focusChain.clear();
|
qDebug() << "===>> Setting focus on DEFAULT FOCUS ITEM...";
|
||||||
|
m_defaultFocusItem->forceActiveFocus();
|
||||||
|
}
|
||||||
|
|
||||||
QObjectList rootObjects;
|
void FocusController::reload(bool isForwardOrder)
|
||||||
|
{
|
||||||
|
m_focusChain.clear();
|
||||||
|
|
||||||
const auto rootItem = m_rootItem;
|
QObject* rootObject = (m_rootObjects.empty()
|
||||||
|
? m_engine->rootObjects().value(0)
|
||||||
|
: m_rootObjects.top());
|
||||||
|
|
||||||
if (rootItem != nullptr) {
|
if(!rootObject) {
|
||||||
rootObjects << qobject_cast<QObject*>(rootItem);
|
qCritical() << "No ROOT OBJECT found!";
|
||||||
} else {
|
m_focusedItemIndex = -1;
|
||||||
rootObjects = m_engine->rootObjects();
|
resetRootObject();
|
||||||
}
|
setFocusOnDefaultItem();
|
||||||
|
|
||||||
if(rootObjects.empty()) {
|
|
||||||
qWarning() << "Empty focus chain detected!";
|
|
||||||
emit focusChainChanged();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(const auto object : rootObjects) {
|
qDebug() << "===>> ROOT OBJECTS: " << rootObject;
|
||||||
m_focusChain.append(getSubChain(object));
|
|
||||||
}
|
|
||||||
|
|
||||||
std::sort(m_focusChain.begin(), m_focusChain.end(), isLess);
|
m_focusChain.append(getSubChain(rootObject));
|
||||||
|
|
||||||
printItems(m_focusChain, m_focusedItem);
|
std::sort(m_focusChain.begin(), m_focusChain.end(), isForwardOrder? isLess : isMore);
|
||||||
|
|
||||||
emit focusChainChanged();
|
|
||||||
|
|
||||||
if (m_focusChain.empty()) {
|
if (m_focusChain.empty()) {
|
||||||
|
qWarning() << "Focus chain is empty!";
|
||||||
m_focusedItemIndex = -1;
|
m_focusedItemIndex = -1;
|
||||||
qWarning() << "reloaded to empty focus chain";
|
resetRootObject();
|
||||||
return;
|
setFocusOnDefaultItem();
|
||||||
}
|
|
||||||
|
|
||||||
QQuickWindow* window = qobject_cast<QQuickWindow*>(rootObjects[0]);
|
|
||||||
if (!window) {
|
|
||||||
window = qobject_cast<QQuickItem*>(rootObjects[0])->window();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!window) {
|
|
||||||
qCritical() << "Couldn't get the current window";
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_focusedItemIndex = m_focusChain.indexOf(m_focusedItem);
|
m_focusedItemIndex = m_focusChain.indexOf(m_focusedItem);
|
||||||
// m_focusedItemIndex = m_focusChain.indexOf(window->activeFocusItem());
|
|
||||||
|
|
||||||
if(m_focusedItemIndex == -1) {
|
if(m_focusedItemIndex == -1) {
|
||||||
qInfo() << "No focus item in chain. Moving focus to begin...";
|
qInfo() << "No focus item in chain.";
|
||||||
// m_focused_item_index = 0; // if not in focus chain current
|
setFocusOnDefaultItem();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FocusController::pushRootObject(QObject* object)
|
||||||
|
{
|
||||||
|
m_rootObjects.push(object);
|
||||||
|
qDebug() << "===>> ROOT OBJECT is changed to: " << m_rootObjects.top();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FocusController::dropRootObject(QObject* object)
|
||||||
|
{
|
||||||
|
if (m_rootObjects.empty()) {
|
||||||
|
qDebug() << "ROOT OBJECT is already NULL";
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// m_focusedItem = qobject_cast<QQuickItem*>(m_focusChain.at(m_focusedItemIndex));
|
if (m_rootObjects.top() == object) {
|
||||||
|
m_rootObjects.pop();
|
||||||
// m_focusedItem->forceActiveFocus();
|
if(m_rootObjects.size()) {
|
||||||
|
qDebug() << "===>> ROOT OBJECT is changed to: " << m_rootObjects.top();
|
||||||
|
} else {
|
||||||
|
qDebug() << "===>> ROOT OBJECT is changed to NULL";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
qWarning() << "===>> TRY TO DROP WRONG ROOT OBJECT: " << m_rootObjects.top() << " SHOULD BE: " << object;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FocusController::setRootItem(QQuickItem* item)
|
void FocusController::resetRootObject()
|
||||||
{
|
{
|
||||||
m_rootItem = item;
|
m_rootObjects.clear();
|
||||||
|
qDebug() << "===>> ROOT OBJECT IS RESETED";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,9 @@
|
||||||
#define FOCUSCONTROLLER_H
|
#define FOCUSCONTROLLER_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QStack>
|
||||||
|
#include <QSharedPointer>
|
||||||
|
|
||||||
|
|
||||||
class QQuickItem;
|
class QQuickItem;
|
||||||
class QQmlApplicationEngine;
|
class QQmlApplicationEngine;
|
||||||
|
|
@ -20,31 +23,23 @@ public:
|
||||||
Q_INVOKABLE void nextKeyDownItem();
|
Q_INVOKABLE void nextKeyDownItem();
|
||||||
Q_INVOKABLE void nextKeyLeftItem();
|
Q_INVOKABLE void nextKeyLeftItem();
|
||||||
Q_INVOKABLE void nextKeyRightItem();
|
Q_INVOKABLE void nextKeyRightItem();
|
||||||
|
Q_INVOKABLE void setFocusOnDefaultItem();
|
||||||
signals:
|
Q_INVOKABLE void resetRootObject();
|
||||||
void nextTabItemChanged(QObject* item);
|
Q_INVOKABLE void pushRootObject(QObject* object);
|
||||||
void previousTabItemChanged(QObject* item);
|
Q_INVOKABLE void dropRootObject(QObject* object);
|
||||||
void nextKeyUpItemChanged(QObject* item);
|
|
||||||
void nextKeyDownItemChanged(QObject* item);
|
|
||||||
void nextKeyLeftItemChanged(QObject* item);
|
|
||||||
void nextKeyRightItemChanged(QObject* item);
|
|
||||||
void focusChainChanged();
|
|
||||||
void rootItemChanged();
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void resetFocus();
|
|
||||||
void reload();
|
|
||||||
void setRootItem(QQuickItem* item);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void nextItem(bool isForwardOrder);
|
||||||
void focusNextListViewItem();
|
void focusNextListViewItem();
|
||||||
void focusPreviousListViewItem();
|
void focusPreviousListViewItem();
|
||||||
|
void reload(bool isForwardOrder);
|
||||||
|
|
||||||
QQmlApplicationEngine* m_engine; // Pointer to engine to get root object
|
QSharedPointer<QQmlApplicationEngine> m_engine; // Pointer to engine to get root object
|
||||||
QList<QObject*> m_focusChain; // List of current objects to be focused
|
QList<QObject*> m_focusChain; // List of current objects to be focused
|
||||||
QQuickItem* m_focusedItem; // Pointer to the active focus item
|
QQuickItem* m_focusedItem; // Pointer to the active focus item
|
||||||
qsizetype m_focusedItemIndex; // Active focus item's index in focus chain
|
qsizetype m_focusedItemIndex; // Active focus item's index in focus chain
|
||||||
QQuickItem* m_rootItem;
|
QStack<QObject*> m_rootObjects;
|
||||||
|
QSharedPointer<QQuickItem> m_defaultFocusItem;
|
||||||
|
|
||||||
ListViewFocusController* m_lvfc; // ListView focus manager
|
ListViewFocusController* m_lvfc; // ListView focus manager
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue