本文整理汇总了C++中TabWidget::newTab方法的典型用法代码示例。如果您正苦于以下问题:C++ TabWidget::newTab方法的具体用法?C++ TabWidget::newTab怎么用?C++ TabWidget::newTab使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TabWidget
的用法示例。
在下文中一共展示了TabWidget::newTab方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: currentWebView
WebView *TabWidget::webView(int index) const
{
QWidget *widget = this->widget(index);
if (WebViewWithSearch *webViewWithSearch = qobject_cast<WebViewWithSearch*>(widget)) {
return webViewWithSearch->m_webView;
} else if (widget) {
// optimization to delay creating the first webview
if (count() == 1) {
TabWidget *that = const_cast<TabWidget*>(this);
that->setUpdatesEnabled(false);
LocationBar *currentLocationBar = qobject_cast<LocationBar*>(m_locationBars->widget(0));
bool giveBackFocus = currentLocationBar->hasFocus();
m_locationBars->removeWidget(currentLocationBar);
m_locationBars->addWidget(new QWidget());
that->newTab();
that->closeTab(0);
QWidget *newEmptyLineEdit = m_locationBars->widget(0);
m_locationBars->removeWidget(newEmptyLineEdit);
newEmptyLineEdit->deleteLater();
m_locationBars->addWidget(currentLocationBar);
currentLocationBar->setWebView(currentWebView());
if (giveBackFocus)
currentLocationBar->setFocus();
that->setUpdatesEnabled(true);
that->m_swappedDelayedWidget = true;
return currentWebView();
}
}
return 0;
}
示例2: currentWebView
WebView *TabWidget::webView(int index) const
{
QWidget *widget = this->widget(index);
if (WebView *webView = qobject_cast<WebView*>(widget)) {
return webView;
} else {
// optimization to delay creating the first webview
if (count() == 1) {
TabWidget *that = const_cast<TabWidget*>(this);
that->setUpdatesEnabled(false);
that->newTab();
that->closeTab(0);
that->setUpdatesEnabled(true);
return currentWebView();
}
}
return 0;
}