本文整理汇总了C++中WText::setInternalPathEncoding方法的典型用法代码示例。如果您正苦于以下问题:C++ WText::setInternalPathEncoding方法的具体用法?C++ WText::setInternalPathEncoding怎么用?C++ WText::setInternalPathEncoding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WText
的用法示例。
在下文中一共展示了WText::setInternalPathEncoding方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WContainerWidget
WWidget *WtHome::example(const char *textKey, const std::string& sourceDir)
{
WContainerWidget *result = new WContainerWidget();
WText *w = new WText(tr(textKey), result);
w->setInternalPathEncoding(true);
result->addWidget(linkSourceBrowser(sourceDir));
return result;
}
示例2: WText
WWidget *Home::linkSourceBrowser(const std::string& example)
{
/*
* Instead of using a WAnchor, which will not progress properly because
* it is wrapped with wrapView() (-- should we not fix that?), we use
* a WText which contains an anchor, and enable internal path encoding.
*/
std::string path = "#/" + SRC_INTERNAL_PATH + "/" + example;
WText *a = new WText(tr("source-browser-link").arg(path));
a->setInternalPathEncoding(true);
return a;
}
示例3: animation
WWidget *WtHome::examples()
{
WContainerWidget *result = new WContainerWidget();
WText *intro = new WText(tr("home.examples"));
intro->setInternalPathEncoding(true);
result->addWidget(intro);
examplesMenu_ = new WTabWidget(result);
WAnimation animation(WAnimation::SlideInFromRight, WAnimation::EaseIn);
examplesMenu_->contentsStack()->setTransitionAnimation(animation, true);
/*
* The following code is functionally equivalent to:
*
* examplesMenu_->addTab(helloWorldExample(), "Hello world");
*
* However, we optimize here for memory consumption (it is a homepage
* after all, and we hope to be slashdotted some day)
*
* Therefore, we wrap all the static content (including the tree
* widgets), into WViewWidgets with static models. In this way the
* widgets are not actually stored in memory on the server.
*/
// The call ->setPathComponent() is to use "/examples/" instead of
// "/examples/hello_world" as internal path
examplesMenu_->addTab(wrapView(&WtHome::helloWorldExample),
tr("hello-world"))->setPathComponent("");
examplesMenu_->addTab(wrapView(&WtHome::chartExample),
tr("charts"));
examplesMenu_->addTab(wrapView(&WtHome::homepageExample),
tr("wt-homepage"));
examplesMenu_->addTab(wrapView(&WtHome::treeviewExample),
tr("treeview"));
examplesMenu_->addTab(wrapView(&WtHome::gitExample),
tr("git"));
examplesMenu_->addTab(wrapView(&WtHome::chatExample),
tr("chat"));
examplesMenu_->addTab(wrapView(&WtHome::composerExample),
tr("mail-composer"));
examplesMenu_->addTab(wrapView(&WtHome::hangmanExample),
tr("hangman"));
examplesMenu_->addTab(wrapView(&WtHome::widgetGalleryExample),
tr("widget-gallery"));
// Enable internal paths for the example menu
examplesMenu_->setInternalPathEnabled("/examples");
examplesMenu_->currentChanged().connect(this, &Home::googleAnalyticsLogger);
return result;
}
示例4: sidebar
void BasePage::sidebar() {
_sidebar->clear();
_sidebar->setId("sidebar");
//_sidebar->addWidget(new WText("Sidebar Menu"));
WText *list;
list=new WText(
"<ul class='menu'>"
"<li> <a href='#/rate'> rate </a> </li>"
"<li> <a href='#/authors'> authors </a> </li>"
"<li> <a href='#/genres'> genres </a> </li>"
"<li> <a href='#/series'> series and cycles </a> </li>"
"<li> <a href='#/newbook'> add new book </a> </li>"
"<li> <a href='#/addmark'> add your mark </a> </li>"
"</ul>"
"<div class=\"footer\">"
"<p> <font color='white'> copyright by Alexey 2016 </font> </p>"
"<p> <a href='#/'> docs </a> |<a href='http://vk.com/id156854642'> myVk </a> </p>"
"</div>"
);
list->setInternalPathEncoding(true);
_sidebar->addWidget(list);
}