本文整理汇总了C++中QTextBrowser::insertPlainText方法的典型用法代码示例。如果您正苦于以下问题:C++ QTextBrowser::insertPlainText方法的具体用法?C++ QTextBrowser::insertPlainText怎么用?C++ QTextBrowser::insertPlainText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTextBrowser
的用法示例。
在下文中一共展示了QTextBrowser::insertPlainText方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: send_message
void session::send_message()
{
QLineEdit *temp = (QLineEdit *)_tabWidget->currentWidget()->layout()->itemAt(1)->widget();
(*_chatVct)[_tabWidget->currentIndex()]->send_message(temp->displayText());
QTextBrowser *tb = (QTextBrowser *)_tabWidget->currentWidget()->layout()->itemAt(0)->widget();
tb->insertPlainText("\t\t\t\t\t");
tb->insertPlainText(temp->displayText() + "\n");
temp->clear();
}
示例2: QWidget
int session::add_tab(QString name,ChatNetWork *chat)
{
if(chat_in_tab(chat) == -1)
return -1;
QWidget *widget = new QWidget(this);
QVBoxLayout *vLayout = new QVBoxLayout(widget);
QTextBrowser *textBrowser = new QTextBrowser(widget);
QLineEdit *lineEdit = new QLineEdit(widget);
vLayout->addWidget(textBrowser);
vLayout->addWidget(lineEdit);
QPushButton *sendButton = new QPushButton("send");
QObject::connect(sendButton, &QPushButton::clicked,
this, &session::send_message);
QPushButton *closeButton = new QPushButton("close");
QObject::connect(closeButton, &QPushButton::clicked,
this, &session::close_tab);
QHBoxLayout *buttonLayout = new QHBoxLayout();
QWidget *buttonWidget = new QWidget();
buttonLayout->addWidget(sendButton);
buttonLayout->addWidget(closeButton);
buttonWidget->setLayout(buttonLayout);
vLayout->addWidget(buttonWidget);
widget->setLayout(vLayout);
_tabWidget->addTab(widget, name);
_chatVct->push_back(chat);
for(QMap<quint32,QString>::iterator it = chat->_messageMap.begin();it != chat->_messageMap.end();it++)
{
qDebug() << "benlaidexinxi";
textBrowser->insertPlainText(*it+"\n");
}
qDebug() << "con display" << chat->_host << chat->_port;
connect(chat,&ChatNetWork::display_message,textBrowser,&QTextBrowser::insertPlainText);
return 0;
}