本文整理汇总了C++中QWebPage::setPreferredContentsSize方法的典型用法代码示例。如果您正苦于以下问题:C++ QWebPage::setPreferredContentsSize方法的具体用法?C++ QWebPage::setPreferredContentsSize怎么用?C++ QWebPage::setPreferredContentsSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWebPage
的用法示例。
在下文中一共展示了QWebPage::setPreferredContentsSize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateResizesToContentsForPage
void QGraphicsWebViewPrivate::updateResizesToContentsForPage()
{
ASSERT(page);
pageClient()->viewResizesToContents = resizesToContents;
if (resizesToContents) {
// resizes to contents mode requires preferred contents size to be set
if (!page->preferredContentsSize().isValid())
page->setPreferredContentsSize(QSize(960, 800));
QObject::connect(page->mainFrame(), SIGNAL(contentsSizeChanged(QSize)),
q, SLOT(_q_contentsSizeChanged(const QSize&)), Qt::UniqueConnection);
} else {
示例2: geometryChanged
void QDeclarativeWebView::geometryChanged(const QRectF& newGeometry, const QRectF& oldGeometry)
{
QWebPage* webPage = page();
if (newGeometry.size() != oldGeometry.size() && webPage) {
QSize contentSize = webPage->preferredContentsSize();
if (widthValid())
contentSize.setWidth(width());
if (heightValid())
contentSize.setHeight(height());
if (contentSize != webPage->preferredContentsSize())
webPage->setPreferredContentsSize(contentSize);
}
QDeclarativeItem::geometryChanged(newGeometry, oldGeometry);
}
示例3: updateResizesToContentsForPage
void QGraphicsWebViewPrivate::updateResizesToContentsForPage()
{
ASSERT(page);
if (resizesToContents) {
// resizes to contents mode requires preferred contents size to be set
if (!page->preferredContentsSize().isValid())
page->setPreferredContentsSize(QSize(960, 800));
#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
QObject::connect(page->mainFrame(), SIGNAL(contentsSizeChanged(QSize)),
q, SLOT(_q_contentsSizeChanged(const QSize&)), Qt::UniqueConnection);
#else
QObject::connect(page->mainFrame(), SIGNAL(contentsSizeChanged(QSize)),
q, SLOT(_q_contentsSizeChanged(const QSize&)));
#endif
} else {
示例4: setPreferredContentsSize
void QWebPageProto::setPreferredContentsSize(const QSize & size) const
{
QWebPage *item = qscriptvalue_cast<QWebPage*>(thisObject());
if (item)
item->setPreferredContentsSize(size);
}