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


C++ QTextBrowser::setPlainText方法代码示例

本文整理汇总了C++中QTextBrowser::setPlainText方法的典型用法代码示例。如果您正苦于以下问题:C++ QTextBrowser::setPlainText方法的具体用法?C++ QTextBrowser::setPlainText怎么用?C++ QTextBrowser::setPlainText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QTextBrowser的用法示例。


在下文中一共展示了QTextBrowser::setPlainText方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ShowLog

void BatchJob::ShowLog()
{

    QDialog dlg(MIMainWindow::instance());
    dlg.setWindowTitle(logFile);
    dlg.setModal(true);
    dlg.setSizeGripEnabled(true);
    QVBoxLayout *mainLayout = new QVBoxLayout;
    dlg.setLayout(mainLayout);

    QTextBrowser *browse = new QTextBrowser(&dlg);
    mainLayout->addWidget(browse);

    QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Ok, Qt::Horizontal, &dlg);
    mainLayout->addWidget(bb);
    dlg.connect(bb, SIGNAL(accepted()), &dlg, SLOT(accept()));

    QFile logFileObj(logFile);
    if ( !logFileObj.open(QFile::ReadOnly | QFile::Text) )
    {
        browse->setPlainText(QObject::tr("ERROR: Log file %1 not found!")
                             .arg(logFile));
    }
    else
    {
        QTextStream logStream(&logFileObj);
        browse->setPlainText(logStream.readAll());
    }

    dlg.exec();
}
开发者ID:SpiritsThief,项目名称:mifit,代码行数:31,代码来源:BatchJob.cpp

示例2: createOutputTab

void MainWindow::createOutputTab(const QString &label, const QString &content)
{
  QTextBrowser *browser = new QTextBrowser(m_tabWidget);
  QFont f;
  f.setFamily("monospace");
  browser->setCurrentFont(f);

  m_tabWidget->addTab(browser, label);

  browser->setPlainText(content);
}
开发者ID:aodkrisda,项目名称:grantlee,代码行数:11,代码来源:mainwindow.cpp

示例3: seePreview

void Exporter::seePreview()
{
    QTextDocument *document = buildFinalDoc();

    if(dialogMode == "export")
    {

        previewDialog = new QDialog(this);
        previewDialog->setAttribute(Qt::WA_DeleteOnClose);
        previewDialog->setWindowTitle(document->metaInformation(QTextDocument::DocumentTitle));
        previewDialog->setMinimumSize(500,500);

        QVBoxLayout *layout = new QVBoxLayout;


        QTextBrowser *browser = new QTextBrowser;
        if(ui->fileTypeComboBox->currentIndex() == 2){ // if format is txt (plaintext)
            browser->setPlainText(document->toPlainText());
        }
        else{
            browser->setDocument(document);

        }



        QDialogButtonBox *buttons = new QDialogButtonBox((QDialogButtonBox::Ok
                                                          | QDialogButtonBox::Cancel), Qt::Horizontal);
        connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
        connect(buttons, SIGNAL(rejected()), this, SLOT(closePreview()));

        layout->addWidget(browser);
        layout->addWidget(buttons);
        previewDialog->setLayout(layout);
        previewDialog->show();


    }


    if(dialogMode == "print")
    {

        QPrinter printer;

        QPrintPreviewDialog printPreviewDialog(&printer, this, Qt::Dialog);
        connect(&printPreviewDialog, SIGNAL(paintRequested(QPrinter*)), this, SLOT(previewPrint(QPrinter*))) ;
        printPreviewDialog.exec();
    }
开发者ID:jacquetc,项目名称:plume-creator-legacy,代码行数:49,代码来源:exporter.cpp

示例4: setLayout

Window::Window()
{
    QTextBrowser *centralWidget = new QTextBrowser;
    centralWidget->setPlainText(tr("Central widget"));

    BorderLayout *layout = new BorderLayout;
    layout->addWidget(centralWidget, BorderLayout::Center);
    layout->addWidget(createLabel("North"), BorderLayout::North);
    layout->addWidget(createLabel("West"), BorderLayout::West);
    layout->addWidget(createLabel("East 1"), BorderLayout::East);
    layout->addWidget(createLabel("East 2") , BorderLayout::East);
    layout->addWidget(createLabel("South"), BorderLayout::South);
    setLayout(layout);

    setWindowTitle(tr("Border Layout"));
}
开发者ID:Andreas665,项目名称:qt,代码行数:16,代码来源:window.cpp

示例5: fileSelected

void FirewallCodeViewer::fileSelected(int idx)
{
    if (pages.contains(idx))
    {
        ui->pages->setCurrentIndex(pages[idx]);
    }
    else
    {
        QFile f(this->files.at(idx));
        f.open(QFile::ReadOnly);
        QTextBrowser *browser = new QTextBrowser(ui->pages);
        browser->setPlainText(f.readAll());
        ui->pages->addWidget(browser);
        pages.insert(idx, ui->pages->indexOf(browser));
        ui->pages->setCurrentWidget(browser);
    }
}
开发者ID:UNINETT,项目名称:fwbuilder,代码行数:17,代码来源:FirewallCodeViewer.cpp

示例6: QWidget

QWidget *PluginAboutPage::createPage(QWidget *parent)
{
    if (!m_Spec)
        return new QWidget(parent);

    QWidget *w = new QWidget(parent);
    QVBoxLayout *layout = new QVBoxLayout(w);
    layout->setSpacing(0);
    layout->setMargin(0);
    QTreeWidget *tree = new QTreeWidget(w);
    tree->header()->hide();
    layout->addWidget(tree);
    QLabel *lbl = new QLabel(w);
    lbl->setText(tkTr(Trans::Constants::DESCRIPTION));
    layout->addWidget(lbl);
    QTextBrowser *tb = new QTextBrowser(w);
    layout->addWidget(tb);

    // popuplate tree
    tree->clear();
    QFont f;
    f.setBold(true);
    QTreeWidgetItem *i = 0;
    i = new QTreeWidgetItem(tree, QStringList() << tkTr(Trans::Constants::INFORMATION));
    i->setFont(0,f);
    new QTreeWidgetItem(i, QStringList() << tkTr(Trans::Constants::VERSION) + " " + m_Spec->version() );
    if (Utils::isDebugWithoutInstallCompilation()) {
        new QTreeWidgetItem( i, QStringList() << tkTr(Trans::Constants::BUILD_DEBUG) + " - no install");
    } else {
        new QTreeWidgetItem( i, QStringList() << tkTr(Trans::Constants::BUILD_RELEASE) );
    }
    new QTreeWidgetItem(i, QStringList() << "License: " + m_Spec->license());
    tree->expandAll();

    // populate textbrowser
    tb->setPlainText(m_Spec->description());

    return w;
}
开发者ID:NyFanomezana,项目名称:freemedforms,代码行数:39,代码来源:pluginaboutpage.cpp

示例7: showLog

/*!
    Shows the application log.
    \todo Write some sort of log viewer.
*/
void MvdMainWindow::showLog()
{
    QFileInfo fi(paths().logFile());
    QFile file(fi.absoluteFilePath());
    if (!file.open(QIODevice::ReadOnly)) {
        QMessageBox::warning(this, MVD_CAPTION, tr("Failed to open the log file."));
        return;
    }

    QTextBrowser *viewer = new QTextBrowser;
    viewer->setWindowFlags(Qt::Tool);
    viewer->setWindowModality(Qt::NonModal);
    viewer->resize(640, 480);

    new MvdLogSyntaxHighlighter(viewer->document());

    QTextStream stream(&file);
    QString text = stream.readAll();

    viewer->setPlainText(text);
    viewer->show();
}
开发者ID:hippydream,项目名称:movida,代码行数:26,代码来源:mainwindow.cpp


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