Results 1 to 5 of 5

Thread: Create custom object in qt?

  1. #1
    Join Date
    Sep 2017
    Posts
    29
    Thanks
    3
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Windows

    Default Create custom object in qt?

    Hi all,

    In objC i can create custom object like this


    Car.h

    @interface Car

    @property (nonatomic) NSString *make;
    @property (nonatomic) NSString *model;

    @end

    -(id)init;

    Car.m

    @interface Car

    @implementation

    -(id)init {
    self = [super init];
    if (self) {

    }
    return self;
    }

    @end


    Question is how to make similar thing in Qt (in c++ i guess)

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Create custom object in qt?

    Question is how to make similar thing in Qt (in c++ i guess)
    Get a C++ book or look at any one of the millions of C++ tutorials online (like this one, this one, or this one) and teach yourself some C++. Of course C++ supports defining and creating custom classes, as do all other object-oriented programming languages. Qt itself is C++ and defines thousands of custom objects.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Sep 2017
    Posts
    29
    Thanks
    3
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Windows

    Default Re: Create custom object in qt?

    I have basics in C++. I am well versed in ObjC and Pascal. I know the basics,
    but I am looking for answers that relates more to Qt IDE in general.

    What is the use of a forum if all answers to newbie questions is "go find a book"?

    Qt community is not looking good right now - quite unhelpful unwilling to share and teach
    newbies. I am starting a newbie tutorial blog for Qt Windows to help people like me in the future.
    If you are also a newbie like me, do follow my blog and i will share what i went thru in learning Qt.
    Here: https://qtnoobies.blogspot.com/ (right now i am still writing the first post ill have it posted
    in a couple of days).

    Thanks.... for nothing.

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Create custom object in qt?

    Hold on a minute. You asked

    Question is how to make similar thing in Qt (in c++ i guess)
    That's a basic, lesson one or two C++ question. What did you expect someone to tell you when you ask a completely open-ended fundamental question like "how do I define a class in C++"? Yes, I could have translated your Objective C code into C++, but then what? You asked a question that indicates you don't have much knowledge of basic C++, so I pointed you to resources you can use to educate yourself. Sorry if you don't think the time I spent to Google for those links, go to them, evaluate them, and then copy them into my reply wasn't helpful.

    The purpose of this forum is not to teach C++ basics. It is not to teach Qt basics either. There are plenty of books, tutorials, and examples that will teach you both. This forum exists to help people, newbies and experts alike, by answering questions about and solving problems they are having with Qt. We expect you to try to solve a problem yourself first, using the tools, documentation, and examples that are out there to help. When you get stuck, we expect you to tell us what you tried, what didn't work, and if needed post the non-working code so we can help you find the problem.

    I know the basics, but I am looking for answers that relates more to Qt IDE in general.
    And that's what this forum is here for. To answer specific questions, not to teach fundamental things you can learn from the documentation and other resources available to you. No one here is unwilling to help, but we aren't going to spoon-feed you. We'll point you in the right direction, but you have to feed yourself.

    Good luck with your blog.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  5. #5
    Join Date
    Sep 2017
    Posts
    29
    Thanks
    3
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Windows

    Default Re: Create custom object in qt?

    Great lecture. Still not answering but nice paragraphs and wordings. Thanks.

Similar Threads

  1. Can I create object in QML?
    By chong_kimkeang in forum Newbie
    Replies: 16
    Last Post: 23rd November 2012, 02:18
  2. create a Object by its name.
    By weixj2003ld in forum Qt Programming
    Replies: 2
    Last Post: 10th August 2011, 08:43
  3. Create Custom build specification for Qt 4.7 for my custom SDK
    By danics in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 19th October 2010, 15:23
  4. How do I create an Object at runtime?
    By Cayan in forum Newbie
    Replies: 2
    Last Post: 28th June 2010, 07:01
  5. Can't create an object : initialisation problem ?
    By Nyphel in forum Qt Programming
    Replies: 5
    Last Post: 12th March 2007, 09:07

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.