File indexing completed on 2024-09-15 03:41:06
0001 /* 0002 This file is part of the KDE libraries 0003 SPDX-FileCopyrightText: 2002 Carsten Pfeiffer <pfeiffer@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #include <ktextedit.h> 0009 0010 #include <QAction> 0011 #include <QApplication> 0012 #include <QFile> 0013 #include <QTest> 0014 0015 int main(int argc, char **argv) 0016 { 0017 QApplication::setApplicationName(QStringLiteral("ktextedittest")); 0018 QApplication app(argc, argv); 0019 KTextEdit *edit = new KTextEdit(); 0020 0021 // QAction* action = new QAction("Select All", edit); 0022 // action->setShortcut( Qt::CTRL | Qt::Key_Underscore ); 0023 // edit->addAction(action); 0024 // QObject::connect(action, SIGNAL(triggered()), edit, SLOT(selectAll())); 0025 0026 QFile file(QFINDTESTDATA(QLatin1String("ktextedittest.cpp"))); 0027 if (file.open(QIODevice::ReadOnly)) { 0028 edit->setPlainText(QLatin1String(file.readAll())); 0029 file.close(); 0030 } 0031 0032 edit->resize(600, 600); 0033 edit->show(); 0034 return app.exec(); 0035 }