Results 1 to 2 of 2

Thread: Pointer of an unknown type...

  1. #1

    Default Pointer of an unknown type...

    Support LHWidget1 and LHWidget2 inherits from QWidget.

    Now suppose LHWidget3 gets passed either LHWidget1 or LHWidget2. And a property of LHWIdget3 named ptr gets set to the either widget.

    How would I do this? this is what I have tried:

    Qt Code:
    1. LHWidget1* ptr; // complains when LHWidget2 is passed
    2. LHWidget2* ptr; // complains when LHWidget1 is passed
    3. QWidget* ptr; // complains when either is passed
    To copy to clipboard, switch view to plain text mode 

  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 of an unknown type...

    Solution 3 is the way to go. If there are complaints from the compiler, you probably forgot to include headers for your widgets.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Convert between a custom data type wrapped in a QVariant
    By darkadept in forum Qt Programming
    Replies: 2
    Last Post: 17th March 2009, 09:07
  2. Dynamic pointer type
    By estanisgeyer in forum General Programming
    Replies: 3
    Last Post: 9th October 2008, 16:51
  3. Compile 4.4.0
    By LordQt in forum Installation and Deployment
    Replies: 18
    Last Post: 29th May 2008, 13:43
  4. dummy question(Error)
    By Masih in forum Qt Programming
    Replies: 12
    Last Post: 19th July 2007, 23:38
  5. Qt 4.2.3 Configure Issue...
    By amcdaniel in forum Installation and Deployment
    Replies: 4
    Last Post: 13th May 2007, 12:02

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.