Thread overview
Getting Qte5 to work
Oct 27, 2020
Josh Dredge
Oct 28, 2020
evilrat
Oct 28, 2020
Josh Dredge
Oct 28, 2020
Mike Parker
Oct 28, 2020
Josh Dredge
Oct 28, 2020
Patrick Schluter
Oct 28, 2020
Marcone
October 27, 2020
Hi all, I'm completely new to D and while I'm not new to programming in general, I mostly do web development, and what desktop development I've done has all been with easy drag-and-drop GUI builders - so Visual Basic, C# and J# (if that doesn't date me). I'm trying to experiment in new languages, but it's shocking to me how few just don't have GUI builders.

I'm looking at learning D, but would like to stick with what I know on desktop in terms of event-driven GUI based applications.

I have Visual D installed, as well as QtCreator and was hoping to be able to use Qt with D. I'm happy without any GUI builder for now, but still need a working GUI library! Qte5 looks fine but need to figure out how to implement it.

I've installed D in "C:\D" (Windows 10 x64).
I've installed Qte5 in "C:\D\Qte5".

Quite simply typing "import Qte5;" into the code doesn't work (module not found), and I'm not sure how to make sure the library is correctly installed and reference. Is there a setup guide? I found one on Youtube but it didn't really explain anything. What's the way to do it?

Or any other GUI libraries with examples and set up guides?

Thanks!

October 28, 2020
On Tuesday, 27 October 2020 at 11:46:02 UTC, Josh Dredge wrote:
> Hi all, I'm completely new to D and while I'm not new to programming in general, I mostly do web development,

Welcome! If by web development you also have back-end programming then you should be like 50% know how desktop programming works.

>
> I'm looking at learning D, but would like to stick with what I know on desktop in terms of event-driven GUI based applications.

Just an advice, Qte5 isn't well maintained, the other alternatives such as 'dlangui' also seems abandoned, so basically the only maintained UI library here is gtk-d, but there was recently a nice tutorial series written about it.

Though I admit I've kind of dropped from the D for the 6 months.

> I have Visual D installed, as well as QtCreator and was hoping to be able to use Qt with D. I'm happy without any GUI builder for now, but still need a working GUI library! Qte5 looks fine but need to figure out how to implement it.
>
> I've installed D in "C:\D" (Windows 10 x64).
> I've installed Qte5 in "C:\D\Qte5".
>
> Quite simply typing "import Qte5;" into the code doesn't work (module not found), and I'm not sure how to make sure the library is correctly installed and reference. Is there a setup guide? I found one on Youtube but it didn't really explain anything. What's the way to do it?
>

First, since you are already trying to work with C++ (Qt is a C++ framework after all) under the hood you will likely need to install MS build tools and Windows SDK, this will get you missing libraries and first-class support for building native binaries.

Now to the point - 'module not found' is a compiler message that tells you 'there were no such module in module search paths', with dmd you can point compiler to look for qte5 dir with -I flag (or recently -i to also build these), then you also need to pass built .lib OR .obj files for Qte5 that contains compiled code otherwise you'll see link errors.

So for building your code it is better (for now) to use 'dub'(official build system & package manager, usually ships with compilers)


Let's just make a new dub project and add qte as dependency (since it's already on dub registry)

  - Let's create a new project in current working directory named MyAwesomeProject, just hit enter for all questions
    $> dub init MyAwesomeProject

  - Now go to this folder
    $> cd MyAwesomeProject

  - Clone qte5 repo to your project (or download and unzip)
    $> git clone https://github.com/MGWL/QtE5

  - And let's add Qte5 dependency(btw you can see it here https://code.dlang.org/packages/qte5), note that it is completely unrelated with our cloned repo
    $> dub add qte5

  - Now open your dub.json in your project and replace dependency path (we do this because it is semi-abandoned, and last published version was 4 years ago, even though there was some recent activity on master branch) so your dependency section should like this
    "dependencies": {
        "qte5": { "path" : "./QtE5" },
    },

  - If you try to build it right now it will error, so we have to "fix" it, so go to QtE5 folder, open dub.json and remove 'sourceFiles' section, it should build just fine without it.

  - Copy example code from QtE5/example/example.d and replace your source/app.d with it

  - Build using dub
    $> dub build

  - Done! Now if you have Qt5 installed and present in you system %PATH% environment variable (or copied DLL's next to executable) I assume it should work. (since I don't have I can't test if it actually works)

  - (Optional) It is possible to (re)generate VisualD project after you modify your dub project configuration, (additionally it can take any other build options such as --arch or --config, but ultimately it generates exactly one variant of all possible arch/config flavors)
    $> dub generate visuald

Where to get packages?
D packages and dub (note though that not everyone publish it here, some people have extra fancy stuff on their github/gitlab) - https://code.dlang.org/


October 28, 2020
On Wednesday, 28 October 2020 at 06:52:35 UTC, evilrat wrote:
> On Tuesday, 27 October 2020 at 11:46:02 UTC, Josh Dredge wrote:
>> [...]
>
> Welcome! If by web development you also have back-end programming then you should be like 50% know how desktop programming works.
>
> [...]

Fantastic, thank you! This was super informative and from what I can tell seems to be working fine.

Unfortunate that there's not many active GUI projects for D as, from what I can tell, it is an excellent language that developers would love to be working with! I will give Gtk a go too - I've never programmed with it, but I used Ubuntu alot back in the day and never really liked applications that used it, but maybe its more responsive on Windows or time has fixed the issues!

THanks again, and for the kind welcome!
October 28, 2020
On Wednesday, 28 October 2020 at 07:50:27 UTC, Josh Dredge wrote:

> developers would love to be working with! I will give Gtk a go too - I've never programmed with it, but I used Ubuntu alot back in the day and never really liked applications that used it, but maybe its more responsive on Windows or time has fixed the issues!
>

You can find a set of tutorials for gtkD here:

https://gtkdcoding.com/
October 28, 2020
On Wednesday, 28 October 2020 at 07:56:35 UTC, Mike Parker wrote:
> On Wednesday, 28 October 2020 at 07:50:27 UTC, Josh Dredge wrote:
>
>> developers would love to be working with! I will give Gtk a go too - I've never programmed with it, but I used Ubuntu alot back in the day and never really liked applications that used it, but maybe its more responsive on Windows or time has fixed the issues!
>>
>
> You can find a set of tutorials for gtkD here:
>
> https://gtkdcoding.com/

Fantastic resource, thank you very much. Have that working too! And Glade looks like a great interface builder so is likely what I’ll be using.
October 28, 2020
On Wednesday, 28 October 2020 at 06:52:35 UTC, evilrat wrote:
>
> Just an advice, Qte5 isn't well maintained, the other alternatives such as 'dlangui' also seems abandoned, so basically the only maintained UI library here is gtk-d, but there was recently a nice tutorial series written about it.

DWT is also still active. The looks are a little outdated as it is swt-3 based but works just fine.


October 28, 2020
Look this video https://www.youtube.com/watch?v=Es9Qs9_1ipk