Thought about a Qt port

Dirk Hohndel dirk at hohndel.org
Sun Mar 31 13:03:11 PDT 2013


Alberto Mardegan <mardy at users.sourceforge.net> writes:

> On 03/31/2013 06:28 AM, Dirk Hohndel wrote:
>> linking with g++ solves that but then of course the resulting program
>> doesn't run...
>
> Strange, that worked for me. Anyway, linking with g++ is indeed correct,
> so I changed that.
>
>> I am happy to track things in a Qt branch in the official
>> repository. And I'm ok with things in that branch not working /
>> compiling at times. One thing that I do insist on are Signed-off-by:
>> lines for every commit...
>
> Absolutely. But please don't consider these commits as anything that I'd
> submit, they are just a playground to test some things and receive early
> feedback on the generic approach; and don't be too much upset if I'll
> rebase that wip branch -- I indeed plan to do it, and will try to come
> up with commits split in a way that makes sense.

That's fine. What I was trying to point out is that I'm happy to have
work in progress happen in the official tree (in a branch), so whenever
you think you are at a point that is good for us to start from, let me
know and I'll pull them.

But to make your own life easier once you are there it might be good to
get into the habit of signing off your commits ("git -s -a" makes that
easy).

> About the changes themselves, feel free to comment (and nitpick on the
> style); if I don't hear anything, I'll assume it's all OK.

I will do that ;-)

> I added one more commit which actually does something:
> https://github.com/mardy/subsurface/commit/f1b180afcd3398fec5c0c438ca86b01ab0acc69d

btw - you don't need to point to a commit; people can't pull that
easily. Just point to the branch 

git://github.com/mardy/subsurface wip

> Now when you start subsurface you'll see two windows, the usual Gtk+ and
> a new Qt one (who said that Gtk+ and Qt cannot co-exist? ;-) ).

Exciting :-)

> The Qt window does nothing, I just added it to test the i18n (it seems
> that getting gettext work with Qt is quite easy), the moc and uic (the
> file ui/main-window.ui is created with Qt Designer).

How would one start Qt Designer to be able to change that main window?

> Let me know if the usage of Qt Designer files is OK or if you prefer to
> see all the Qt code in .cpp files (I suspect the latter, since you were
> not using Glade). I actually never used Qt Designer myself before (my
> QtWidget needs were always minimal), but I'm starting to like it. :-)

As I said earlier, yes, I'm totally open to that.

> Another thing that you (and especially other Qt developers here) might
> want to comment about, is the definition of C++ classes in the .cpp
> files themselves (and not in a header file).
> I usually declare and define the private classes (those that don't need
> to be visible outside of the .cpp file) in the .cpp file itself, while
> generally Qt developers (at least KDE ones) prefer to have the
> declaration in a separate header file, leaving only the methods
> definitions in the .cpp file.  I find it more annoying than helpful (it
> increases the number of files, and force switching files in the editor
> often than necessary), but might be just me. :-)

We tend to only move things into header files that are indeed shared
between multiple code files.

As to the patches:

I assume the .ui file is machine generated so I won't complain about the
1 space indentation

The rest looks fairly solid; white space and indentation seem fine.

I agree with Lubomir that initializing pointers to 0 looks strange to my
eyes... 

Other than that, nothing jumps out at me right now.

/D


More information about the subsurface mailing list