You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
410 lines
18 KiB
410 lines
18 KiB
14 years ago
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||
|
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/examples/qdir/qdir.doc:4 -->
|
||
|
<html>
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||
|
<title>QDir</title>
|
||
|
<style type="text/css"><!--
|
||
|
fn { margin-left: 1cm; text-indent: -1cm; }
|
||
|
a:link { color: #004faf; text-decoration: none }
|
||
|
a:visited { color: #672967; text-decoration: none }
|
||
|
body { background: #ffffff; color: black; }
|
||
|
--></style>
|
||
|
</head>
|
||
|
<body>
|
||
|
|
||
|
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
||
|
<tr bgcolor="#E5E5E5">
|
||
|
<td valign=center>
|
||
|
<a href="index.html">
|
||
|
<font color="#004faf">Home</font></a>
|
||
|
| <a href="classes.html">
|
||
|
<font color="#004faf">All Classes</font></a>
|
||
|
| <a href="mainclasses.html">
|
||
|
<font color="#004faf">Main Classes</font></a>
|
||
|
| <a href="annotated.html">
|
||
|
<font color="#004faf">Annotated</font></a>
|
||
|
| <a href="groups.html">
|
||
|
<font color="#004faf">Grouped Classes</font></a>
|
||
|
| <a href="functions.html">
|
||
|
<font color="#004faf">Functions</font></a>
|
||
|
</td>
|
||
|
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QDir</h1>
|
||
|
|
||
|
|
||
|
<p>
|
||
|
<hr>
|
||
|
<p> Main:
|
||
|
<p> <pre>/****************************************************************************
|
||
|
** $Id: qt/qdir.cpp 3.3.8 edited Jan 11 14:37 $
|
||
|
**
|
||
|
** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.
|
||
|
**
|
||
|
** This file is part of an example program for Qt. This example
|
||
|
** program may be used, distributed and modified without limitation.
|
||
|
**
|
||
|
*****************************************************************************/
|
||
|
|
||
|
#include "../dirview/dirview.h"
|
||
|
#include "qdir.h"
|
||
|
|
||
|
#include <<a href="qapplication-h.html">qapplication.h</a>>
|
||
|
#include <<a href="qtextview-h.html">qtextview.h</a>>
|
||
|
#include <<a href="qfileinfo-h.html">qfileinfo.h</a>>
|
||
|
#include <<a href="qfile-h.html">qfile.h</a>>
|
||
|
#include <<a href="qtextstream-h.html">qtextstream.h</a>>
|
||
|
#include <<a href="qhbox-h.html">qhbox.h</a>>
|
||
|
#include <<a href="qspinbox-h.html">qspinbox.h</a>>
|
||
|
#include <<a href="qlabel-h.html">qlabel.h</a>>
|
||
|
#include <<a href="qmultilineedit-h.html">qmultilineedit.h</a>>
|
||
|
#include <<a href="qheader-h.html">qheader.h</a>>
|
||
|
#include <<a href="qevent-h.html">qevent.h</a>>
|
||
|
#include <<a href="qpainter-h.html">qpainter.h</a>>
|
||
|
#include <<a href="qpopupmenu-h.html">qpopupmenu.h</a>>
|
||
|
#include <<a href="qpushbutton-h.html">qpushbutton.h</a>>
|
||
|
#include <<a href="qtoolbutton-h.html">qtoolbutton.h</a>>
|
||
|
#include <<a href="qfile-h.html">qfile.h</a>>
|
||
|
#include <<a href="qtextstream-h.html">qtextstream.h</a>>
|
||
|
#include <<a href="qtooltip-h.html">qtooltip.h</a>>
|
||
|
|
||
|
#include <stdlib.h>
|
||
|
|
||
|
/* XPM */
|
||
|
static const char *bookmarks[]={
|
||
|
"22 14 8 1",
|
||
|
"# c #000080",
|
||
|
"a c #585858",
|
||
|
"b c #000000",
|
||
|
"c c #ffffff",
|
||
|
"d c #ffffff",
|
||
|
"e c #ffffff",
|
||
|
"f c #000000",
|
||
|
". c None",
|
||
|
"...bb.................",
|
||
|
"..bacb....bbb.........",
|
||
|
"..badcb.bbccbab.......",
|
||
|
"..bacccbadccbab.......",
|
||
|
"..baecdbcccdbab.......",
|
||
|
"..bacccbacccbab.......",
|
||
|
"..badcdbcecdfab.......",
|
||
|
"..bacecbacccbab.......",
|
||
|
"..baccdbcccdbab.......",
|
||
|
"...badcbacdbbab.......",
|
||
|
"....bacbcbbccab.......",
|
||
|
".....babbaaaaab.......",
|
||
|
".....bbabbbbbbb.......",
|
||
|
"......bb.............."
|
||
|
};
|
||
|
|
||
|
/* XPM */
|
||
|
static const char *home[]={
|
||
|
"16 15 4 1",
|
||
|
"# c #000000",
|
||
|
"a c #ffffff",
|
||
|
"b c #c0c0c0",
|
||
|
". c None",
|
||
|
".......##.......",
|
||
|
"..#...####......",
|
||
|
"..#..#aabb#.....",
|
||
|
"..#.#aaaabb#....",
|
||
|
"..##aaaaaabb#...",
|
||
|
"..#aaaaaaaabb#..",
|
||
|
".#aaaaaaaaabbb#.",
|
||
|
"###aaaaaaaabb###",
|
||
|
"..#aaaaaaaabb#..",
|
||
|
"..#aaa###aabb#..",
|
||
|
"..#aaa#.#aabb#..",
|
||
|
"..#aaa#.#aabb#..",
|
||
|
"..#aaa#.#aabb#..",
|
||
|
"..#aaa#.#aabb#..",
|
||
|
"..#####.######.."
|
||
|
};
|
||
|
|
||
|
// ****************************************************************************************************
|
||
|
|
||
|
<a name="f495"></a>PixmapView::PixmapView( <a href="qwidget.html">QWidget</a> *parent )
|
||
|
: <a href="qscrollview.html">QScrollView</a>( parent )
|
||
|
{
|
||
|
<a href="qscrollview.html#viewport">viewport</a>()->setBackgroundMode( PaletteBase );
|
||
|
}
|
||
|
|
||
|
void <a name="f496"></a>PixmapView::setPixmap( const <a href="qpixmap.html">QPixmap</a> &pix )
|
||
|
{
|
||
|
pixmap = pix;
|
||
|
<a name="x1855"></a> <a href="qscrollview.html#resizeContents">resizeContents</a>( pixmap.<a href="qwidget.html#size">size</a>().width(), pixmap.<a href="qwidget.html#size">size</a>().height() );
|
||
|
<a href="qscrollview.html#viewport">viewport</a>()->repaint( FALSE );
|
||
|
}
|
||
|
|
||
|
<a name="x1837"></a>void PixmapView::<a href="qscrollview.html#drawContents">drawContents</a>( <a href="qpainter.html">QPainter</a> *p, int cx, int cy, int cw, int ch )
|
||
|
{
|
||
|
<a name="x1833"></a> p-><a href="qpainter.html#fillRect">fillRect</a>( cx, cy, cw, ch, colorGroup().brush( QColorGroup::Base ) );
|
||
|
<a name="x1832"></a> p-><a href="qpainter.html#drawPixmap">drawPixmap</a>( 0, 0, pixmap );
|
||
|
}
|
||
|
|
||
|
// ****************************************************************************************************
|
||
|
|
||
|
<a name="f497"></a>Preview::Preview( <a href="qwidget.html">QWidget</a> *parent )
|
||
|
: <a href="qwidgetstack.html">QWidgetStack</a>( parent )
|
||
|
{
|
||
|
normalText = new <a href="qmultilineedit.html">QMultiLineEdit</a>( this );
|
||
|
<a name="x1845"></a> normalText-><a href="qtextedit.html#setReadOnly">setReadOnly</a>( TRUE );
|
||
|
html = new <a href="qtextview.html">QTextView</a>( this );
|
||
|
pixmap = new PixmapView( this );
|
||
|
<a href="qwidgetstack.html#raiseWidget">raiseWidget</a>( normalText );
|
||
|
}
|
||
|
|
||
|
void <a name="f498"></a>Preview::showPreview( const <a href="qurl.html">QUrl</a> &u, int size )
|
||
|
{
|
||
|
<a name="x1849"></a> if ( u.<a href="qurl.html#isLocalFile">isLocalFile</a>() ) {
|
||
|
<a name="x1850"></a> <a href="qstring.html">QString</a> path = u.<a href="qurl.html#path">path</a>();
|
||
|
<a href="qfileinfo.html">QFileInfo</a> fi( path );
|
||
|
<a name="x1825"></a><a name="x1824"></a> if ( fi.<a href="qfileinfo.html#isFile">isFile</a>() && (int)fi.<a href="qfileinfo.html#size">size</a>() > size * 1000 ) {
|
||
|
<a name="x1846"></a> normalText-><a href="qtextedit.html#setText">setText</a>( <a href="qobject.html#tr">tr</a>( "The File\n%1\nis too large, so I don't show it!" ).arg( path ) );
|
||
|
<a href="qwidgetstack.html#raiseWidget">raiseWidget</a>( normalText );
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
<a href="qpixmap.html">QPixmap</a> pix( path );
|
||
|
<a name="x1834"></a> if ( pix.<a href="qpixmap.html#isNull">isNull</a>() ) {
|
||
|
if ( fi.<a href="qfileinfo.html#isFile">isFile</a>() ) {
|
||
|
<a href="qfile.html">QFile</a> f( path );
|
||
|
<a name="x1815"></a> if ( f.<a href="qfile.html#open">open</a>( <a href="qfile.html#open">IO_ReadOnly</a> ) ) {
|
||
|
<a href="qtextstream.html">QTextStream</a> ts( &f );
|
||
|
<a name="x1847"></a> <a href="qstring.html">QString</a> text = ts.<a href="qtextstream.html#read">read</a>();
|
||
|
<a name="x1814"></a> f.<a href="qfile.html#close">close</a>();
|
||
|
<a name="x1823"></a> if ( fi.<a href="qfileinfo.html#extension">extension</a>().lower().contains( "htm" ) ) {
|
||
|
<a name="x1844"></a><a name="x1843"></a> <a href="qstring.html">QString</a> url = html-><a href="qtextedit.html#mimeSourceFactory">mimeSourceFactory</a>()->makeAbsolute( path, html-><a href="qtextedit.html#context">context</a>() );
|
||
|
html-><a href="qtextedit.html#setText">setText</a>( text, url );
|
||
|
raiseWidget( html );
|
||
|
return;
|
||
|
} else {
|
||
|
normalText-><a href="qtextedit.html#setText">setText</a>( text );
|
||
|
raiseWidget( normalText );
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
normalText-><a href="qtextedit.html#setText">setText</a>( <a href="qstring.html#QString-null">QString::null</a> );
|
||
|
raiseWidget( normalText );
|
||
|
} else {
|
||
|
pixmap->setPixmap( pix );
|
||
|
raiseWidget( pixmap );
|
||
|
}
|
||
|
} else {
|
||
|
normalText-><a href="qtextedit.html#setText">setText</a>( "I only show local files!" );
|
||
|
raiseWidget( normalText );
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// ****************************************************************************************************
|
||
|
|
||
|
<a name="f499"></a>PreviewWidget::PreviewWidget( <a href="qwidget.html">QWidget</a> *parent )
|
||
|
: <a href="qvbox.html">QVBox</a>( parent ), QFilePreview()
|
||
|
{
|
||
|
setSpacing( 5 );
|
||
|
setMargin( 5 );
|
||
|
<a href="qhbox.html">QHBox</a> *row = new <a href="qhbox.html">QHBox</a>( this );
|
||
|
<a name="x1826"></a> row-><a href="qhbox.html#setSpacing">setSpacing</a>( 5 );
|
||
|
(void)new <a href="qlabel.html">QLabel</a>( <a href="qobject.html#tr">tr</a>( "Only show files smaller than: " ), row );
|
||
|
sizeSpinBox = new <a href="qspinbox.html">QSpinBox</a>( 1, 10000, 1, row );
|
||
|
<a name="x1838"></a> sizeSpinBox-><a href="qspinbox.html#setSuffix">setSuffix</a>( " KB" );
|
||
|
<a name="x1839"></a> sizeSpinBox-><a href="qspinbox.html#setValue">setValue</a>( 64 );
|
||
|
<a name="x1852"></a><a name="x1840"></a> row-><a href="qwidget.html#setFixedHeight">setFixedHeight</a>( 10 + sizeSpinBox-><a href="qwidget.html#sizeHint">sizeHint</a>().height() );
|
||
|
preview = new Preview( this );
|
||
|
}
|
||
|
|
||
|
void <a name="f500"></a>PreviewWidget::previewUrl( const <a href="qurl.html">QUrl</a> &u )
|
||
|
{
|
||
|
<a name="x1841"></a> preview->showPreview( u, sizeSpinBox-><a href="qspinbox.html#value">value</a>() );
|
||
|
}
|
||
|
|
||
|
// ****************************************************************************************************
|
||
|
|
||
|
<a name="f491"></a>CustomFileDialog::CustomFileDialog()
|
||
|
: <a href="qfiledialog.html">QFileDialog</a>( 0, 0, TRUE )
|
||
|
{
|
||
|
<a href="qfiledialog.html#setDir">setDir</a>( "/" );
|
||
|
|
||
|
dirView = new DirectoryView( this, 0, TRUE );
|
||
|
<a name="x1827"></a> dirView-><a href="qlistview.html#addColumn">addColumn</a>( "" );
|
||
|
<a name="x1828"></a> dirView-><a href="qlistview.html#header">header</a>()->hide();
|
||
|
::Directory *root = new ::Directory( dirView, "/" );
|
||
|
root->setOpen( TRUE );
|
||
|
<a name="x1853"></a> dirView-><a href="qwidget.html#setFixedWidth">setFixedWidth</a>( 150 );
|
||
|
|
||
|
<a href="qfiledialog.html#addLeftWidget">addLeftWidget</a>( dirView );
|
||
|
|
||
|
<a href="qpushbutton.html">QPushButton</a> *p = new <a href="qpushbutton.html">QPushButton</a>( this );
|
||
|
<a name="x1811"></a> p-><a href="qbutton.html#setPixmap">setPixmap</a>( QPixmap( bookmarks ) );
|
||
|
<a name="x1848"></a> QToolTip::<a href="qtooltip.html#add">add</a>( p, tr( "Bookmarks" ) );
|
||
|
|
||
|
bookmarkMenu = new <a href="qpopupmenu.html">QPopupMenu</a>( this );
|
||
|
<a name="x1835"></a> <a href="qobject.html#connect">connect</a>( bookmarkMenu, SIGNAL( <a href="qpopupmenu.html#activated">activated</a>( int ) ),
|
||
|
this, SLOT( bookmarkChosen( int ) ) );
|
||
|
addId = bookmarkMenu-><a href="qmenudata.html#insertItem">insertItem</a>( <a href="qobject.html#tr">tr</a>( "Add bookmark" ) );
|
||
|
bookmarkMenu-><a href="qmenudata.html#insertSeparator">insertSeparator</a>();
|
||
|
|
||
|
<a href="qfile.html">QFile</a> f( ".bookmarks" );
|
||
|
if ( f.<a href="qfile.html#open">open</a>( IO_ReadOnly ) ) {
|
||
|
<a href="qdatastream.html">QDataStream</a> ds( &f );
|
||
|
ds >> bookmarkList;
|
||
|
f.<a href="qfile.html#close">close</a>();
|
||
|
|
||
|
QStringList::Iterator it = bookmarkList.begin();
|
||
|
for ( ; it != bookmarkList.end(); ++it ) {
|
||
|
bookmarkMenu-><a href="qmenudata.html#insertItem">insertItem</a>( *it );
|
||
|
}
|
||
|
}
|
||
|
|
||
|
<a name="x1836"></a> p-><a href="qpushbutton.html#setPopup">setPopup</a>( bookmarkMenu );
|
||
|
|
||
|
<a href="qfiledialog.html#addToolButton">addToolButton</a>( p, TRUE );
|
||
|
|
||
|
<a href="qobject.html#connect">connect</a>( dirView, SIGNAL( folderSelected( const <a href="qstring.html">QString</a> & ) ),
|
||
|
this, SLOT( setDir2( const <a href="qstring.html">QString</a> & ) ) );
|
||
|
<a href="qobject.html#connect">connect</a>( this, SIGNAL( <a href="qfiledialog.html#dirEntered">dirEntered</a>( const <a href="qstring.html">QString</a> & ) ),
|
||
|
dirView, SLOT( <a href="qfiledialog.html#setDir">setDir</a>( const <a href="qstring.html">QString</a> & ) ) );
|
||
|
|
||
|
<a href="qtoolbutton.html">QToolButton</a> *b = new <a href="qtoolbutton.html">QToolButton</a>( this );
|
||
|
QToolTip::<a href="qtooltip.html#add">add</a>( b, tr( "Go Home!" ) );
|
||
|
b-><a href="qbutton.html#setPixmap">setPixmap</a>( QPixmap( home ) );
|
||
|
<a href="qobject.html#connect">connect</a>( b, SIGNAL( <a href="qbutton.html#clicked">clicked</a>() ),
|
||
|
this, SLOT( goHome() ) );
|
||
|
|
||
|
<a href="qfiledialog.html#addToolButton">addToolButton</a>( b );
|
||
|
|
||
|
<a href="qwidget.html#resize">resize</a>( <a href="qwidget.html#width">width</a>() + width() / 3, height() );
|
||
|
}
|
||
|
|
||
|
CustomFileDialog::~CustomFileDialog()
|
||
|
{
|
||
|
if ( !bookmarkList.isEmpty() ) {
|
||
|
<a href="qfile.html">QFile</a> f( ".bookmarks" );
|
||
|
if ( f.<a href="qfile.html#open">open</a>( <a href="qfile.html#open">IO_WriteOnly</a> ) ) {
|
||
|
<a href="qdatastream.html">QDataStream</a> ds( &f );
|
||
|
ds << bookmarkList;
|
||
|
f.<a href="qfile.html#close">close</a>();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void <a name="f492"></a>CustomFileDialog::setDir2( const <a href="qstring.html">QString</a> &s )
|
||
|
{
|
||
|
<a href="qobject.html#blockSignals">blockSignals</a>( TRUE );
|
||
|
<a href="qfiledialog.html#setDir">setDir</a>( s );
|
||
|
<a href="qobject.html#blockSignals">blockSignals</a>( FALSE );
|
||
|
}
|
||
|
|
||
|
<a name="x1854"></a>void CustomFileDialog::<a href="qwidget.html#showEvent">showEvent</a>( <a href="qshowevent.html">QShowEvent</a> *e )
|
||
|
{
|
||
|
QFileDialog::<a href="qwidget.html#showEvent">showEvent</a>( e );
|
||
|
dirView->setDir( <a href="qfiledialog.html#dirPath">dirPath</a>() );
|
||
|
}
|
||
|
|
||
|
void <a name="f493"></a>CustomFileDialog::bookmarkChosen( int i )
|
||
|
{
|
||
|
if ( i == addId ) {
|
||
|
bookmarkList << dirPath();
|
||
|
bookmarkMenu-><a href="qmenudata.html#insertItem">insertItem</a>( <a href="qfiledialog.html#dirPath">dirPath</a>() );
|
||
|
} else {
|
||
|
<a name="x1831"></a> <a href="qfiledialog.html#setDir">setDir</a>( bookmarkMenu-><a href="qmenudata.html#text">text</a>( i ) );
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void <a name="f494"></a>CustomFileDialog::goHome()
|
||
|
{
|
||
|
if ( getenv( "HOME" ) )
|
||
|
<a href="qfiledialog.html#setDir">setDir</a>( getenv( "HOME" ) );
|
||
|
else
|
||
|
<a href="qfiledialog.html#setDir">setDir</a>( "/" );
|
||
|
}
|
||
|
|
||
|
// ****************************************************************************************************
|
||
|
|
||
|
int main( int argc, char ** argv )
|
||
|
{
|
||
|
QFileDialog::Mode mode = QFileDialog::ExistingFile;
|
||
|
<a href="qstring.html">QString</a> start;
|
||
|
<a href="qstring.html">QString</a> filter;
|
||
|
<a href="qstring.html">QString</a> caption;
|
||
|
bool preview = FALSE;
|
||
|
bool custom = FALSE;
|
||
|
<a href="qapplication.html">QApplication</a> a( argc, argv );
|
||
|
for (int i=1; i<argc; i++) {
|
||
|
<a href="qstring.html">QString</a> arg = argv[i];
|
||
|
if ( arg == "-any" )
|
||
|
mode = QFileDialog::AnyFile;
|
||
|
else if ( arg == "-dir" )
|
||
|
mode = QFileDialog::Directory;
|
||
|
else if ( arg == "-default" )
|
||
|
start = argv[++i];
|
||
|
else if ( arg == "-filter" )
|
||
|
filter = argv[++i];
|
||
|
else if ( arg == "-preview" )
|
||
|
preview = TRUE;
|
||
|
else if ( arg == "-custom" )
|
||
|
custom = TRUE;
|
||
|
else if ( arg[0] == '-' ) {
|
||
|
<a href="qapplication.html#qDebug">qDebug</a>("Usage: qdir [-any | -dir | -custom] [-preview] [-default f] {-filter f} [caption ...]\n"
|
||
|
" -any Get any filename, need not exist.\n"
|
||
|
" -dir Return a directory rather than a file.\n"
|
||
|
" -custom Opens a customized QFileDialog with \n"
|
||
|
" dir browser, bookmark menu, etc.\n"
|
||
|
" -preview Show a preview widget.\n"
|
||
|
" -default f Start from directory/file f.\n"
|
||
|
" -filter f eg. '*.gif' '*.bmp'\n"
|
||
|
" caption ... Caption for dialog.\n"
|
||
|
);
|
||
|
return 1;
|
||
|
} else {
|
||
|
<a name="x1842"></a> if ( !caption.<a href="qstring.html#isNull">isNull</a>() )
|
||
|
caption += ' ';
|
||
|
caption += arg;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if ( !start )
|
||
|
<a name="x1813"></a> start = QDir::<a href="qdir.html#currentDirPath">currentDirPath</a>();
|
||
|
|
||
|
if ( !caption )
|
||
|
caption = mode == QFileDialog::Directory
|
||
|
? "Choose directory..." : "Choose file...";
|
||
|
|
||
|
if ( !custom ) {
|
||
|
<a href="qfiledialog.html">QFileDialog</a> fd( QString::null, filter, 0, 0, TRUE );
|
||
|
<a name="x1819"></a> fd.<a href="qfiledialog.html#setMode">setMode</a>( mode );
|
||
|
if ( preview ) {
|
||
|
<a name="x1818"></a> fd.<a href="qfiledialog.html#setContentsPreviewEnabled">setContentsPreviewEnabled</a>( TRUE );
|
||
|
PreviewWidget *pw = new PreviewWidget( &fd );
|
||
|
<a name="x1817"></a> fd.<a href="qfiledialog.html#setContentsPreview">setContentsPreview</a>( pw, pw );
|
||
|
<a name="x1822"></a> fd.<a href="qfiledialog.html#setViewMode">setViewMode</a>( QFileDialog::List );
|
||
|
<a name="x1820"></a> fd.<a href="qfiledialog.html#setPreviewMode">setPreviewMode</a>( QFileDialog::Contents );
|
||
|
}
|
||
|
fd.<a href="qwidget.html#setCaption">setCaption</a>( caption );
|
||
|
<a name="x1821"></a> fd.<a href="qfiledialog.html#setSelection">setSelection</a>( start );
|
||
|
<a name="x1812"></a> if ( fd.<a href="qdialog.html#exec">exec</a>() == QDialog::Accepted ) {
|
||
|
<a name="x1816"></a> <a href="qstring.html">QString</a> result = fd.<a href="qfiledialog.html#selectedFile">selectedFile</a>();
|
||
|
printf("%s\n", (const char*)result);
|
||
|
return 0;
|
||
|
} else {
|
||
|
return 1;
|
||
|
}
|
||
|
} else {
|
||
|
CustomFileDialog fd;
|
||
|
fd.<a href="qdialog.html#exec">exec</a>();
|
||
|
return 1;
|
||
|
}
|
||
|
}
|
||
|
</pre>
|
||
|
|
||
|
<p>See also <a href="examples.html">Examples</a>.
|
||
|
|
||
|
<!-- eof -->
|
||
|
<p><address><hr><div align=center>
|
||
|
<table width=100% cellspacing=0 border=0><tr>
|
||
|
<td>Copyright © 2007
|
||
|
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
||
|
<td align=right><div align=right>Qt 3.3.8</div>
|
||
|
</table></div></address></body>
|
||
|
</html>
|