[Qt-interest] Strange slot problem

Donal O'Connor donaloconnor at gmail.com
Mon Apr 19 10:22:34 CEST 2010


Pure guess and being a while since I've done anything with QT but must you
register the QSqlError type with the MOC.

http://doc.trolltech.com/qq/qq14-metatypes.html

On Mon, Apr 19, 2010 at 9:12 AM, Marek Bronowicki <marek at cyberdeus.pl>wrote:

> Hello
>
> my QT: QT 4.6.2 MSVC 2008
>
> my db.h looks like this:
>
> class DB : public QObject
> {
>     Q_OBJECT
>
> public:
>     DB(QObject *parent);
>
> [...]
>
> signals:
>     void ConnectionSuccess();
>     void ConnectionFailure();
>     void ShowError(QString, QSqlError);
>
> private slots:
>     void CSuc();
>     void ConnectionFailureSLOT();
>     void ErrorMsg(QString query, QSqlError error);
>
> };
>
>
> and db.cpp looks like this:
>
>
> DB::DB(QObject *parent) : QObject(parent)
> {
>     QObject::connect(this,SIGNAL(ConnectionSuccess()),this,SLOT(CSuc()));
>
>
> QObject::connect(this,SIGNAL(ShowError(QString,QSqlError)),this,SLOT(ErrorMsg(QString,QSqlError)));
>  // other code
> }
>
> void DB::CSuc()
> {
>   // code
> }
>
> void DB::ErrorMsg(QString query, QSqlError error)
> {
>     QDialog *d = new QDialog((QWidget *)this->parent());
>     d->setWindowTitle("Błąd zapytania!");
>     QTextEdit *errmsg = new QTextEdit(d);
>     errmsg->setHtml("Zapytanie zgłosiło błąd<br />"+query+"<br /><br
> />"+error.text());
>     QVBoxLayout *dialoglayout = new QVBoxLayout(d);
>     dialoglayout->addWidget(errmsg);
>     d->setLayout(dialoglayout);
>     d->exec();
> }
>
> the strangest thing is that ErrorMsg slot is working properly but CSuc
> slot is Object::connect: No such slot DB::CSuc()
>
>
> Any help will be thankful :)
>
>
> Best Regards,
> Marek Bronowicki
>
> _______________________________________________
> 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/20100419/5c0c5e69/attachment.html 


More information about the Qt-interest-old mailing list