本文整理汇总了C++中QWebPage::preferredContentsSize方法的典型用法代码示例。如果您正苦于以下问题:C++ QWebPage::preferredContentsSize方法的具体用法?C++ QWebPage::preferredContentsSize怎么用?C++ QWebPage::preferredContentsSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWebPage
的用法示例。
在下文中一共展示了QWebPage::preferredContentsSize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: preferredContentsSize
QSize QWebPageProto::preferredContentsSize() const
{
QWebPage *item = qscriptvalue_cast<QWebPage*>(thisObject());
if (item)
return item->preferredContentsSize();
return QSize();
}
示例3: 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 {
示例4: 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 {
示例5: transitionToCommittedForNewPage
void FrameLoaderClientQt::transitionToCommittedForNewPage()
{
ASSERT(m_frame);
ASSERT(m_webFrame);
QBrush brush = m_webFrame->page()->palette().brush(QPalette::Base);
QColor backgroundColor = brush.style() == Qt::SolidPattern ? brush.color() : QColor();
QWebPage* page = m_webFrame->page();
const QSize preferredLayoutSize = page->preferredContentsSize();
ScrollbarMode hScrollbar = (ScrollbarMode) m_webFrame->scrollBarPolicy(Qt::Horizontal);
ScrollbarMode vScrollbar = (ScrollbarMode) m_webFrame->scrollBarPolicy(Qt::Vertical);
bool hLock = hScrollbar != ScrollbarAuto;
bool vLock = vScrollbar != ScrollbarAuto;
m_frame->createView(m_webFrame->page()->viewportSize(),
backgroundColor, !backgroundColor.alpha(),
preferredLayoutSize.isValid() ? IntSize(preferredLayoutSize) : IntSize(),
preferredLayoutSize.isValid(),
hScrollbar, hLock,
vScrollbar, vLock);
}