当前位置: 首页>>代码示例>>C++>>正文


C++ QWebFrame::scrollBarValue方法代码示例

本文整理汇总了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);
}
开发者ID:httpftpli,项目名称:mdimh,代码行数:10,代码来源:helpform.cpp

示例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();
        }
    }
}
开发者ID:pajlada,项目名称:patty,代码行数:25,代码来源:mainwindow.cpp

示例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;
}
开发者ID:xtuple,项目名称:qt-client,代码行数:8,代码来源:qwebframeproto.cpp

示例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();
    }

}
开发者ID:JohnnyDoorn,项目名称:jasp-desktop,代码行数:18,代码来源:webview.cpp

示例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 ()));
			}
开发者ID:,项目名称:,代码行数:73,代码来源:


注:本文中的QWebFrame::scrollBarValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。