本文整理汇总了C++中QWebFrame::setScrollBarPolicy方法的典型用法代码示例。如果您正苦于以下问题:C++ QWebFrame::setScrollBarPolicy方法的具体用法?C++ QWebFrame::setScrollBarPolicy怎么用?C++ QWebFrame::setScrollBarPolicy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWebFrame
的用法示例。
在下文中一共展示了QWebFrame::setScrollBarPolicy方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createMenuFinished
//---------------------------------------------------------------------------
void MenuMainWindow::createMenuFinished(bool)
{
if (!MenuView)
return;
QWebFrame *frame = MenuView->page()->currentFrame();
frame->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
frame->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
}
示例2: load
void WebCapture::load(const QUrl &url)
{
QWebFrame *frame = page_.mainFrame();
frame->load(url);
frame->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
frame->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
if (progress) {
progress->setValue(0);
if ( progress->isHidden())
progress->setVisible(true);
}
qDebug()<< frame->baseUrl();
qDebug()<< "loading start";
}
示例3: setScrollBarPolicy
void QWebFrameProto::setScrollBarPolicy(Qt::Orientation orientation, Qt::ScrollBarPolicy policy)
{
scriptDeprecated("QWebFrame will not be available in future versions");
QWebFrame *item = qscriptvalue_cast<QWebFrame*>(thisObject());
if (item)
item->setScrollBarPolicy(orientation, policy);
}
示例4: activateOn
void FlickScroll::activateOn(QWebView *webView)
{
QWebFrame *frame = webView->page()->mainFrame();
frame->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
frame->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
webView->installEventFilter(this);
int removed = flickScroll_pm->flickData.remove(webView);
printf("FlickScroll::activateOn removed %d items from hash\n", removed);
FlickData * newFlickData = new FlickData();
flickScroll_pm->flickData[webView] = newFlickData;
newFlickData->widget = webView;
newFlickData->state = FlickData::Steady;
}
示例5: setWidget
void setWidget(QWebView* widget)
{
if (m_view) {
m_view->removeEventFilter(this);
QWebFrame* frame = m_view->page()->mainFrame();
frame->setScrollBarPolicy(Qt::Vertical, m_oldVerticalScrollBarPolicy);
frame->setScrollBarPolicy(Qt::Horizontal, m_oldHorizontalScrollBarPolicy);
}
m_view = widget;
setParent(m_view);
if (m_view) {
QWebFrame* frame = m_view->page()->mainFrame();
m_oldHorizontalScrollBarPolicy = frame->scrollBarPolicy(Qt::Horizontal);
m_oldVerticalScrollBarPolicy = frame->scrollBarPolicy(Qt::Vertical);
frame->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
frame->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
m_view->installEventFilter(this);
}
}
示例6: setPage
/*!
Makes \a page the new web page of the web view.
The parent QObject of the provided page remains the owner
of the object. If the current document is a child of the web
view, it will be deleted.
\sa page()
*/
void QWebViewItem::setPage(QWebPage *page)
{
if (d->page == page)
return;
if (d->page) {
if (d->page->parent() == this) {
delete d->page;
} else {
d->page->disconnect(this);
}
}
d->page = page;
if (d->page) {
QWebFrame *mainFrame = d->page->mainFrame();
mainFrame->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
mainFrame->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
connect(mainFrame, SIGNAL(titleChanged(const QString &)),
this, SIGNAL(titleChanged(const QString &)));
connect(mainFrame, SIGNAL(iconChanged()),
this, SIGNAL(iconChanged()));
connect(mainFrame, SIGNAL(urlChanged(const QUrl &)),
this, SIGNAL(urlChanged(const QUrl &)));
connect(d->page, SIGNAL(loadStarted()),
this, SIGNAL(loadStarted()));
connect(d->page, SIGNAL(loadProgress(int)),
this, SIGNAL(loadProgress(int)));
connect(d->page, SIGNAL(loadFinished(bool)),
this, SIGNAL(loadFinished(bool)));
connect(d->page, SIGNAL(statusBarMessage(const QString &)),
this, SIGNAL(statusBarMessage(const QString &)));
connect(d->page, SIGNAL(linkClicked(const QUrl &)),
this, SIGNAL(linkClicked(const QUrl &)));
connect(d->page, SIGNAL(repaintRequested(const QRect &)), this, SLOT(repaintDirty(const QRect &)));
connect(d->page, SIGNAL(scrollRequested(int, int, const QRect &)), this, SLOT(scrollReqest(int, int, const QRect &)));
connect(this, SIGNAL(loadFinished(bool)), this, SLOT(loaded(bool)));
connect(this, SIGNAL(loadStarted()), this, SLOT(startTimers()));
}
示例7: activateOn
void FlickCharm::activateOn(QWidget *widget)
{
QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea*>(widget);
if (scrollArea) {
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
QWidget *viewport = scrollArea->viewport();
viewport->installEventFilter(this);
scrollArea->installEventFilter(this);
d->flickData.remove(viewport);
d->flickData[viewport] = new FlickData;
d->flickData[viewport]->widget = widget;
d->flickData[viewport]->state = FlickData::Steady;
return;
}
QWebView *webView = qobject_cast<QWebView*>(widget);
if (webView) {
QWebFrame *frame = webView->page()->mainFrame();
frame->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
frame->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
webView->installEventFilter(this);
d->flickData.remove(webView);
d->flickData[webView] = new FlickData;
d->flickData[webView]->widget = webView;
d->flickData[webView]->state = FlickData::Steady;
return;
}
qWarning() << "FlickCharm only works on QAbstractScrollArea (and derived classes)";
qWarning() << "or QWebView (and derived classes)";
}
示例8: pal
ItemWeb::ItemWeb(const QString &html, QWidget *parent)
: QWebView(parent)
, ItemWidget(this)
{
QWebFrame *frame = page()->mainFrame();
frame->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
frame->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
const QFont &defaultFont = font();
settings()->setFontFamily(QWebSettings::StandardFont, defaultFont.family());
// DPI resolution can be different than the one used by this widget.
QWidget* window = QApplication::desktop()->screen();
int dpi = window->logicalDpiX();
int pt = defaultFont.pointSize();
settings()->setFontSize(QWebSettings::DefaultFontSize, pt * dpi / 72);
history()->setMaximumItemCount(0);
QPalette pal(palette());
pal.setBrush(QPalette::Base, Qt::transparent);
page()->setPalette(pal);
setAttribute(Qt::WA_OpaquePaintEvent, false);
connect( frame, SIGNAL(loadFinished(bool)),
this, SLOT(onItemChanged()) );
connect( frame, SIGNAL(contentsSizeChanged(QSize)),
this, SLOT(onItemChanged()) );
connect( frame, SIGNAL(loadFinished(bool)),
this, SLOT(onItemChanged()) );
connect( frame, SIGNAL(contentsSizeChanged(QSize)),
this, SLOT(onItemChanged()) );
// Selecting text copies it to clipboard.
connect( this, SIGNAL(selectionChanged()), SLOT(onSelectionChanged()) );
setHtml(html);
updateSize();
updateItem();
}
示例9: loadViewLayout
/*!
View layout loading from XML
*/
void NmViewerView::loadViewLayout()
{
NM_FUNCTION;
// Use document loader to load the view
bool ok(false);
setObjectName(QString(NMUI_MESSAGE_VIEWER_VIEW));
QObjectList objectList;
objectList.append(this);
// Pass the view to documentloader. Document loader uses this view
// when docml is parsed, instead of creating new view.
// documentloader is created in constructor
mDocumentLoader->setObjectTree(objectList);
mWidgetList = mDocumentLoader->load(NMUI_MESSAGE_VIEWER_XML, &ok);
if (ok)
{
// Create content and content layout
// qobject_cast not work in this case, using reinterpret_cast
mViewerContent = reinterpret_cast<HbWidget *>(
mDocumentLoader->findObject(NMUI_MESSAGE_VIEWER_CONTENT));
// Find scroll area
mScrollArea = reinterpret_cast<HbScrollArea *>(
mDocumentLoader->findObject(NMUI_MESSAGE_VIEWER_SCROLL_AREA));
if (mScrollArea) {
mScrollArea->setParentItem(this);
mScrollArea->setScrollDirections(Qt::Vertical | Qt::Horizontal);
connect(mScrollArea, SIGNAL(scrollPositionChanged(QPointF)),
this, SLOT(contentScrollPositionChanged(QPointF)));
// Get scroll area contents and set layout margins
mScrollAreaContents = qobject_cast<HbWidget *>(
mDocumentLoader->findObject(NMUI_MESSAGE_VIEWER_SCROLL_AREA_CONTENTS));
if (mScrollAreaContents) {
QGraphicsLayout *layout = mScrollAreaContents->layout();
if (layout){
layout->setContentsMargins(0,0,0,0);
}
// Set white pixmap to backgrounditem
QPixmap whitePixmap(NmWhitePixmapSize,NmWhitePixmapSize);
whitePixmap.fill(Qt::white);
QGraphicsPixmapItem *pixmapItem = new QGraphicsPixmapItem(whitePixmap);
mScrollAreaContents->setBackgroundItem(pixmapItem);
}
// Load headerwidget
mHeaderWidget = qobject_cast<NmViewerHeader *>(
mDocumentLoader->findObject(NMUI_MESSAGE_VIEWER_HEADER));
if (mHeaderWidget) {
mHeaderWidget->setView(this);
mHeaderWidget->rescaleHeader(mScreenSize);
mHeaderWidget->setMessage(mMessage);
QPointF headerStartPos = mHeaderWidget->scenePos();
mHeaderStartScenePos = QPointF(0,headerStartPos.y());
}
// Load webview
mWebView = reinterpret_cast<NmMailViewerWK *>(
mDocumentLoader->findObject(QString(NMUI_MESSAGE_VIEWER_SCROLL_WEB_VIEW)));
if (mWebView) {
// Set auto load images and private browsing(no history) attributes
QWebSettings *settings = mWebView->settings();
if (settings) {
settings->setAttribute(QWebSettings::AutoLoadImages, true);
settings->setAttribute(QWebSettings::PrivateBrowsingEnabled, true);
}
QWebPage *page = mWebView->page();
if (page) {
QWebFrame *frame = page->mainFrame();
if (frame) {
frame->setScrollBarPolicy(Qt::Vertical,Qt::ScrollBarAlwaysOff);
frame->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
frame->setTextSizeMultiplier(NmZoomFactor);
connect(mWebView->page()->mainFrame(),
SIGNAL(contentsSizeChanged(const QSize&)),
this, SLOT(scaleWebViewWhenLoading(const QSize&)));
}
}
}
}
}
}