本文整理汇总了C++中ImageView::accessibility方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageView::accessibility方法的具体用法?C++ ImageView::accessibility怎么用?C++ ImageView::accessibility使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageView
的用法示例。
在下文中一共展示了ImageView::accessibility方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Container
Container *LightningCrossfadeApp::setUpImageContainer()
{
// In this function a Container containing two images are set up.
// A dock layout is used to align the images.
Container* nightAndDayContainer = new Container();
nightAndDayContainer->setLayout(new DockLayout());
// The first image is the night image, taken at the same
// position as the day one, but further from the viewer.
ImageView* night = ImageView::create("asset:///images/night.jpg");
// Center it using alignment.
night->setHorizontalAlignment(HorizontalAlignment::Center);
night->setVerticalAlignment(VerticalAlignment::Center);
// Add A11y description to the image
night->accessibility()->setDescription(
"This is the night image. Change it with the slider in the bottom of the screen.");
// Now, we will overlay the day image on top of the night image.
// Since the day image is on top of the night one, we can show the
// night image with changing the opacity value of this image.
ImageView* day = ImageView::create("asset:///images/day.jpg").opacity(0);
// Center it using alignment.
day->setHorizontalAlignment(HorizontalAlignment::Center);
day->setVerticalAlignment(VerticalAlignment::Center);
// Add A11y description to the image
day->accessibility()->setDescription(
"This is the day image. Change it with the slider in the bottom of the screen");
// The day image is attached to the slider later. We need to be able to
// find the object at a later point in time so an object name is assigned.
day->setObjectName("dayImage");
// Now add all the images to the Container and the alignment will be
// automatically done by the layout system.
nightAndDayContainer->add(night);
nightAndDayContainer->add(day);
return nightAndDayContainer;
}
示例2: NSRTranslator
NSRTocPage::NSRTocPage (bb::cascades::NavigationPane *naviPane, QObject *parent) :
Page (parent),
_translator (NULL),
_toc (NULL),
_naviPane (naviPane),
_listView (NULL),
_model (NULL),
_emptyContainer (NULL),
_noTocLabel (NULL),
_noFileLabel (NULL)
{
_translator = new NSRTranslator (this);
Container *rootContainer = Container::create().horizontal(HorizontalAlignment::Fill)
.vertical(VerticalAlignment::Fill)
.layout(DockLayout::create ());
_listView = new ListView ();
_listView->setVerticalAlignment (VerticalAlignment::Fill);
_listView->setHorizontalAlignment (HorizontalAlignment::Fill);
_listView->setListItemProvider (new NSRTocItemFactory ());
bool ok = connect (_listView, SIGNAL (triggered (QVariantList)), this, SLOT (onListItemTriggered (QVariantList)));
Q_UNUSED (ok);
Q_ASSERT (ok);
Label *emptyLabel = Label::create().horizontal(HorizontalAlignment::Center)
.vertical(VerticalAlignment::Center)
.multiline(true)
.text(trUtf8 ("No contents", "List of contents related to opened file"));
emptyLabel->textStyle()->setFontSize (FontSize::Large);
emptyLabel->textStyle()->setTextAlign (TextAlign::Center);
_noTocLabel = Label::create().horizontal(HorizontalAlignment::Center)
.vertical(VerticalAlignment::Center)
.multiline(true)
.text(trUtf8 ("No contents to display"));
_noTocLabel->textStyle()->setFontSize (FontSize::Medium);
_noTocLabel->textStyle()->setTextAlign (TextAlign::Center);
_noFileLabel = Label::create().horizontal(HorizontalAlignment::Center)
.vertical(VerticalAlignment::Center)
.multiline(true)
.text(trUtf8 ("Open file to display contents"));
_noFileLabel->textStyle()->setFontSize (FontSize::Medium);
_noFileLabel->textStyle()->setTextAlign (TextAlign::Center);
ImageView *emptyImage = ImageView::create().horizontal(HorizontalAlignment::Center)
.vertical(VerticalAlignment::Center)
.imageSource(QUrl ("asset:///contents-area.png"));
#if BBNDK_VERSION_AT_LEAST(10,2,0)
emptyImage->accessibility()->setName (trUtf8 ("Image of contents"));
#endif
_emptyContainer = Container::create().horizontal(HorizontalAlignment::Center)
.vertical(VerticalAlignment::Center)
.layout(StackLayout::create ());
#if BBNDK_VERSION_AT_LEAST(10,3,1)
_emptyContainer->setLeftPadding (ui()->sddu (2));
_emptyContainer->setRightPadding (ui()->sddu (2));
#elif BBNDK_VERSION_AT_LEAST(10,3,0)
_emptyContainer->setLeftPadding (ui()->sdu (2));
_emptyContainer->setRightPadding (ui()->sdu (2));
#else
_emptyContainer->setLeftPadding (20);
_emptyContainer->setRightPadding (20);
#endif
_emptyContainer->add (emptyImage);
_emptyContainer->add (emptyLabel);
_emptyContainer->add (_noTocLabel);
_emptyContainer->add (_noFileLabel);
rootContainer->add (_listView);
rootContainer->add (_emptyContainer);
rootContainer->setBackground (NSRThemeSupport::instance()->getBackground ());
setContent (rootContainer);
setTitleBar (TitleBar::create().title(trUtf8 ("Contents", "Title for window with contents")));
_translator->addTranslatable ((UIObject *) emptyLabel,
NSRTranslator::NSR_TRANSLATOR_TYPE_LABEL,
QString ("NSRTocPage"),
QString ("No contents"));
_translator->addTranslatable ((UIObject *) _noTocLabel,
NSRTranslator::NSR_TRANSLATOR_TYPE_LABEL,
QString ("NSRTocPage"),
QString ("No contents to display"));
_translator->addTranslatable ((UIObject *) _noFileLabel,
NSRTranslator::NSR_TRANSLATOR_TYPE_LABEL,
QString ("NSRTocPage"),
QString ("Open file to display contents"));
_translator->addTranslatable ((UIObject *) titleBar (),
NSRTranslator::NSR_TRANSLATOR_TYPE_TITLEBAR,
QString ("NSRTocPage"),
QString ("Contents"));
#if BBNDK_VERSION_AT_LEAST(10,2,0)
//.........这里部分代码省略.........