[Qt-interest] Problem with getExistingDirectory....Please advise

Usman Ajmal uzmanajmal at gmail.com
Tue May 12 10:59:05 CEST 2009


Thank you very much Thiago...

One more favor....am getting following error:

error: no matching function for call to
‘MyFileDialog::getExistingDirectory(Ui::MainWindow* const, const char [23],
QString, bool)’
filedialog.h:41: note: candidates are: static QString
MyFileDialog::getExistingDirectory(QWidget*, const char*, const QString&,
bool, bool)

I know what the error says i.e. i have to use QWidget but don't know how to
resolve it. Following are the snippets of code...

http://pastebin.com/d3eb40a10
http://pastebin.com/d559a1d86



On Tue, May 12, 2009 at 11:50 AM, Thiago Macieira <
thiago.macieira at trolltech.com> wrote:

> Usman Ajmal wrote:
> >I have a
> >class Ui_MainWindow : public QMainWindow
> >
> >It has one public function as below:
> >
> >void addDirectory() {
> >    QWidget k;
> >    QString s = MyFileDialog::getExistingDirectory(this);
> >    lineEdit->setText(s);}
> >
> >I want when i click on a a button named Browse, the above function may
> > run. I am using following LOC for this purpose
> >
> >QObject::connect(Browse, SIGNAL(clicked()),this ,
> > SIGNAL(addDirectory()));
> >
> >Please suggest what should i write in place of 'this' because the
> > current code, after compilation gives following error
> >No such signal QMainWindow::addDirectory()
>
> That's because you really don't have a signal called "addDirectory".
>
> You want it to be a slot, not a signal. So change the SIGNAL macro to SLOT
> in your connection and mark your function as a slot. That is, in your
> class definition, make sure you have:
>
> public slots:
>        void addDirectory();
>
> --
> Thiago Macieira - thiago.macieira (AT) nokia.com
>  Senior Product Manager - Nokia, Qt Software
>      Sandakerveien 116, NO-0402 Oslo, Norway
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090512/c6cee944/attachment.html 


More information about the Qt-interest-old mailing list