|

楼主 |
发表于 2003-8-6 22:30:05
|
显示全部楼层
好的,代码如下:
textEdit = new QTextEdit( this, "TextEdit1" );
textEdit->setGeometry( QRect( 0, 24, 544, 432 ) );
textEdit->show();
QFileDialog* fd = new QFileDialog( this, "file dialog", TRUE );
QString fileName;
if ( fd->exec() == QDialog::Accepted )
fileName = fd->selectedFile();
QFile file( fileName ); // Read the text from a file
if ( file.open( IO_ReadOnly ) ) {
QTextStream ts( &file );
textEdit->setText( ts.read() ); |
|