本文整理汇总了C++中scrollToBottom函数的典型用法代码示例。如果您正苦于以下问题:C++ scrollToBottom函数的具体用法?C++ scrollToBottom怎么用?C++ scrollToBottom使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了scrollToBottom函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: connect
//Toggle to automatically scroll to bottom when new item added
void BC_Bulletin::autoScroll()
{
if (ui->pushButton_3->isChecked())
{
connect(this, SIGNAL(itemAdded()), ui->tx, SLOT(scrollToBottom()));
connect(this, SIGNAL(itemAdded()), ui->fsw, SLOT(scrollToBottom()));
}
else
{
disconnect(this, SIGNAL(itemAdded()), ui->tx, SLOT(scrollToBottom()));
disconnect(this, SIGNAL(itemAdded()), ui->fsw, SLOT(scrollToBottom()));
}
}
示例2: QWebView
DisplayWidget::DisplayWidget(QWidget* parent) : QWebView(parent) {
QWidget::setMinimumSize(0, 30);
// Sections Information
_currentSection = 0;
_maxSections = 1;
_currentCharacterCount = 0;
_maxCharacterCount = 300000000;
_scrollToBottom = true;
// Create WebKit Display
page()->mainFrame()->load(QUrl("qrc:/webkitdisplay/page.html"));
// Connect Signals/Slots
connect(this, SIGNAL(loadFinished(bool)), SLOT(finishLoading(bool)));
connect(page(), SIGNAL(contentsChanged()), SLOT(scrollToBottom()));
// TODO: Why aren't frames working?
connect(page(), SIGNAL(frameCreated(QWebFrame *frame)),
SLOT(loadFrame(QWebFrame *frame)));
page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
page()->setContentEditable(false);
/*
#ifdef USE_JQUERY
QFile file;
file.setFileName(":/webkitdisplay/jquery.min.js");
file.open(QIODevice::ReadOnly);
_jQuery = file.readAll();
file.close();
#endif
*/
}
示例3: moveCursor
void ItemViewCategorized::toLastIndex()
{
QModelIndex index = moveCursor(MoveEnd, Qt::NoModifier);
clearSelection();
setCurrentIndex(index);
scrollToBottom();
}
示例4: QWidget
Dialog::Dialog(const Application* application, const QString& userId, QWidget* parent) :
QWidget(parent),
ui(new Ui::Dialog),
application(application),
userId(userId)
{
unreadInList = QStringList();
setupUi();
connect(ui->textEdit
, SIGNAL(focusIn())
, this
, SLOT(markInboxRead()));
connect(ui->webView->page()->mainFrame()
, SIGNAL(contentsSizeChanged(QSize))
, this
, SLOT(scrollToBottom(QSize)));
loadHistory(20);
connect(&application->getLongPollExecutor()
, SIGNAL(messageRecieved(QString,bool, bool,QString,uint,QString))
, this
, SLOT(insertMessage(QString,bool, bool,QString,uint,QString)));
connect(&application->getLongPollExecutor()
, SIGNAL(messageIsRead(QString))
, this
, SLOT(markMessageIsRead(QString)));
connect(ui->textEdit, SIGNAL(returnPressed()), this, SLOT(sendMessage()));
connect(ui->pushButton, SIGNAL(released()), this, SLOT(sendMessage()));
ui->webView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
connect(ui->webView, SIGNAL(linkClicked(QUrl)), this, SLOT(openAttachment(QUrl)));
}
示例5: parentWidget
void ChatWindow::notificationClicked() {
if (parentWidget()->isMinimized()) {
parentWidget()->showNormal();
}
if (isHidden()) {
show();
}
// find last mention
int messageCount = ui->messagesVBoxLayout->count();
for (unsigned int i = messageCount; i > 0; i--) {
ChatMessageArea* area = (ChatMessageArea*)ui->messagesVBoxLayout->itemAt(i - 1)->widget();
QRegularExpression usernameMention(mentionRegex.arg(AccountManager::getInstance().getAccountInfo().getUsername()));
if (area->toPlainText().contains(usernameMention)) {
int top = area->geometry().top();
int height = area->geometry().height();
QScrollBar* verticalScrollBar = ui->messagesScrollArea->verticalScrollBar();
verticalScrollBar->setSliderPosition(top - verticalScrollBar->size().height() + height);
return;
}
}
Application::processEvents();
scrollToBottom();
}
示例6: tr
void ChatWindow::addTimeStamp() {
QTimeSpan timePassed = QDateTime::currentDateTime() - lastMessageStamp;
int times[] = { timePassed.daysPart(), timePassed.hoursPart(), timePassed.minutesPart() };
QString strings[] = { tr("%n day(s)", 0, times[0]), tr("%n hour(s)", 0, times[1]), tr("%n minute(s)", 0, times[2]) };
QString timeString = "";
for (int i = 0; i < 3; i++) {
if (times[i] > 0) {
timeString += strings[i] + " ";
}
}
timeString.chop(1);
if (!timeString.isEmpty()) {
QLabel* timeLabel = new QLabel(timeString);
timeLabel->setStyleSheet("color: #333333;"
"background-color: white;"
"font-size: 14px;"
"padding: 4px;");
timeLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
timeLabel->setAlignment(Qt::AlignLeft);
bool atBottom = isNearBottom();
ui->messagesVBoxLayout->addWidget(timeLabel);
ui->messagesVBoxLayout->parentWidget()->updateGeometry();
Application::processEvents();
numMessagesAfterLastTimeStamp = 0;
if (atBottom) {
scrollToBottom();
}
}
}
示例7: scrollToBottom
///// append /////////////////////////////////////////////////////////////////
void StatusText::append(const QString& text)
/// Overridden from QTextEdit::append in that it autoamtically positions itself
/// at the last line.
{
QTextEdit::append(text);
scrollToBottom();
}
示例8: formatTimeStamp
void ChatView::renderMucMessage(const MessageView &mv)
{
const QString timestr = formatTimeStamp(mv.dateTime());
QString alerttagso, alerttagsc, nickcolor;
QString textcolor = palette().color(QPalette::Active, QPalette::Text).name();
QString icon = useMessageIcons_?
(QString("<img src=\"%1\" />").arg(mv.isLocal()?"icon:log_icon_delivered":"icon:log_icon_receive")):"";
if(mv.isAlert()) {
textcolor = "#FF0000";
alerttagso = "<b>";
alerttagsc = "</b>";
}
if(mv.isSpooled()) {
nickcolor = ColorOpt::instance()->color(infomrationalColorOpt).name();
} else {
nickcolor = getMucNickColor(mv.nick(), mv.isLocal());
}
if(mv.isEmote()) {
appendText(icon + QString("<font color=\"%1\">").arg(nickcolor) + QString("[%1]").arg(timestr) + QString(" *%1 ").arg(TextUtil::escape(mv.nick())) + alerttagso + mv.formattedText() + alerttagsc + "</font>");
}
else {
if(PsiOptions::instance()->getOption("options.ui.chat.use-chat-says-style").toBool()) {
appendText(icon + QString("<font color=\"%1\">").arg(nickcolor) + QString("[%1] ").arg(timestr) + QString("%1 says:").arg(TextUtil::escape(mv.nick())) + "</font><br>" + QString("<font color=\"%1\">").arg(textcolor) + alerttagso + mv.formattedText() + alerttagsc + "</font>");
}
else {
appendText(icon + QString("<font color=\"%1\">").arg(nickcolor) + QString("[%1] <").arg(timestr) + TextUtil::escape(mv.nick()) + QString("></font> ") + QString("<font color=\"%1\">").arg(textcolor) + alerttagso + mv.formattedText() + alerttagsc +"</font>");
}
}
if(mv.isLocal()) {
scrollToBottom();
}
}
示例9: QString
void MChatBrowser::appendHtml(const QString &pHtml)
{
QString jsHtml = pHtml;
jsHtml.replace("\'", "\\'");
QString js = QString("appendHtml('%1')").arg(jsHtml);
page()->mainFrame()->evaluateJavaScript(js);
scrollToBottom();
}
示例10: isScrollbarAtBottom
void OutputWindow::resizeEvent(QResizeEvent *e)
{
//Keep scrollbar at bottom of window while resizing, to ensure we keep scrolling
//This can happen if window is resized while building, or if the horizontal scrollbar appears
bool atBottom = isScrollbarAtBottom();
QPlainTextEdit::resizeEvent(e);
if (atBottom)
scrollToBottom();
}
示例11: scrollToBottom
void LoggingTableWidget::ScrollToBottom()
{
if( RowsAdded == false )
{
return;
}
RowsAdded = false;
scrollToBottom();
}
示例12: setMaximumBlockCount
void OutputWindow::appendMessage(const QString &output, OutputFormat format)
{
const QString out = SynchronousProcess::normalizeNewlines(output);
setMaximumBlockCount(d->maxLineCount);
const bool atBottom = isScrollbarAtBottom() || m_scrollTimer.isActive();
if (format == ErrorMessageFormat || format == NormalMessageFormat) {
d->formatter->appendMessage(doNewlineEnforcement(out), format);
} else {
bool sameLine = format == StdOutFormatSameLine
|| format == StdErrFormatSameLine;
if (sameLine) {
d->scrollToBottom = true;
int newline = -1;
bool enforceNewline = d->enforceNewline;
d->enforceNewline = false;
if (!enforceNewline) {
newline = out.indexOf(QLatin1Char('\n'));
moveCursor(QTextCursor::End);
if (newline != -1)
d->formatter->appendMessage(out.left(newline), format);// doesn't enforce new paragraph like appendPlainText
}
QString s = out.mid(newline+1);
if (s.isEmpty()) {
d->enforceNewline = true;
} else {
if (s.endsWith(QLatin1Char('\n'))) {
d->enforceNewline = true;
s.chop(1);
}
d->formatter->appendMessage(QLatin1Char('\n') + s, format);
}
} else {
d->formatter->appendMessage(doNewlineEnforcement(out), format);
}
}
if (atBottom) {
if (m_lastMessage.elapsed() < 5) {
m_scrollTimer.start();
} else {
m_scrollTimer.stop();
scrollToBottom();
}
}
m_lastMessage.start();
enableUndoRedo();
}
示例13: generateHtml
void WX_HTML_REPORT_PANEL::Report( const wxString& aText, REPORTER::SEVERITY aSeverity )
{
REPORT_LINE line;
line.message = aText;
line.severity = aSeverity;
m_report.push_back( line );
m_htmlView->AppendToPage( generateHtml( line ) );
scrollToBottom();
}
示例14: scrollToBottom
void QtMessageLogProxyModel::onRowsInserted(const QModelIndex &index, int start, int end)
{
int rowIndex = end;
do {
if (filterAcceptsRow(rowIndex, index)) {
emit scrollToBottom();
break;
}
} while (--rowIndex >= start);
}
示例15: scrollToTop
void NavigableTableView::keyPressEvent(QKeyEvent *event) {
if(event->key() == Qt::Key_Home) {
scrollToTop();
}
else if(event->key() == Qt::Key_End) {
scrollToBottom();
}
else {
QTableView::keyPressEvent(event);
}
}