本文整理汇总了C++中KHTMLView::contentsX方法的典型用法代码示例。如果您正苦于以下问题:C++ KHTMLView::contentsX方法的具体用法?C++ KHTMLView::contentsX怎么用?C++ KHTMLView::contentsX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KHTMLView
的用法示例。
在下文中一共展示了KHTMLView::contentsX方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initMouseEvent
void MouseEventImpl::initMouseEvent(const DOMString &typeArg, bool canBubbleArg, bool cancelableArg, const AbstractView &viewArg, long detailArg,
long screenXArg, long screenYArg, long clientXArg, long clientYArg, bool ctrlKeyArg, bool altKeyArg,
bool shiftKeyArg, bool metaKeyArg, unsigned short buttonArg, const Node &relatedTargetArg)
{
UIEventImpl::initUIEvent(typeArg, canBubbleArg, cancelableArg, viewArg, detailArg);
if(m_relatedTarget)
m_relatedTarget->deref();
m_screenX = screenXArg;
m_screenY = screenYArg;
m_clientX = clientXArg;
m_clientY = clientYArg;
m_pageX = clientXArg;
m_pageY = clientYArg;
KHTMLView *v;
if(view() && view()->document() && (v = view()->document()->view()))
{
m_pageX += v->contentsX();
m_pageY += v->contentsY();
}
m_ctrlKey = ctrlKeyArg;
m_altKey = altKeyArg;
m_shiftKey = shiftKeyArg;
m_metaKey = metaKeyArg;
m_button = buttonArg;
m_relatedTarget = relatedTargetArg.handle();
if(m_relatedTarget)
m_relatedTarget->ref();
// ### make this on-demand. its soo sloooow
computeLayerPos();
m_qevent = 0;
}
示例2: defaultEventHandler
void HTMLAnchorElementImpl::defaultEventHandler(EventImpl *evt)
{
bool keydown = evt->id() == EventImpl::KEYDOWN_EVENT && evt->isKeyRelatedEvent();
// React on clicks and on keypresses.
// Don't make this KEYUP_EVENT again, it makes khtml follow links
// it shouldn't, when pressing Enter in the combo.
if ( ( (evt->id() == EventImpl::CLICK_EVENT && !static_cast<MouseEventImpl*>(evt)->isDoubleClick()) ||
( keydown && m_focused)) && m_hasAnchor) {
MouseEventImpl *e = 0;
if ( evt->id() == EventImpl::CLICK_EVENT )
e = static_cast<MouseEventImpl*>( evt );
KeyEventBaseImpl *k = 0;
if (keydown)
k = static_cast<KeyEventBaseImpl *>( evt );
QString utarget;
QString url;
if ( e && e->button() == 2 ) {
HTMLElementImpl::defaultEventHandler(evt);
return;
}
if ( k ) {
if (k->virtKeyVal() != KeyEventBaseImpl::DOM_VK_ENTER) {
if (k->qKeyEvent())
k->qKeyEvent()->ignore();
HTMLElementImpl::defaultEventHandler(evt);
return;
}
if (k->qKeyEvent()) k->qKeyEvent()->accept();
}
url = khtml::parseURL(getAttribute(ATTR_HREF)).string();
utarget = getAttribute(ATTR_TARGET).string();
if ( e && e->button() == 1 )
utarget = "_blank";
if ( evt->target()->id() == ID_IMG ) {
HTMLImageElementImpl* img = static_cast<HTMLImageElementImpl*>( evt->target() );
if ( img && img->isServerMap() )
{
khtml::RenderImage *r = static_cast<khtml::RenderImage *>(img->renderer());
if(r && e)
{
KHTMLView* v = getDocument()->view();
int x = e->clientX();
int y = e->clientY();
int absx = 0;
int absy = 0;
if ( v ) {
x += v->contentsX();
y += v->contentsY();
}
r->absolutePosition(absx, absy);
url += QString("?%1,%2").arg( x - absx ).arg( y - absy );
}
else {
evt->setDefaultHandled();
HTMLElementImpl::defaultEventHandler(evt);
return;
}
}
}
if ( !evt->defaultPrevented() ) {
int state = 0;
int button = 0;
if ( e ) {
if ( e->ctrlKey() )
state |= Qt::ControlButton;
if ( e->shiftKey() )
state |= Qt::ShiftButton;
if ( e->altKey() )
state |= Qt::AltButton;
if ( e->metaKey() )
state |= Qt::MetaButton;
if ( e->button() == 0 )
button = Qt::LeftButton;
else if ( e->button() == 1 )
button = Qt::MidButton;
else if ( e->button() == 2 )
button = Qt::RightButton;
}
else if ( k )
{
if ( k->checkModifier(Qt::ShiftButton) )
state |= Qt::ShiftButton;
if ( k->checkModifier(Qt::AltButton) )
state |= Qt::AltButton;
if ( k->checkModifier(Qt::ControlButton) )
state |= Qt::ControlButton;
}
// ### also check if focused node is editable if not in designmode,
//.........这里部分代码省略.........