[Qt-interest] Pls help w/ basic 'data' transfer from class to class

S. Aguinaga sa_jr at yahoo.com
Sun Jul 5 21:28:10 CEST 2009



Hello Dear Fellows,

I am spending an unreasonable amount of time trying to: Pass Strings to another Class to build another window.
In other words, I extract two QStrings from a database, but now I want to pass only this information to another class
that builds another window using these strings. an I can't get pass the errors  --So, I'm hoping one you can drop me a hint.

The first window prompts me for a userID, I authenticate it against records on the database, I want to use this ID in the next dialog window.
The next dialog window will select another user from a table ( same database, different table ) and then use these 2 strings through out 
my application.

First string: 
I tried line below in my main.cpp:

FirstWin *homeWindow = new FirstWin ( this, "userID");

***** firstwin.h declares it as: 
class FirstWin : public QMainWindow
{
    Q_OBJECT

public:
   FirstWin(QWidget *parent = 0, const QString *); // Or  FirstWin(QWidget *parent = 0, const char *);


***** firstwin.cpp implements it as:
FirstWin:: FirstWin(QWidget *parent, const QString userID) : QMainWindow(parent)
{
    qDebug() << userID << "\n";
    ui.setupUi(this);

But, I get errors about 'this' being a non-member (blah, blah) and I drop 'this', and just use in main.cpp FirstWin homeWindow("userID");

I also get errors.  
Should I be using "class FirstWin : public QDialog in my header file?  Any hints into getting this to work will be sincerely appreciated!!
Thanks.

// Sal Aguinaga
// Northwestern University


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090705/d87b4370/attachment.html 


More information about the Qt-interest-old mailing list