本文整理汇总了C++中KHTMLView::contentsHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ KHTMLView::contentsHeight方法的具体用法?C++ KHTMLView::contentsHeight怎么用?C++ KHTMLView::contentsHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KHTMLView
的用法示例。
在下文中一共展示了KHTMLView::contentsHeight方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: atBottom
bool Viewer::atBottom() const
{
Q_D(const Viewer);
KHTMLView *view = d->mViewer->view();
return view->contentsY() + view->visibleHeight() >= view->contentsHeight();
}
示例2: paint
void RenderWidget::paint(PaintInfo& i, int _tx, int _ty)
{
if (!shouldPaint(i, _tx, _ty)) return;
_tx += m_x;
_ty += m_y;
if (shouldPaintBackgroundOrBorder() && i.phase != PaintActionOutline)
paintBoxDecorations(i, _tx, _ty);
#if APPLE_CHANGES
if (!m_widget || !m_view || i.phase != PaintActionForeground ||
style()->visibility() != VISIBLE)
return;
// Move the widget if necessary. We normally move and resize widgets during layout, but sometimes
// widgets can move without layout occurring (most notably when you scroll a document that
// contains fixed positioned elements).
int newX = _tx + borderLeft() + paddingLeft();
int newY = _ty + borderTop() + paddingTop();
if (m_view->childX(m_widget) != newX || m_view->childY(m_widget) != newY)
m_widget->move(newX, newY);
// Tell the widget to paint now. This is the only time the widget is allowed
// to paint itself. That way it will composite properly with z-indexed layers.
m_widget->paint(i.p, i.r);
// Paint a partially transparent wash over selected widgets.
if (m_selectionState != SelectionNone) {
QBrush brush(selectionColor(i.p));
QRect selRect(selectionRect());
i.p->fillRect(selRect.x(), selRect.y(), selRect.width(), selRect.height(), brush);
}
#else
if (!m_widget || !m_view || i.phase != PaintActionForeground)
return;
if (style()->visibility() != VISIBLE) {
m_widget->hide();
return;
}
int xPos = _tx+borderLeft()+paddingLeft();
int yPos = _ty+borderTop()+paddingTop();
int childw = m_widget->width();
int childh = m_widget->height();
if ( (childw == 2000 || childh == 3072) && m_widget->inherits( "KHTMLView" ) ) {
KHTMLView *vw = static_cast<KHTMLView *>(m_widget);
int cy = m_view->contentsY();
int ch = m_view->visibleHeight();
int childx = m_view->childX( m_widget );
int childy = m_view->childY( m_widget );
int xNew = xPos;
int yNew = childy;
// qDebug("cy=%d, ch=%d, childy=%d, childh=%d", cy, ch, childy, childh );
if ( childh == 3072 ) {
if ( cy + ch > childy + childh ) {
yNew = cy + ( ch - childh )/2;
} else if ( cy < childy ) {
yNew = cy + ( ch - childh )/2;
}
// qDebug("calculated yNew=%d", yNew);
}
yNew = kMin( yNew, yPos + m_height - childh );
yNew = kMax( yNew, yPos );
if ( yNew != childy || xNew != childx ) {
if ( vw->contentsHeight() < yNew - yPos + childh )
vw->resizeContents( vw->contentsWidth(), yNew - yPos + childh );
vw->setContentsPos( xNew - xPos, yNew - yPos );
}
xPos = xNew;
yPos = yNew;
}
m_view->addChild(m_widget, xPos, yPos );
m_widget->show();
#endif
}