本文整理汇总了C++中QTextBrowser::append方法的典型用法代码示例。如果您正苦于以下问题:C++ QTextBrowser::append方法的具体用法?C++ QTextBrowser::append怎么用?C++ QTextBrowser::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTextBrowser
的用法示例。
在下文中一共展示了QTextBrowser::append方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: push_text
void ChatRoom::push_text(const char *from, const char *message, QString &msgid, bool me)
{
QTextBrowser *text = ui->textBrowser;
QString author;
QString msg;
author.sprintf("%s", from);
if(!msgid.isEmpty()){
author += "\tmsgid:" + msgid;
}
msg.sprintf("%s",message);
text->append(author);
text->append(msg);
}
示例2: main
int main(int argc, char ** argv) {
using Q = QObject;
QApplication app{argc, argv};
QWidget ui;
QVBoxLayout layout{&ui};
QTextBrowser log;
QProgressBar bar;
QPushButton scan{"Scan localhost"};
layout.addWidget(&log);
layout.addWidget(&bar);
layout.addWidget(&scan);
bar.setRange(1, 65535);
ui.show();
Scanner scanner;
Q::connect(&scan, &QPushButton::clicked, &scanner, [&]{
scan.setEnabled(false);
scanner.start();
});
Q::connect(&scanner, &Scanner::hasResult, &log, [&](int port, bool isOpen){
bar.setValue(port);
if (!isOpen) return;
auto color = isOpen ? QStringLiteral("green") : QStringLiteral("red");
auto state = isOpen ? QStringLiteral("open") : QStringLiteral("closed");
log.append(QStringLiteral("<font color=\"%1\">Port %2 is %3.</font><br/>").
arg(color).arg(port).arg(state));
});
Q::connect(&scanner, &Scanner::done, &scan, [&]{
bar.reset();
scan.setEnabled(true);
});
return app.exec();
}
示例3: dmesgTab
void MainWindow::dmesgTab()
{
QTextBrowser *browser = new QTextBrowser(this);
int index = ui->tabWidget->addTab(browser, tr("dmesg log"));
ui->tabWidget->setTabIcon(index, QIcon::fromTheme("text-x-script"));
ui->tabWidget->setCurrentIndex(index);
QByteArray data = pro.readAllStandardOutput();
browser->append(data);
}
示例4: on_ShowLog_triggered
void Tray::on_ShowLog_triggered() {
QMainWindow *mw = new QMainWindow();
mw->setAttribute(Qt::WA_DeleteOnClose);
QTextBrowser *tb = new QTextBrowser();
mw->setCentralWidget(tb);
mw->setWindowTitle(QString::fromLatin1("Murmur -- %1").arg(MUMBLE_RELEASE));
connect(le, SIGNAL(newLogEntry(const QString &)), tb, SLOT(append(const QString &)));
foreach(const QString &m, qlLog)
tb->append(m);
mw->show();
}
示例5: setCharProperty
int setCharProperty(GWEN_DIALOG_PROPERTY prop,
int index,
const char *value,
int doSignal) {
QTextBrowser *qw;
QString text;
qw=(QTextBrowser*) GWEN_Widget_GetImplData(_widget, QT4_DIALOG_WIDGET_REAL);
assert(qw);
if (value)
text=QT4_Gui::extractHtml(value);
switch(prop) {
case GWEN_DialogProperty_Value:
qw->setText("");
qw->append(text);
return 0;
case GWEN_DialogProperty_AddValue:
qw->append(text);
return 0;
case GWEN_DialogProperty_ClearValues:
qw->setText("");
return 0;
default:
break;
}
DBG_WARN(GWEN_LOGDOMAIN,
"Function is not appropriate for this type of widget (%s)",
GWEN_Widget_Type_toString(GWEN_Widget_GetType(_widget)));
return GWEN_ERROR_INVALID;
};
示例6: doc
void MainWindow::doc()
{
std::ifstream in;
std::string s,line;
in.open("doc/help",ios::in);
while (getline(in,line)) {
s += line + "\n";
}
in.close();
QString qstr = QString::fromStdString(s);
//img_label->setText(qstr);
QTextBrowser *doc = new QTextBrowser();
doc->append(qstr);
doc->show();
doc->setDocumentTitle(tr("Help"));
}
示例7: JmriJFrame
//.........这里部分代码省略.........
// Desktop.getDesktop().open(new java.io.File(profile));
// } catch (java.io.IOException e) {
// XmlFileLocationAction.log.error("Error when opening profile location: " + e);
// } catch (UnsupportedOperationException e) {
// XmlFileLocationAction.log.error("Error when opening profile location: " + e);
// }
// }
// });
connect(b, SIGNAL(clicked(bool)), this, SLOT(on_openProfileButton()));
b = new QPushButton("Open Settings Location");
buttons->layout()->addWidget(b);
// b.addActionListener(new ActionListener() {
// @Override
// /*public*/ void actionPerformed(ActionEvent event) {
// try {
// Desktop.getDesktop().open(new java.io.File(settings));
// } catch (java.io.IOException e) {
// XmlFileLocationAction.log.error("Error when opening settings location: " + e);
// } catch (UnsupportedOperationException e) {
// XmlFileLocationAction.log.error("Error when opening settings location: " + e);
// }
// }
// });
connect(b, SIGNAL(clicked(bool)), this, SLOT(on_openSettingsButton()));
b = new QPushButton("Open Scripts Location");
buttons->layout()->addWidget(b);
// b.addActionListener(new ActionListener() {
// @Override
// /*public*/ void actionPerformed(ActionEvent event) {
// try {
// Desktop.getDesktop().open(new java.io.File(scripts));
// } catch (java.io.IOException e) {
// XmlFileLocationAction.log.error("Error when opening scripts location: " + e);
// } catch (UnsupportedOperationException e) {
// XmlFileLocationAction.log.error("Error when opening scripts location: " + e);
// }
// }
// });
connect(b, SIGNAL(clicked(bool)), this, SLOT(on_openScriptsButton(ActionEvent*)));
b = new QPushButton("Open Program Location");
buttons->layout()->addWidget(b);
// b.addActionListener(new ActionListener() {
// @Override
// /*public*/ void actionPerformed(ActionEvent event) {
// try {
// Desktop.getDesktop().open(new java.io.File(prog));
// } catch (java.io.IOException e) {
// XmlFileLocationAction.log.error("Error when opening program location: " + e);
// } catch (UnsupportedOperationException e) {
// XmlFileLocationAction.log.error("Error when opening program location: " + e);
// }
// }
// });
connect(b, SIGNAL(clicked(bool)), this, SLOT(on_openProgramButton()));
b = new QPushButton("Open Log Files Location");
buttons->layout()->addWidget(b);
// b.addActionListener(new ActionListener() {
// @Override
// /*public*/ void actionPerformed(ActionEvent event) {
// try {
// Desktop.getDesktop().open(new java.io.File(log));
// } catch (java.io.IOException e) {
// XmlFileLocationAction.log.error("Error when opening log files location: " + e);
// } catch (UnsupportedOperationException e) {
// XmlFileLocationAction.log.error("Error when opening log files location: " + e);
// }
// }
// });
connect(b, SIGNAL(clicked(bool)), this, SLOT(on_openLogFilesButton()));
//QScrollArea* scroll = new JScrollPane(pane);
//frame.getContentPane().add(scroll);
//QVBoxLayout* thisLayout = new QVBoxLayout(frame->getContentPane());
QTextBrowser* textPane = new QTextBrowser();
//textPane->setEditable(false);
pane->layout()->addWidget(textPane);
frame->getContentPane()->layout()->addWidget(pane);
textPane->append("User Files Location: " + user + "\n");
textPane->append("Roster Location: " + roster + "\n");
textPane->append("Profile Location: " + profile + "\n");
textPane->append("Settings Location: " + settings + "\n");
textPane->append("Current Config file: " + configName + "\n");
textPane->append("Scripts Location: " + scripts + "\n");
textPane->append("Program Location: " + prog + "\n");
textPane->append("Log Files Location: " + log + "\n");
addLogFiles(textPane, log);
frame->adjustSize();
frame->setVisible(true);
}
示例8: print
void ConsoleOutput::print(QString msg, QString programTitle)
{
QTextBrowser* browser = tab(programTitle);
browser->append(msg);
}