April 05, 2011
You can follow these instructions to build, as long as you have CMake, DMD2, and GCC installed and in path:

http://www.dsource.org/projects/qtd/wiki/BuildWindows

Also I have to warn you that QtD has shell scripts to build the examples, but they're pretty much hardcoded for D1. Also many examples can only be compiled with D1.

I've made some batch files for the examples, and changed examples to compile with D2. Not all of them though. If you need them, I'll just double-check that they still work and I'll send them over.
April 05, 2011
On 4/5/11, Adam D. Ruppe <destructionator@gmail.com> wrote:
> Andrej Mitrovic wrote:
>> No, it still requires the patch for some code. I've had a bug report where I was told to patch DMD.
>
> :-(
>
> Still, it's /so/ close to being usable out of the box. I think if someone could find a week or two to devote to it, we could get the GUI part pretty solid.
>

Yeah, the few examples that do compile look and run great. It would be nice to be able to understand how this wrapper works at all. There are multiple directories with source files and you have to run some code generator before compiling Qt. It seems very complicated, I wouldn't even know where to begin to start contributing.
April 05, 2011
"Andrej Mitrovic" <andrej.mitrovich@gmail.com> wrote in message news:mailman.3178.1301970383.4748.digitalmars-d@puremagic.com...
> On 4/5/11, Nick Sabalausky <a@a.a> wrote:
>> After all, I
>> *really* want to get around to making my own web browser (based off
>> either
>> Mozilla or Chromium) - I'm getting really fed up with the current state
>> of
>> available web browsers. Well, and the web as a whole (god I fucking hate
>> the
>> web), but one step at a time, I guess).
>
> I'll be the first to install it.
>

Yay, so I'm not the only one after all :)

I think the hardest part of the project will be to resist the urge to stick in non-optional code to deliberately screw around with servers that try to push idiotic BS.

Somewhat related, but admittedly even more OT: Am I the only one that misses the Sherlock and Watson apps? Back when I was giving OSX a try, those were a big part of what attracted me to OSX in the first place. And then they promptly whithered and died in favor of inferior trends like AJAX and locking data directly into a proprietary viewer (now known as "a website"). (Whatever happened to data interchange and the separation of program and data? I feel like we're back in the stone age when Lotus 1-2-3 data stayed in Lotus, Excel data stayed in Excel, WordPerfect data stayed in WordPerfect, etc. If you want to browse Amazon's stock, you *must* use *the* viewer ("website") that Amazon provides. If you want to check a library's stock, you *must* use *the* [likely horribly broken] viewer ("website") that the library in question provides. If you want to watch a video, you *must* use *the* flash-based viewer that the site provides. Etc. WTF is this, 1989? Meh, more like "1984" apparently...)

> Btw, there's a full web browser example in the QtD sources. But it has to be ported to D2. And then you have to deal with any eventual bugs along the way. :]

Cool, I'll have to take a look. Any idea offhand what rendering engine it uses?


April 05, 2011
Nick Sabalausky wrote:
> Looking at the pages that are there for QtD, and the source browser, I'm honestly not sure how to even get started with it.

Somewhere, there was a binary distribution with the needed .libs.. I don't remember where, but I think I still have a copy on my other laptop (not available right now though).

Note that the duic for Qt Designer files apparently is behind
some changes - it won't work right. Gotta write straight D yourself.

But, you install it however, the process on the site I think works but it takes a little while.

Anyway, here's a hello world I just whipped up with some comments to keep in mind - stuff that took me hours to figure out...

The compile line looks like this on Linux:
dmd hello.d -I/usr/local/include/d -L-L/usr/local/lib -L-lqtdgui -L-lqtdcore
-L-lcpp_core -L-lcpp_gui -L-lQtGui -L-lQtCore

Note it takes a few seconds to compile. Pretty slow for D.

It's similar on Windows, but since I don't have my win laptop available right now I don't quite remember what it was exactly.

Anyway, the program:

// Qt's files are pulled in from the qt.gui or qt.core packages
// Seems to require a pretty long list of imports....
import qt.gui.QApplication;
import qt.gui.QMessageBox;
import qt.gui.QPushButton;
import qt.gui.QWidget;

int main(string[] args) {
    // main looks a lot like a C++ qt program, right down to
    // wanting scope classes so the destructors run in order

    scope app = new QApplication(args);

    scope mywindow = new MyWindow();
    mywindow.show();

    return app.exec();
}

class MyWindow : QWidget {
    this() {
         button = new QPushButton(this);
         setWindowTitle("Hello"); // methods are same as C++ but
                                  // thankfully they use D strings

         // signals and slots are connected by putting the signature
         // in quotes. No need for the SIGNAL or SLOT macro from C++
         // You leave the signal_ or slot_ off (see below)
         connect(button, "clicked", this, "sayHello");
    }

    // signals and slots use a naming convention instead of a label
    // like in C++. signals are declared: void signal_myName();
    // and here is a slot. When connecting, leave signal_ or slot_
    // off the string
    void slot_sayHello() {
         // the static call like in C++
         QMessageBox.information(null, "hello", "hello");
         this.close();
    }

    QPushButton button;

    // You must remember to mix this in for any class that uses
    // signals and slots to work, otherwise it will segfault at
    // runtime on the connect calls.

    // It's like the C++ Q_OBJECT macro, but while you'd normally
    // put the C++ macro at the top of the class, this mixin needs
    // to be at the bottom of the class or you'll hit forward
    // reference hell when compiling.

    mixin Q_OBJECT;
}
April 05, 2011
"Andrej Mitrovic" <andrej.mitrovich@gmail.com> wrote in message news:mailman.3181.1301971416.4748.digitalmars-d@puremagic.com...
> You can follow these instructions to build, as long as you have CMake, DMD2, and GCC installed and in path:
>

GCC, really? Even on Windows? (GCC on Windows is such a nightmare.)

> http://www.dsource.org/projects/qtd/wiki/BuildWindows
>

Ok, so the steps in there *are* required then. I wasn't sure if that was to *use* QtD or just to re-compile some .lib or something.

> Also I have to warn you that QtD has shell scripts to build the examples, but they're pretty much hardcoded for D1. Also many examples can only be compiled with D1.
>
> I've made some batch files for the examples, and changed examples to compile with D2. Not all of them though. If you need them, I'll just double-check that they still work and I'll send them over.


April 05, 2011
On 4/4/11 8:36 PM, Nick Sabalausky wrote:
> "Daniel Gibson"<metalcaedes@gmail.com>  wrote in message
> news:inddni$kmi$3@digitalmars.com...
>>
>> I don't know if wee need yet another GUI library.
>> Are you sure Qt and DWT aren't good enough?
>>
>
> AIUI:
>
> DWT doesn't support D2 (neither does wxD).

I understand DWT does support D2 on Windows as of today:

http://hg.dsource.org/projects/dwt2/rev/9f4c18c268b2


Andrei

April 05, 2011
On 4/5/11, Nick Sabalausky <a@a.a> wrote:
> GCC, really? Even on Windows? (GCC on Windows is such a nightmare.)
>
>> http://www.dsource.org/projects/qtd/wiki/BuildWindows

Just download and run it and don't worry about it too much: http://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/mingw-get-inst/mingw-get-inst-20110316/mingw-get-inst-20110316.exe/download

As long as you can invoke gcc.exe, you're set. The problem-makers are those cygwin dependent libs, but QtD works fine without any cygwin shenanigans.

Oh btw, I just found a cool trick today to figure out in what directory an app resides. E.g. if you invoke "gcc.exe" and you want to know where it's installed. Add this batch file to your path:

@setlocal
@set P2=.;%PATH%
@for %%e in (%PATHEXT%) do @for %%i in (%~n1%%e) do @if NOT
"%%~$P2:i"=="" echo %%~$P2:i

Then just run `where myapp.exe`, and it shows you the full path.
April 05, 2011
Right, so you need this: ftp://ftp.qt.nokia.com/qtsdk/qt-sdk-win-opensource-2010.04.exe

After installing to C:\Qt or wherever, just add these two to PATH,
make sure they're before any other mingw path:
C:\Qt\2010.04\mingw\bin
C:\Qt\2010.04\qt\bin

(replace paths as necessary)
April 05, 2011
Wait, I'm a dumbass!

Actually QtD needs to have Qt's MinGW in PATH, not the regular MinGW. Hold on a second, let me see what you need to do..
April 05, 2011
"Adam D. Ruppe" <destructionator@gmail.com> wrote in message news:ine114$14ar$1@digitalmars.com...
> Nick Sabalausky wrote:
>> Looking at the pages that are there for QtD, and the source browser, I'm honestly not sure how to even get started with it.
>
> Somewhere, there was a binary distribution with the needed .libs.. I don't remember where, but I think I still have a copy on my other laptop (not available right now though).
>
> Note that the duic for Qt Designer files apparently is behind
> some changes - it won't work right. Gotta write straight D yourself.
>
> But, you install it however, the process on the site I think works but it takes a little while.
>
> Anyway, here's a hello world I just whipped up with some comments to keep in mind - stuff that took me hours to figure out...
>

Thanks.


> The compile line looks like this on Linux:
> dmd
> hello.d -I/usr/local/include/d -L-L/usr/local/lib -L-lqtdgui -L-lqtdcore
> -L-lcpp_core -L-lcpp_gui -L-lQtGui -L-lQtCore
>

Hmm, I really wish DMD had a cmdline param to specify a library to be passed to the linker rather than needing to use "-L". Makes it impossible to write a cross-platform DMD command for anything that requires linking to a lib.

Should "pragma(lib, nameoflib);" work, or was that just a special thing in bu(il)d?


> Note it takes a few seconds to compile. Pretty slow for D.
>

Psshh. Compiling DDMD takes a minute or two. I can live with a few seconds :)


> It's similar on Windows, but since I don't have my win laptop available right now I don't quite remember what it was exactly.
>
> Anyway, the program:
>
[...snip...]

Thanks. That should help. It does seem that QtD could *really* use some D-ification, though. Like arrays of delegates instead of signals/slots. And properties instead of the get*/set* functions that trigger my flashbacks of Java.