本文整理汇总了C++中QTextEdit::show方法的典型用法代码示例。如果您正苦于以下问题:C++ QTextEdit::show方法的具体用法?C++ QTextEdit::show怎么用?C++ QTextEdit::show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTextEdit
的用法示例。
在下文中一共展示了QTextEdit::show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: slotSourceDownloaded
void MainWindow::slotSourceDownloaded()
{
QNetworkReply* reply = qobject_cast<QNetworkReply*>(const_cast<QObject*>(sender()));
QTextEdit* textEdit = new QTextEdit(NULL);
textEdit->setAttribute(Qt::WA_DeleteOnClose);
textEdit->show();
textEdit->setPlainText(reply->readAll());
reply->deleteLater();
}
示例2: main
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QTextEdit editor;
FilterObject filter;
filter.setFilteredObject(&editor);
editor.show();
return app.exec();
}
示例3: main
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QTextEdit textEdit;
textEdit.show();
return app.exec();
}
示例4: viewSource
void MainWindow::viewSource()
{
QTextEdit* textEdit = new QTextEdit(NULL);
textEdit->setAttribute(Qt::WA_DeleteOnClose);
textEdit->adjustSize();
textEdit->move(this->geometry().center() - textEdit->rect().center());
textEdit->show();
view->page()->toHtml(invoke(textEdit, &QTextEdit::setPlainText));
}
示例5: main
int main(int argv, char **args)
{
// Erzeugt das Hauptprogramm
QApplication app(argv, args);
// Erzeugt ein "Widgets" (z.B. Scrollbalken, Buttons - hier ein Textfeld/Fenster zum schreiben)
QTextEdit textEdit;
// Zeigt das Widgets an.
textEdit.show();
// Hier startet QT seine Hauptschleife, um Events abzufangen (Mausklick, Tastaturanschlag)
return app.exec();
}
示例6: main
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QTextEdit *editor = new QTextEdit;
QTextDocument *document = new QTextDocument(editor);
QTextCursor cursor(document);
QTextImageFormat imageFormat;
imageFormat.setName(":/images/advert.png");
cursor.insertImage(imageFormat);
QTextBlock block = cursor.block();
QTextFragment fragment;
QTextBlock::iterator it;
for (it = block.begin(); !(it.atEnd()); ++it) {
fragment = it.fragment();
if (fragment.contains(cursor.position()))
break;
}
//! [0]
if (fragment.isValid()) {
QTextImageFormat newImageFormat = fragment.charFormat().toImageFormat();
if (newImageFormat.isValid()) {
newImageFormat.setName(":/images/newimage.png");
QTextCursor helper = cursor;
helper.setPosition(fragment.position());
helper.setPosition(fragment.position() + fragment.length(),
QTextCursor::KeepAnchor);
helper.setCharFormat(newImageFormat);
//! [0] //! [1]
}
//! [1] //! [2]
}
//! [2]
cursor.insertBlock();
cursor.insertText("Code less. Create more.");
editor->setDocument(document);
editor->setWindowTitle(tr("Text Document Image Format"));
editor->resize(320, 480);
editor->show();
return app.exec();
}
示例7: main
int main(int argc, char ** argv) {
QApplication app{argc, argv};
double const table[] {
78.0, 78.0, 78.0,
0.0, 0.0, 78.0,
69.0, 56.0, 0.0};
QTextEdit edit;
setHtml(&edit, toTable(std::begin(table), std::end(table), 3,
[](double arg){ return QString::number(arg, 'f', 1); },
"width=\"100%\""));
edit.setReadOnly(true);
edit.show();
return app.exec();
}
示例8: handleLicenseClicked
void QtAboutWidget::handleLicenseClicked() {
QTextEdit* text = new QTextEdit();
text->setAttribute(Qt::WA_DeleteOnClose);
text->setReadOnly(true);
QFile file(":/COPYING");
file.open(QIODevice::ReadOnly);
QTextStream in(&file);
in.setCodec("UTF-8");
text->setPlainText(in.readAll());
file.close();
text->resize(500, 600);
text->show();
text->activateWindow();
}
示例9: main
int main( int argc, char **argv )
{
QApplication app( argc, argv );
QTextEdit log;
EventWidget widget;
QObject::connect( &widget, SIGNAL(gotEvent(const QString &)),
&log, SLOT(append(const QString &)) );
log.show();
widget.show();
return app.exec();
}
示例10: main
int main(int argc, char *argv[])
{
QWidget *parent = 0;
QString aStringContainingHTMLtext("<h1>Scribe Overview</h1>");
QApplication app(argc, argv);
//! [1]
QTextEdit *editor = new QTextEdit(parent);
editor->setHtml(aStringContainingHTMLtext);
editor->show();
//! [1]
return app.exec();
}
示例11: createMdiChild
QTextEdit* Widgets::createMdiChild()
{
static int sequenceNumber = 1;
QString curFile = tr("document%1.txt").arg(sequenceNumber++);
QTextEdit* child = new QTextEdit;
child->setWindowIcon(QIcon(":/res/new.png"));
child->setWindowTitle(curFile + "[*]");
QMdiSubWindow* subWindow = m_mdiArea->addSubWindow(child);
subWindow->setWindowState(Qt::WindowMaximized);
// subWindow->resize( m_mdiArea->width(), m_mdiArea->height());
child->show();
return child;
}
示例12: main
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QTextEdit *editor = new QTextEdit();
QTextCursor cursor(editor->textCursor());
cursor.movePosition(QTextCursor::Start);
QTextCharFormat plainFormat(cursor.charFormat());
QTextCharFormat headingFormat = plainFormat;
headingFormat.setFontWeight(QFont::Bold);
headingFormat.setFontPointSize(16);
QTextCharFormat emphasisFormat = plainFormat;
emphasisFormat.setFontItalic(true);
QTextCharFormat qtFormat = plainFormat;
qtFormat.setForeground(QColor("#990000"));
QTextCharFormat underlineFormat = plainFormat;
underlineFormat.setFontUnderline(true);
//! [0]
cursor.insertText(tr("Character formats"),
headingFormat);
cursor.insertBlock();
cursor.insertText(tr("Text can be displayed in a variety of "
"different character formats. "), plainFormat);
cursor.insertText(tr("We can emphasize text by "));
cursor.insertText(tr("making it italic"), emphasisFormat);
//! [0]
cursor.insertText(tr(", give it a "), plainFormat);
cursor.insertText(tr("different color "), qtFormat);
cursor.insertText(tr("to the default text color, "), plainFormat);
cursor.insertText(tr("underline it"), underlineFormat);
cursor.insertText(tr(", and use many other effects."), plainFormat);
editor->setWindowTitle(tr("Text Document Character Formats"));
editor->resize(320, 480);
editor->show();
return app.exec();
}
示例13: on_actionAbout_triggered
void MainWindow::on_actionAbout_triggered()
{
QTextEdit *pTxt = new QTextEdit(this);
pTxt->setWindowFlags(Qt::Window); //or Qt::Tool, Qt::Dialog if you like
pTxt->setReadOnly(true);
pTxt->append("qIffTool by Ilkka Prusi 2011");
pTxt->append("");
pTxt->append("This program is free to use and distribute. No warranties of any kind.");
pTxt->append("Program uses Qt 4.7.2 under LGPL v. 2.1");
pTxt->append("");
pTxt->append("Keyboard shortcuts:");
pTxt->append("");
pTxt->append("F = open file");
pTxt->append("Esc = close");
pTxt->append("? = about (this dialog)");
pTxt->append("");
pTxt->show();
}
示例14: help
void MainDock::help() {
//pd Qt version dependent
#if QT_VERSION >= 0x040200
QDesktopServices::openUrl(QUrl("Readme.txt"));
#else
QFile readmeFile("Readme.txt");
readmeFile.open(QIODevice::ReadOnly);
QTextStream readmeStream(&readmeFile);
QString readmeString = readmeStream.readAll();
//won't close automaticaly
QTextEdit* readmeTXE = new QTextEdit(0);
readmeTXE->setMinimumSize(500, 300);
readmeTXE->setWindowTitle("Parallel Worlds Help");
readmeTXE->show();
readmeTXE->setReadOnly(true);
readmeTXE->setPlainText(readmeString);
#endif
}
示例15: main
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QTextEdit *editor = new QTextEdit();
QTextCursor cursor(editor->textCursor());
cursor.movePosition(QTextCursor::Start);
QTextCharFormat plainFormat(cursor.charFormat());
QTextCharFormat colorFormat = plainFormat;
colorFormat.setForeground(Qt::red);
cursor.insertText(tr("Text can be displayed in a variety of "
"different character "
"formats. "), plainFormat);
cursor.insertText(tr("We can emphasize text by making it "));
cursor.insertText(tr("italic, give it a different color "));
cursor.insertText(tr("to the default text color, underline it, "));
cursor.insertText(tr("and use many other effects."));
QString searchString = tr("text");
QTextDocument *document = editor->document();
//! [0]
QTextCursor newCursor(document);
while (!newCursor.isNull() && !newCursor.atEnd()) {
newCursor = document->find(searchString, newCursor);
if (!newCursor.isNull()) {
newCursor.movePosition(QTextCursor::WordRight,
QTextCursor::KeepAnchor);
newCursor.mergeCharFormat(colorFormat);
}
//! [0] //! [1]
}
//! [1]
editor->setWindowTitle(tr("Text Document Find"));
editor->resize(320, 480);
editor->show();
return app.exec();
}