Results 1 to 20 of 25

Thread: Struct into a C++ class

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    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: Struct into a C++ class

    And just for clarification - a "struct" in C++ is also a class so instances of it can be treated as any other C++/Qt object (i.e. like QString or QObejct).

    The code needs one correction, you have to return properly prefixed type:

    Qt Code:
    1. MyClass::MyStruct *MyClass::getMyStruct()
    2. {
    3. return mystruct;
    4. }
    To copy to clipboard, switch view to plain text mode 
    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.


  2. The following user says thank you to wysota for this useful post:

    Zlatomir (20th September 2010)

Similar Threads

  1. QList<struct>
    By Axsis in forum Newbie
    Replies: 11
    Last Post: 12th October 2015, 07:48
  2. struct QbufferPrivate error!!
    By chochatown in forum Qt Programming
    Replies: 0
    Last Post: 27th May 2009, 15:37
  3. QDataStream class/struct & stream operators
    By darksaga in forum Qt Programming
    Replies: 1
    Last Post: 1st August 2008, 19:40
  4. Struct in network
    By sribalaji in forum Qt Programming
    Replies: 7
    Last Post: 26th March 2008, 10:38
  5. struct problem...
    By hiuao in forum General Programming
    Replies: 3
    Last Post: 5th April 2007, 07:48

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.