本文整理汇总了C++中QWebFrame::scrollBarValue方法的典型用法代码示例。如果您正苦于以下问题:C++ QWebFrame::scrollBarValue方法的具体用法?C++ QWebFrame::scrollBarValue怎么用?C++ QWebFrame::scrollBarValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWebFrame
的用法示例。
在下文中一共展示了QWebFrame::scrollBarValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mousePressEvent
void QMyWebView::mousePressEvent ( QMouseEvent * event ){
if((event->button()==Qt::LeftButton)&&(page()->mainFrame())){
QWebFrame *frame = page()->mainFrame();
oldX1 = event->globalX();
oldY1 = event->globalY();
oldvscrollval = frame->scrollBarValue(Qt::Vertical);
oldhscrollval = frame->scrollBarValue(Qt::Horizontal);
}
QWebView::mousePressEvent(event);
}
示例2: onMessage
void MainWindow::onMessage(IrcPrivateMessage *message) {
auto messages = read.getMessages(message->target());
int messageCount = 150; // Subject to change via settings, currently set as twitch default
PattyIrcMessage* pattyMsg = PattyIrcMessage::fromMessage(message);
messages->append(pattyMsg);
if (message->target() == this->currentChannel) {
QString html;
QWebFrame* frame = this->ui->baseChatWindow->page()->mainFrame();
this->scrollValue = frame->scrollBarValue(Qt::Vertical);
this->autoScroll = (this->scrollValue >= frame->scrollBarMaximum(Qt::Vertical));
if (this->autoScroll) {
while (messages->count() > messageCount) {
delete messages->takeFirst();
QWebElement message = frame->findFirstElement("div.message");
message.removeFromDocument();
}
}
addMessage(pattyMsg);
} else {
if (messages->count() > messageCount) {
delete messages->takeFirst();
}
}
}
示例3: scrollBarValue
int QWebFrameProto::scrollBarValue(Qt::Orientation orientation) const
{
scriptDeprecated("QWebFrame will not be available in future versions");
QWebFrame *item = qscriptvalue_cast<QWebFrame*>(thisObject());
if (item)
return item->scrollBarValue(orientation);
return 0;
}
示例4: paintEvent
void WebView::paintEvent(QPaintEvent * event)
{
QWebView::paintEvent(event);
QWebFrame *frameff = page()->mainFrame();
int hValue = frameff->scrollBarValue(Qt::Horizontal);
int vValue = frameff->scrollBarValue(Qt::Vertical);
if (hValue != _lastHorizontalValue || vValue != _lastVerticalValue)
{
_lastHorizontalValue = hValue;
_lastVerticalValue = vValue;
emit scrollValueChanged();
}
}
示例5: AppendMessage
void ChatTab::AppendMessage (Plugins::IMessage *msg)
{
Plugins::ICLEntry *other = qobject_cast<Plugins::ICLEntry*> (msg->OtherPart ());
if (!other && msg->OtherPart ())
{
qWarning () << Q_FUNC_INFO
<< "message's other part doesn't implement ICLEntry"
<< msg->GetObject ()
<< msg->OtherPart ();
return;
}
if (msg->GetDirection () == Plugins::IMessage::DOut &&
other->GetEntryType () == Plugins::ICLEntry::ETMUC)
return;
QWebFrame *frame = Ui_.View_->page ()->mainFrame ();
bool shouldScrollFurther = (frame->scrollBarMaximum (Qt::Vertical) ==
frame->scrollBarValue (Qt::Vertical));
QString body = FormatBody (msg->GetBody (), msg);
QString string = QString ("%1 ")
.arg (FormatDate (msg->GetDateTime (), msg));
string.append (' ');
switch (msg->GetDirection ())
{
case Plugins::IMessage::DIn:
{
switch (msg->GetMessageType ())
{
case Plugins::IMessage::MTChatMessage:
case Plugins::IMessage::MTMUCMessage:
{
QString entryName = Qt::escape (other->GetEntryName ());
entryName = FormatNickname (entryName, msg);
if (body.startsWith ("/me "))
{
body = body.mid (3);
string.append ("*** ");
string.append (entryName);
string.append (' ');
}
else
{
string.append (entryName);
string.append (": ");
}
break;
}
case Plugins::IMessage::MTEventMessage:
string.append ("! ");
break;
}
break;
}
case Plugins::IMessage::DOut:
string.append (FormatNickname ("R", msg));
string.append (": ");
break;
}
string.append (body);
QWebElement elem = frame->findFirstElement ("body");
elem.appendInside (QString ("<div>%1</div").arg (string));
if (shouldScrollFurther)
QTimer::singleShot (100,
this,
SLOT (scrollToEnd ()));
}