QAccessible and QPushButton
-
Maybe they will already be set implicitly also by Qt at appropriate places, but make sure and set them manually.
[quote author="Kudaiv" date="1390217637"]
I guess i need to set Accessiblename and AccessibleDescription - that's right? And VoiceOver will read accessibleName when focus on my widget?
[/quote]
Can't answer that, sry. Never used accessibility on a Mac. -
Ok, i found this post http://stackoverflow.com/questions/3893560/qt-accessible-widgets and it seems easy, so tried like this
@
#include <QLabel>
#include <QtPlugin>Q_IMPORT_PLUGIN(qtaccessiblewidgets)
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QLabel pb("Hello");
pb.setAccessibleName("Helloo");
pb.setAccessibleDescription("Button");
pb.show();
return a.exec();
}
@@QT += core gui
TARGET = test_voice_over
TEMPLATE = appSOURCES += main.cpp
HEADERS += WidgetInterface.h
QTPLUGIN += qtaccessiblewidgets
@
every time i've got this error
"qt_plugin_instance_qtaccessiblewidgets()", referenced from:
global constructors keyed to mainin main.o
ld: symbol(s) not found for architecture x86_64what's wrong?
-
you do not need this line in your pro-File:
QTPLUGIN += qtaccessiblewidgetsthe qtaccessiblewidgets plugin is loaded automatically at runtime ifQt is able to find it.
You only need this line when you build your app statically. Which doesn't look so seeing the rest of the pro-File.
-
Thank you! And now i think that my Qt were build with no-accessibility...
and@qt_plugin_instance_qtaccessiblewidgets()”, referenced from: global constructors keyed to mainin main.o
ld: symbol(s) not found for architecture x86_64
@
testifies about it. But i can find qtaccessiblewidgets plugin in standart plugin path... -
[quote author="raven-worx" date="1390375476"]you do not need this line in your pro-File:
QTPLUGIN += qtaccessiblewidgetsthe qtaccessiblewidgets plugin is loaded automatically at runtime ifQt is able to find it.
You only need this line when you build your app statically. Which doesn't look so seeing the rest of the pro-File.
[/quote]Q_IMPORT_PLUGIN(qtaccessiblewidgets)
this need for static plugins too? -
yes, see "this":http://qt-project.org/doc/qt-4.8/plugins-howto.html#static-plugins.
If you link your application dynamically to Qt you don't have to worry about anything in your code. Just that the plugins are located in the correct path. -
it's funny but qt can't load libqtaccessiblewidgets.dylib in runtime
(i'm using DYLD_PRINT_LIBRARIES=1 QT_DEBUG_PLUGINS=1 myapp)
so i'm doing something like this
@ QPluginLoader loader(a.applicationDirPath() + "/../PlugIns/accessible/libqtaccessiblewidgets.dylib");
qDebug() << a.applicationDirPath();
bool isLoad = loader.load();
qDebug() << isLoad << " " << loader.errorString() ; @
and qt.conf on it's place! And nothing...
but when i'm using DYLD_PRINT_LIBRARIES=1 QT_DEBUG_PLUGINS=1 myapp i see this
QFactoryLoader::QFactoryLoader() looking at "/Users/sergey/test_voice_over/test_voice_over.app/Contents/PlugIns/accessible/libqtaccessiblewidgets.dylib"
keys ("QLineEdit", "QComboBox", "QAbstractSpinBox", "QSpinBox", "QDoubleSpinBox", "QScrollBar", "QSlider", "QAbstractSlider", "QToolButton", "QCheckBox", "QRadioButton", "QPushButton", "QAbstractButton", "QDialog", "QMessageBox", "QMainWindow", "QLabel", "QLCDNumber", "QGroupBox", "QStatusBar", "QProgressBar", "QMenuBar", "Q3PopupMenu", "QMenu", "QHeaderView", "QTabBar", "QToolBar", "QWorkspaceChild", "QSizeGrip", "QAbstractItemView", "QWidget", "QSplitter", "QSplitterHandle", "QTextEdit", "QPlainTextEdit", "QTipLabel", "QFrame", "QStackedWidget", "QToolBox", "QMdiArea", "QMdiSubWindow", "QWorkspace", "QDialogButtonBox", "QDial", "QRubberBand", "QTextBrowser", "QAbstractScrollArea", "QScrollArea", "QCalendarWidget", "QDockWidget")and trying to create simpliest app with one button with VoiceOver support
@int main(int argc, char *argv[])
{
QApplication a(argc, argv);QPluginLoader loader(a.applicationDirPath() + "/../PlugIns/accessible/libqtaccessiblewidgets.dylib"); qDebug() << a.applicationDirPath(); bool isLoad = loader.load(); qDebug() << isLoad << " " << loader.errorString() ; QPushButton pb("Hello button"); pb.show(); return a.exec();}
@
WSAA works fine with this code... what's wrong with voice over? -
which version of Qt are you using? Qt 4 or Qt 5?
With Qt (5.1?) the accessible support has been "improved ":http://blog.qt.digia.com/blog/2012/06/18/qt-5-accessibility-apis/on Mac OS X.