Results 1 to 5 of 5

Thread: pointer

  1. #1
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default pointer

    him I've a prob.
    I have;
    Qt Code:
    1. QProgressDIalog* ppp //this in class Object
    2. ppp = 0; //in costructor of Object
    3. void object::setProgr(QProgressDialog* p){
    4. ppp=p;
    5. }
    6. //mainForm.cpp
    7. QProgressDIalog* prog = new QProgressDIalog();
    8. this->setProgr (prog);
    To copy to clipboard, switch view to plain text mode 
    It compile but on give me runtime error...why?Ho can I do?
    are there other way to pass pointer? it seems that ppp remain null...
    thanks
    Last edited by mickey; 27th July 2006 at 01:20.
    Regards

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: pointer

    Maybe somewhere in your code you try to dereference the pointer which has not been initialised? What does a debugger say?

  3. #3
    Join Date
    Aug 2006
    Posts
    221
    Thanks
    3
    Thanked 29 Times in 19 Posts

    Default Re: pointer

    Quote Originally Posted by mickey
    It compile but on give me runtime error...why?Ho can I do?
    are there other way to pass pointer? it seems that ppp remain null...
    thanks
    With your shortended code example it is really hard to say. We know what you want to do, but the how is somewhat incomplete. At least the interesting scope information got lost.

  4. #4
    Join Date
    Jan 2006
    Location
    India
    Posts
    54
    Thanks
    1
    Thanked 7 Times in 6 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: pointer

    try

    Qt Code:
    1. ppp = new QProgressDialog(p);
    To copy to clipboard, switch view to plain text mode 

    instead of

    Qt Code:
    1. ppp=p;
    To copy to clipboard, switch view to plain text mode 

  5. #5
    Join Date
    Aug 2006
    Posts
    26
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: pointer

    I am just going from the example, but in setProgr you're using QProgressDialog, but you're passing QProgressDIalog. Would this affect anything?

Similar Threads

  1. simple pointer question
    By mickey in forum General Programming
    Replies: 6
    Last Post: 16th June 2006, 09:19
  2. Is there a Pointer Based QMap or Similar
    By vasudhamirji in forum Qt Programming
    Replies: 3
    Last Post: 4th April 2006, 14:34
  3. Signals destroys my pointer
    By Jojo in forum Qt Programming
    Replies: 12
    Last Post: 7th March 2006, 21:05
  4. get Parent Pointer
    By raphaelf in forum Qt Programming
    Replies: 8
    Last Post: 3rd March 2006, 13:09
  5. Replies: 2
    Last Post: 16th February 2006, 19:09

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.