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

Thiago Macieira thiago.macieira at trolltech.com
Tue May 12 08:50:01 CEST 2009


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090512/30570ea1/attachment.bin 


More information about the Qt-interest-old mailing list