#ifndef lint static char rcsid[] = "@(#$Id: pvmain.cpp,v 1.5 2005-11-24 07:16:16 dockes Exp $ (C) 2005 J.F.Dockes"; #endif #include #include #include #include #ifndef NO_NAMESPACES using std::string; using std::list; using std::pair; #endif /* NO_NAMESPACES */ #include #include #include #include #include #include "preview.h" #include "../plaintorich.h" #include "readfile.h" const char *filename = "/home/dockes/tmp/tstpv-utf8.txt"; int recollNeedsExit; int main( int argc, char ** argv ) { QApplication a(argc, argv); Preview w; string text; if (!file_to_string(filename, text)) { fprintf(stderr, "Could not read %s\n", filename); exit(1); } list terms; list > termoffs; string rich = plaintorich(text, terms, termoffs); QString str = QString::fromUtf8(rich.c_str(), rich.length()); w.pvEdit->setText(str); // QVBoxLayout *unnamedLayout = // new QVBoxLayout(0, 11, 6, "unnamedLayout"); QWidget *anon = new QWidget(w.pvTab); QVBoxLayout *anonLayout = new QVBoxLayout(anon, 11, 6, "unnamedLayout"); QTextEdit *newEd = new QTextEdit(anon, "pvEdit"); anonLayout->addWidget(newEd); fprintf(stderr, "pvEdit %p newEd: %p\n", w.pvEdit, newEd); newEd->setReadOnly( TRUE ); newEd->setUndoRedoEnabled( FALSE ); newEd->setText(str); w.pvTab->addTab(anon, "Tab 2"); #if QT_VERSION < 0x040000 a.setMainWidget(&w); #endif w.show(); return a.exec(); }