Remove dead code from QAccessibleTabBar.
Change-Id: I084259184228beea4374e8c5370f9a21064cae26 Reviewed-on: http://codereview.qt-project.org/5526 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>bb10
parent
eee2de6aa1
commit
34f0f0bf7d
|
|
@ -1462,14 +1462,18 @@ class QAccessibleTabButton: public QAccessibleInterface, public QAccessibleActio
|
|||
Q_ACCESSIBLE_OBJECT
|
||||
public:
|
||||
QAccessibleTabButton(QTabBar *parent, int index)
|
||||
:m_index(index), m_parent(parent)
|
||||
: m_parent(parent), m_index(index)
|
||||
{}
|
||||
|
||||
QObject *object() const { return 0; }
|
||||
Role role(int child) const { Q_ASSERT(child == 0); return QAccessible::PageTab; }
|
||||
State state(int child) const { Q_ASSERT(child == 0); return QAccessible::Normal; }
|
||||
QRect rect(int child) const {
|
||||
Q_ASSERT(child == 0);
|
||||
State state(int) const {
|
||||
QAccessibleInterface *parentInterface = parent();
|
||||
State state = parentInterface->state();
|
||||
delete parentInterface;
|
||||
return state;
|
||||
}
|
||||
QRect rect(int) const {
|
||||
if (!isValid())
|
||||
return QRect();
|
||||
|
||||
|
|
@ -1508,7 +1512,10 @@ public:
|
|||
#ifndef QT_NO_ACTION
|
||||
int userActionCount(int) const { return 0; }
|
||||
QString actionText(int, Text, int) const { return QString(); }
|
||||
bool doAction(int, int, const QVariantList &) { return false; }
|
||||
bool doAction(int actionIndex, int, const QVariantList &) {
|
||||
doAction(actionIndex);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
// action interface
|
||||
|
|
@ -1516,8 +1523,10 @@ public:
|
|||
return 1;
|
||||
}
|
||||
|
||||
void doAction(int actionIndex) {
|
||||
m_parent->setCurrentIndex(m_index);
|
||||
void doAction(int actionIndex)
|
||||
{
|
||||
if (actionIndex == Press || actionIndex == DefaultAction)
|
||||
m_parent->setCurrentIndex(m_index);
|
||||
}
|
||||
|
||||
QString description(int actionIndex)
|
||||
|
|
@ -1545,19 +1554,15 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
|
||||
QPointer<QTabBar> m_parent;
|
||||
int m_index;
|
||||
// QString m_text;
|
||||
// QAccessible::Role m_role;
|
||||
// QRect m_rect;
|
||||
};
|
||||
|
||||
/*!
|
||||
Constructs a QAccessibleTabBar object for \a w.
|
||||
*/
|
||||
QAccessibleTabBar::QAccessibleTabBar(QWidget *w)
|
||||
: QAccessibleWidget(w)
|
||||
: QAccessibleWidget(w, PageTabList)
|
||||
{
|
||||
Q_ASSERT(tabBar());
|
||||
}
|
||||
|
|
@ -1608,16 +1613,6 @@ int QAccessibleTabBar::indexOfChild(const QAccessibleInterface *child) const
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*! \reimp */
|
||||
QRect QAccessibleTabBar::rect(int child) const
|
||||
{
|
||||
// FIXME
|
||||
if (tabBar()->isVisible()) {
|
||||
return QAccessibleWidget::rect(0);
|
||||
}
|
||||
return QRect();
|
||||
}
|
||||
|
||||
/*! \reimp */
|
||||
int QAccessibleTabBar::childCount() const
|
||||
{
|
||||
|
|
@ -1635,63 +1630,6 @@ QString QAccessibleTabBar::text(Text t, int child) const
|
|||
return QString();
|
||||
}
|
||||
|
||||
/*! \reimp */
|
||||
QAccessible::Role QAccessibleTabBar::role(int child) const
|
||||
{
|
||||
return PageTabList;
|
||||
}
|
||||
|
||||
/*! \reimp */
|
||||
QAccessible::State QAccessibleTabBar::state(int child) const
|
||||
{
|
||||
State st = QAccessibleWidget::state(0);
|
||||
|
||||
if (!child)
|
||||
return st;
|
||||
|
||||
QTabBar *tb = tabBar();
|
||||
|
||||
// if (child > tb->count()) {
|
||||
// QWidget *bt = button(child);
|
||||
// if (!bt)
|
||||
// return st;
|
||||
// if (bt->isEnabled() == false)
|
||||
// st |= Unavailable;
|
||||
// if (bt->isVisible() == false)
|
||||
// st |= Invisible;
|
||||
// if (bt->focusPolicy() != Qt::NoFocus && bt->isActiveWindow())
|
||||
// st |= Focusable;
|
||||
// if (bt->hasFocus())
|
||||
// st |= Focused;
|
||||
// return st;
|
||||
// }
|
||||
|
||||
if (!tb->isTabEnabled(child - 1))
|
||||
st |= Unavailable;
|
||||
else
|
||||
st |= Selectable;
|
||||
|
||||
if (!tb->currentIndex() == child - 1)
|
||||
st |= Selected;
|
||||
|
||||
return st;
|
||||
}
|
||||
|
||||
/*! \reimp */
|
||||
bool QAccessibleTabBar::doAction(int action, int child, const QVariantList &)
|
||||
{
|
||||
if (!child)
|
||||
return false;
|
||||
|
||||
if (action != QAccessible::DefaultAction && action != QAccessible::Press)
|
||||
return false;
|
||||
|
||||
if (!tabBar()->isTabEnabled(child - 1))
|
||||
return false;
|
||||
tabBar()->setCurrentIndex(child - 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
Selects the item with index \a child if \a on is true; otherwise
|
||||
unselects it. If \a extend is true and the selection mode is not
|
||||
|
|
|
|||
|
|
@ -238,13 +238,8 @@ public:
|
|||
explicit QAccessibleTabBar(QWidget *w);
|
||||
|
||||
int childCount() const;
|
||||
|
||||
QRect rect(int child) const;
|
||||
QString text(Text t, int child) const;
|
||||
Role role(int child) const;
|
||||
State state(int child) const;
|
||||
|
||||
bool doAction(int action, int child, const QVariantList ¶ms);
|
||||
bool setSelected(int child, bool on, bool extend);
|
||||
QVector<int> selection() const;
|
||||
|
||||
|
|
|
|||
|
|
@ -564,6 +564,7 @@ void tst_QAccessibility::sliderTest()
|
|||
QVERIFY(iface->isValid());
|
||||
|
||||
QCOMPARE(iface->childCount(), 0);
|
||||
QCOMPARE(iface->role(), QAccessible::Slider);
|
||||
|
||||
QAccessibleValueInterface *valueIface = iface->valueInterface();
|
||||
QVERIFY(valueIface != 0);
|
||||
|
|
@ -1305,32 +1306,45 @@ void tst_QAccessibility::tabTest()
|
|||
|
||||
// Test that the Invisible bit for the navigation buttons gets set
|
||||
// and cleared correctly.
|
||||
QAccessibleInterface *leftButton = interface->child(0);
|
||||
QCOMPARE(leftButton->role(), QAccessible::PushButton);
|
||||
QVERIFY(leftButton->state() & QAccessible::Invisible);
|
||||
delete leftButton;
|
||||
|
||||
QAccessibleInterface *child1 = interface->child(0);
|
||||
QVERIFY(child1);
|
||||
QVERIFY(child1->state() & QAccessible::Invisible);
|
||||
|
||||
const int lots = 10;
|
||||
const int lots = 5;
|
||||
for (int i = 0; i < lots; ++i)
|
||||
tabBar->addTab("Foo");
|
||||
|
||||
QAccessibleInterface *child1 = interface->child(0);
|
||||
QAccessibleInterface *child2 = interface->child(1);
|
||||
QVERIFY(child1);
|
||||
QCOMPARE(child1->role(), QAccessible::PageTab);
|
||||
QVERIFY(child2);
|
||||
QCOMPARE(child2->role(), QAccessible::PageTab);
|
||||
|
||||
QVERIFY((child1->state() & QAccessible::Invisible) == false);
|
||||
tabBar->hide();
|
||||
|
||||
QCoreApplication::processEvents();
|
||||
QTest::qWait(100);
|
||||
|
||||
QVERIFY(child1->state() & QAccessible::Invisible);
|
||||
|
||||
tabBar->show();
|
||||
tabBar->setCurrentIndex(0);
|
||||
|
||||
// Test that sending a focus action to a tab does not select it.
|
||||
interface->doAction(QAccessible::Focus, 2, QVariantList());
|
||||
child2->doAction(QAccessible::Focus, 2, QVariantList());
|
||||
QCOMPARE(tabBar->currentIndex(), 0);
|
||||
|
||||
// Test that sending a press action to a tab selects it.
|
||||
interface->doAction(QAccessible::Press, 2, QVariantList());
|
||||
child2->doAction(QAccessible::Press, 2, QVariantList());
|
||||
QCOMPARE(tabBar->currentIndex(), 1);
|
||||
|
||||
delete tabBar;
|
||||
delete interface;
|
||||
delete child1;
|
||||
delete child2;
|
||||
QTestAccessibility::clearEvents();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue