[Qt-interest] (no subject)

Neeraj Jhawar navderm at gmail.com
Fri Jan 9 20:39:39 CET 2009


Is there any way this problem of cross thread signal slot model can be done
in QT3?
Am really apprehensive of using QT4 after everything has been done...

Please help if something can be done with this.

On Sat, Jan 10, 2009 at 3:39 AM, Scott Aron Bloom
<Scott.Bloom at sabgroup.com>wrote:

>  Without knowing your codebase, its hard to tell how long the conversion
> will take.
>
>
>
> You don't have to remove QT 3 to install QT 4.
>
>
>
> I would install QT 4, and try to build against it.  Much of the issues will
> be compile time issues and will be relatively easy to fix.
>
>
>
> Scott
>
>
>
> *From:* qt-interest-bounces at trolltech.com [mailto:
> qt-interest-bounces at trolltech.com] *On Behalf Of *Neeraj Jhawar
> *Sent:* Friday, January 09, 2009 10:22 AM
>
> *To:* Qt-interest at trolltech.com
> *Subject:* Re: [Qt-interest] (no subject)
>
>
>
> I am sorry but am very new to QT and Linux systems..
>
> Will installing and trying to run my old codes written in QT3 , in QT4 give
> me some problems I need to be aware of ?
> I was reading some posts and people have faced a lot of them it seems.
>
> I have written a lot of code and this problem was hopefully one of the last
> ones I had to solve before I ran my project well.
> So if there is no problem as such with compatibility its fine but if there
> is, could you please suggest me another way out?
>
> In case I have to go ahead with QT4...
> Also should I remove QT3 and then install QT4 or just install QT4? I can
> install QT4 but how is uninstallation of QT3 to be done??
>
>
>  On Sat, Jan 10, 2009 at 3:13 AM, Scott Aron Bloom <
> Scott.Bloom at sabgroup.com> wrote:
>
> FYI…
>
>
>
> In QT3, QThread is NOT derived from QObject
>
>
>
> http://doc.trolltech.com/3.3/qthread.html
>
>
>
> Scott
>
> *From:* qt-interest-bounces at trolltech.com [mailto:
> qt-interest-bounces at trolltech.com] *On Behalf Of *Neeraj Jhawar
> *Sent:* Friday, January 09, 2009 10:09 AM
>
>
> *To:* Qt-interest at trolltech.com
> *Subject:* Re: [Qt-interest] (no subject)
>
>
>
> Okie sir
>
> thanx a lot for the help  :)
>
> On Sat, Jan 10, 2009 at 3:03 AM, Scott Aron Bloom <
> Scott.Bloom at sabgroup.com> wrote:
>
> Sorry… I assumed you were using a release of QT put out in the last 3
> years…
>
>
>
> Why are you using QT3?  This is clearly new code.  Use QT4.
>
>
>
> The thread model, and cross thread signal/slot model was completely redone
> for QT4.
>
>
>
> Scott
>
> *From:* qt-interest-bounces at trolltech.com [mailto:
> qt-interest-bounces at trolltech.com] *On Behalf Of *Neeraj Jhawar
> *Sent:* Friday, January 09, 2009 9:48 AM
>
>
> *To:* Qt-interest at trolltech.com
>
> *Subject:* Re: [Qt-interest] (no subject)
>
>
>
> I am sorry but i did not get what you mean... I am using QT3 ... how do I
> "turn off QT3 support".
>
> Please explain. I have spent more than 3 hours stuck with this problem..
>
> On Sat, Jan 10, 2009 at 2:42 AM, Scott Aron Bloom <
> Scott.Bloom at sabgroup.com> wrote:
>
> First, this is new code, turn off QT3 support.
>
> That said, your code worked fine for me.  Compiled, linked (I had to
> create a simple main) and it ran fine.
>
> Scott
>
> > -----Original Message-----
> > From: qt-interest-bounces at trolltech.com [mailto:qt-interest-
> > bounces at trolltech.com] On Behalf Of Neeraj Jhawar
> > Sent: Friday, January 09, 2009 9:03 AM
> > To: Qt-interest at trolltech.com
> > Subject: [Qt-interest] (no subject)
> >
> > The code:
> >
> > this program tries to accomplish nothing but to make the signal and
> > slot in different threads work:
> >
> > this part of code is from file threadstuff.cpp
> >
> > #include <qlayout.h>
> > #include <qpushbutton.h>
> >
> > #include <stdlib.h>
> > #include <stdio.h>
> > #include <iostream.h>
> >
> > #include "threadstuff.h"
> >
> > Thread::Thread()
> > {
> >       stopped = false;
> > }
> >
> > void Thread::run()
> > {
> >       static int aha = 0;
> >       while(!stopped)
> >       {
> >               cerr << messageStr.ascii();
> >               if (aha >=100)
> >               {
> >                       emit wow();
> >                       aha = 0;
> >               }
> >               aha++;
> >       }
> >       stopped = false;
> >       cerr << endl;
> > }
> >
> > void Thread::stop()
> > {
> >       stopped = true;
> > }
> >
> > void Thread::setMessage(const QString &message)
> > {
> >       messageStr = message;
> > }
> >
> > void Thread::startOrStopThreadAinthread()
> > {
> > }
> >
> >
> //======================================================================
> =
> >
> > ThreadForm::ThreadForm (QWidget *parent, const char *name) :
> > QDialog(parent, name)
> > {
> >       setCaption(tr("Threads"));
> >
> >       threadA.setMessage("A");
> >
> >       threadAButton = new QPushButton("Start A", this);
> >       quitButton = new QPushButton ("Quit", this);
> >       quitButton->setDefault(true);
> >
> >       connect(threadAButton, SIGNAL(clicked()), this,
> > SLOT(startOrStopThreadA()));
> >       connect(quitButton, SIGNAL(clicked()), this, SLOT(close()));
> >
> >       connect(&threadA, SIGNAL(wow()), this,
> > SLOT(startOrStopThreadAII()));
> >       //connect(threadA, SIGNAL(wow()), this,
> > SLOT(startOrStopThreadAII()));
> >
> >       QHBoxLayout *layout = new QHBoxLayout(this);
> >       layout->addWidget(threadAButton);
> >       layout->addWidget(quitButton);
> > }
> >
> >
> >
> > void ThreadForm :: startOrStopThreadA()
> > {
> >       if (threadA.running())
> >       {
> >               threadA.stop();
> >               threadAButton->setText(tr("Start A"));
> >       }
> >       else
> >       {
> >               threadA.start();
> >               threadAButton->setText(tr("Stop A"));
> >       }
> > }
> >
> >
> > void ThreadForm :: startOrStopThreadAII()
> > {
> >       static int ahaII = 0;
> >       if (ahaII == 0)
> >       {
> >               ahaII++;
> >               quitButton->setEnabled(true);
> >       }
> >       else if (ahaII == 1)
> >       {
> >               ahaII = 0;
> >               quitButton->setEnabled(false);
> >       }
> > }
> >
> >
> > void ThreadForm::closeEvent (QCloseEvent *event)
> > {
> >       threadA.stop();
> >       threadA.wait();
> >       event->accept();
> > }
> >
> >
> > =====================================
> >
> > this part of the code is from threadstuff.h
> >
> >
> > #ifndef THREADSTUFF_H
> >       #define THREADSTUFF_H
> >
> >       #include <qdialog.h>
> >       #include <qthread.h>
> >
> >       class Thread : public QThread
> >       {
> >       public:
> >               Thread();
> >
> >               void startOrStopThreadAinthread();
> >               void setMessage(const QString &message);
> >               void stop();
> >
> >       signals:
> >               void wow();
> >
> >       protected:
> >               void run();
> >
> >       private:
> >               QString messageStr;
> >               volatile bool stopped;
> >       };
> >
> >
> >       class ThreadForm : public QDialog
> >       {
> >               Q_OBJECT
> >       public:
> >               ThreadForm (QWidget *parent = 0, const char *name = 0);
> >
> >       protected:
> >               void closeEvent(QCloseEvent *event);
> >       private slots:
> >               void startOrStopThreadA();
> >               void startOrStopThreadAII();
> >       private:
> >               Thread threadA;
> >               QPushButton *threadAButton;
> >               QPushButton *quitButton;
> >       };
> >
> > #endif
> >
> >
> >
> > Thank you
> >
> >
> >
> > --
> > Neeraj Jhawar
> > Senior Undergraduate
> > Mechanical Engineering Department
> > Punjab Engineering College
> > Chandigarh.
> > India
> > _______________________________________________
> > Qt-interest mailing list
> > Qt-interest at trolltech.com
> > http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
>
>
> --
> Neeraj Jhawar
> Senior Undergraduate
> Mechanical Engineering Department
> Punjab Engineering College
> Chandigarh.
> India
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
>
>
> --
> Neeraj Jhawar
> Senior Undergraduate
> Mechanical Engineering Department
> Punjab Engineering College
> Chandigarh.
> India
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
>
>
> --
> Neeraj Jhawar
> Senior Undergraduate
> Mechanical Engineering Department
> Punjab Engineering College
> Chandigarh.
> India
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>


-- 
Neeraj Jhawar
Senior Undergraduate
Mechanical Engineering Department
Punjab Engineering College
Chandigarh.
India
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090110/6d921166/attachment.html 


More information about the Qt-interest-old mailing list