20#include "TabBarQuick_p.h"
27TabBarQuick::TabBarQuick(TabWidget *parent)
28 : QWidgetAdapter(parent->asWidget())
29 , TabBar(this, parent)
33int TabBarQuick::tabAt(
QPoint p)
const
38 if (!m_tabBarQmlItem) {
39 qWarning() << Q_FUNC_INFO <<
"No visual tab bar item yet";
43 if (QQuickItem *internalListView = listView()) {
46 Q_ARG(
double, p.
x()), Q_ARG(
double, p.
y()));
50 qWarning() << Q_FUNC_INFO <<
"Couldn't find the internal ListView";
56QQuickItem *TabBarQuick::tabBarQmlItem()
const
58 return m_tabBarQmlItem;
61void TabBarQuick::setTabBarQmlItem(QQuickItem *item)
63 m_tabBarQmlItem = item;
66QString TabBarQuick::text(
int index)
const
68 if (QQuickItem *item = tabAt(index))
69 return item->property(
"text").toString();
74QRect TabBarQuick::rectForTab(
int index)
const
76 if (QQuickItem *item = tabAt(index))
77 return item->boundingRect().toRect();
82bool TabBarQuick::event(
QEvent *ev)
87 if (m_tabBarQmlItem) {
89 m_tabBarQmlItem->setProperty(
"currentIndex", tabAt(me->pos()));
91 TabBar::onMousePress(me->pos());
93 TabBar::onMouseDoubleClick(me->pos());
102 return QWidgetAdapter::event(ev);
105QQuickItem *TabBarQuick::tabAt(
int index)
const
107 QQuickItem *view = listView();
111 QQuickItem *item =
nullptr;
118QQuickItem *TabBarQuick::listView()
const
122 if (!m_tabBarQmlItem)
126 for (QQuickItem *child : children) {
127 if (qstrcmp(child->metaObject()->className(),
"QQuickListView") == 0)
134void TabBarQuick::moveTabTo(
int from,
int to)
QEvent::Type type() const const