Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Apr 2010

    Rapid development with Qt (or lack thereof)

    Okay, I don't want to come off as complaining, so let me start by saying the work done by the Qt Devs is just insanely awesome. These guys make C++ code look like art.

    But here's my issue. I'm a programmer who is looking to transfer some code off of C# to Qt C++. However, I keep finding myself wasting time implementing very simple things. Let me give an example. Let's say I want to create a class in C#. I do the following:

    public class Foo {
         public int Bar {get; private set};
    Here this class is simple. It has a single public property that can be retreived anywhere but only set from within the class.

    Here's what I would have to do in Qt:

    class _FooData;
    public class Foo : QObject
          Foo(QObject *parent = 0);
          Foo(const Foo &other);
          Foo &operator=(const Foo &other);
          int getBar();
        void setBar(int bar);
        QSharedDataPointer<_FooData> d;
    class _FooData : QSharedData {
        int bar;
    The size is huge! And I haven't even written the .cpp file yet!. Is there anyway to speed up development? I'd love to write my code using Qt, but it ends up taking me hours to prototype a simple program.

  2. #2
    Super Contributor
    Join Date
    Nov 2009
    Minnesota, USA

    Re: Rapid development with Qt (or lack thereof)

    Well, I don't know much about C# but I'm guessing that much of the same code ends up getting generated under the covers in both cases.

    There are several C++ development environments (variants of Eclipse, among others) which will automatically generate setters and getters for you, if that's important to you. You can still use those and develop with Qt.

    Every language & development environment combo has advantages and disadvantages. It's really a matter of what's important to you, in your particular circumstances (plus, of course, whether the language/development environment you like is supported by the hardware and OS you want to use).

    To be completely honest, when it comes time to "prototype a simple program" I often dispense with the niceties like getters and setters and just write "dumb" code. (Of course, I have the discipline to go back and clean it up if it becomes product code.)

    Also note that you're not REQUIRED to use the shared data paradigm (in fact I never have). Unless you really want to be able to share the innards of the class between multiple instances you can simply declare Bar to be a private variable with a public getter. Nor do you need all of the QObject stuff, unless you want to use it's functionality for storage management or other things.

  3. #3
    Regular Contributor
    Join Date
    Mar 2009

    Re: Rapid development with Qt (or lack thereof)

    Note that your example lacks the Q_PROPERTY-macro that is needed if you want to be able to inspect that property at runtime

Similar Threads

  1. Qt for Symbian development resources
    By liuxg in forum [Archived] Qt General ( Qt技术)
    Replies: 55
    Last Post: 2011-01-26, 05:06
  2. automatic rotate screen on meamo
    By fily_love in forum Nokia N9
    Replies: 27
    Last Post: 2010-04-06, 08:37
  3. gsreamer-0.10-plugins-good+Phonon
    By niqt in forum Nokia N9
    Replies: 10
    Last Post: 2010-03-05, 10:56
  4. kinetic scrolling
    By stalep in forum Nokia N9
    Replies: 10
    Last Post: 2009-12-08, 13:41
  5. Senior QT Client Developer (Dublin, Ireland)
    By marynyc in forum News and Announcements
    Replies: 0
    Last Post: 2009-06-02, 18:24

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts