Help - Search - Members - Calendar
Full Version: QFileDialog Brickwall
OESF Forums > Distros, Development, and Model Specific Forums > Everything Development > Qt/Qtopia
Another question for Qtopia experts...

I'm trying to use a QFileDialog and hitting my head against a has to be obvious...

I keep getting compile errors:
zgscore.cpp: In method `void ZGS::Print()':
zgscore.cpp:259: no method `QFileDialog::getSaveFileName'
zgscore.cpp:259: warning: unused variable `class QString fileName'
make: *** [zgscore.o] Error 1

Here is the code:
void ZGS::Print()
QString fileName = QFileDialog::getSaveFileName( "/tmp/zgscore.txt",
"Textfiles (*.txt)",
"save file dialog",
"Choose a filename to print report" );
/* do something with fileName here */

Here is the class:
class ZGS : public ZGSBase

ZGS( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
private slots:
void Print();

I've included <qfiledialog.h> so that's not the problem, what could be the deal?

Thanks in advance.
Welcome to the wonderful world of Qt/Embedded, where features are optional biggrin.gif
Qt/Embedded in the Qtopia/Opie configuration defines QT_NO_FILESELECTOR hence does not contain the QFileSelector. Read qfileselector.h which explains why you can include that file but don't get any symbols.
Ok, so if I can't use QFileDialog, is there a quick/dirty way to do this?
#include <qpe/filedialog.h> and use that.
Also look at the FileDialog included in the application "Just Reader" created by Dmitri Skachkov. He has the application released under GPL and it may be more suited for a PDA. As I recall it looked pretty good.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2016 Invision Power Services, Inc.