1. Qt4, Windows, and Euphoria
- Posted by Travis Beaty <listaddy at technomajian.net> Jul 05, 2005
- 571 views
Hello all. As you may be aware, version 4 of Trolltech's Qt toolkit has recently been released. One of the big differences is the fact that unlike the previous versions, an Windows version has been released with a license which allows its use for free, as long as the resulting application is released under the GNU General Public License. Previously, there did not seem to be a lot of support for a Qt-based Euphoria widget library, perhaps due to the fact that, in previous versions, it would have been difficult to make a Windows version (difficult to the tune of $1,800). That is no longer the case. Such a toolkit should now be usuable under both Windows and Linux (assuming compatibility within the user's Euphoria code), as the only difference would be how the shared library is built ... .dll in Windows or .so in Linux, with some transparent internal differences. In addition to widgetry, Qt also provides other features which could be built into the library in time, such as networking, openGL, and possibly (I haven't explored this to see if it would be viable in Euphoria yet) even threading capabilities. I have downloaded the Windows version of Qt4, and I'm currently testing it. It is doing quite well, and in my opinion is better than GTK or wxWidgets in a Windows environment. Again, that is my opinion only, yours may differ considerably. My question is this: based upon this latest release, and the possibility of being truly cross-platform, would there be interest in such a library? If such an interest exists, then I'll start working on it, and get some sort of time line set up. I will get the basics fleshed out, and then ask for volunteers in terms of alpha testing, debugging, etc. Otherwise, I don't see the sense in investing the time in a library that will be unused. Please think about it and let me know. Regards, Travis.
2. Re: Qt4, Windows, and Euphoria
- Posted by Patrick Barnes <mrtrick at gmail.com> Jul 05, 2005
- 563 views
That would indeed be interesting. Sign me up scotty! On 7/5/05, Travis Beaty <listaddy at technomajian.net> wrote: > > > Hello all. > > As you may be aware, version 4 of Trolltech's Qt toolkit has recently > been released. One of the big differences is the fact that unlike the > previous versions, an Windows version has been released with a license > which allows its use for free, as long as the resulting application is > released under the GNU General Public License. > > Previously, there did not seem to be a lot of support for a Qt-based > Euphoria widget library, perhaps due to the fact that, in previous > versions, it would have been difficult to make a Windows version > (difficult to the tune of $1,800). That is no longer the case. Such a > toolkit should now be usuable under both Windows and Linux (assuming > compatibility within the user's Euphoria code), as the only difference > would be how the shared library is built ... .dll in Windows or .so in > Linux, with some transparent internal differences. In addition to > widgetry, Qt also provides other features which could be built into the > library in time, such as networking, openGL, and possibly (I haven't > explored this to see if it would be viable in Euphoria yet) even > threading capabilities. > > I have downloaded the Windows version of Qt4, and I'm currently testing > it. It is doing quite well, and in my opinion is better than GTK or > wxWidgets in a Windows environment. Again, that is my opinion only, > yours may differ considerably. > > > My question is this: based upon this latest release, and the > possibility of being truly cross-platform, would there be interest in > such a library? If such an interest exists, then I'll start working on > it, and get some sort of time line set up. I will get the basics > fleshed out, and then ask for volunteers in terms of alpha testing, > debugging, etc. Otherwise, I don't see the sense in investing the time > in a library that will be unused. > > Please think about it and let me know. > > Regards, > Travis. > > > > > > -- MrTrick ----------
3. Re: Qt4, Windows, and Euphoria
- Posted by cklester <cklester at yahoo.com> Jul 05, 2005
- 576 views
Travis Beaty wrote: > > It is doing quite well, and in my opinion is better than GTK or > wxWidgets in a Windows environment. Can you provide some detail as to why you think it is better than wxWidgets? -=ck "Programming in a state of EUPHORIA." http://www.cklester.com/euphoria/
4. Re: Qt4, Windows, and Euphoria
- Posted by Travis Beaty <listaddy at technomajian.net> Jul 05, 2005
- 564 views
cklester wrote: > Can you provide some detail as to why you think it is better than > wxWidgets? > Hi. In no specific order ... 1. A rich set of controls. There are a large number of controls which are cross-platform, although admittedly I haven't fully checked them out in order to see how well they work under Windows. About the only thing that isn't present which would be on my wishlist would be a cross-platform notification tray widget. Qt doesn't really seem to suffer from the "lowest common denominator" effect that one sees with cross-platform toolkits. 2. Nice Interface codewise. In terms of coding in C++ (Qt's native language), the code is very clean, without the infernal need for casting (as with GTK). The tools which are used with Qt, such as moc and uic, just make it that much nicer. Such methods as QObject::inherits() makes it easier to marry C++'s RTTI facilities with Euphoria's typechecking system. 3. Documentation. Of all the toolkits around, Qt has, hands down, the best documentation I've ever seen. 4. Library setup. After installing the Qt library, the only thing needed was to set the QTDIR and QMAKESPEC environment variables, and I was on my way to writing apps. Some time ago, when I downloaded wxWidgets and attempted to do the same thing, I had one hell of a time getting the library set up and available to MinGW. Once I had it set up, I found myself creating 20M "Hello World" applications, that needed to be "strip"ped in order to get rid of all the spurious code. Debug settings didn't matter. 5. Qt has a "signal and slots" system of event handling which makes things quite easy in that regard. I haven't been able to tap into that directly with Euphoria, but it did make it easy to implement an Event class which could play middleman with the Euphoria code. 6. Frankly, I just think it's pertier. Keep in mind, again, that these are my opinions. I imagine that fans of wxWidgets, GTK, et. al would be quick to counter my arguments and tell me why their toolkits are better. Is Qt better? Well, yes, it is, *to me.* Your mileage may vary. I do know that when I experimented with creating a Euphoria/Qt library on Linux, Euphoria and Qt played together well, the only caveat being on the shared library side, where I had to declare exported functions with extern "C" to prevent name mangling. I have high hopes that Qt and exw will be friends as well. For those of you that want to explore Qt further, please see http://www.trolltech.com. Regards, Travis.
5. Re: Qt4, Windows, and Euphoria
- Posted by Vincent <darkvincentdude at yahoo.com> Jul 05, 2005
- 553 views
> Travis Beaty wrote: > 2. Nice Interface codewise. In terms of coding in C++ (Qt's native > language), the code is very clean, without the infernal need for casting > (as with GTK). The tools which are used with Qt, such as moc and uic, > just make it that much nicer. Such methods as QObject::inherits() makes > it easier to marry C++'s RTTI facilities with Euphoria's typechecking > system. How does one go about wrapping Object Oriented C++ libraries with Euphoria? It can be done, Matt has demonstrated that with wxEuphoria. But I just dont understand how. Is there some interfacing library? If there is a C++ interfacing Euphoria library. I would like to have it in my libraryRegards, Vincent ---------------------------------------------- ___ __________ ___ /__/\ /__________\ |\ _\ \::\'\ //::::::::::\\ |'|::| \::\'\ //:::_::::_:::\\ |'|::| \::\'\ //::/ |::| \::\\ |'|::| \::\'\ //::/ |::| \::\\|'|::| \::\'\__//::/ |::| \::\|'|::| \::\','/::/ |::| \::\\|::| \::\_/::/ |::| \::\|::| \::,::/ |::| \:::::| \___/ |__| \____| .``. ',,' ----------------------------------------------
6. Re: Qt4, Windows, and Euphoria
- Posted by Matt Lewis <matthewwalkerlewis at gmail.com> Jul 05, 2005
- 552 views
Vincent wrote: > > > Travis Beaty wrote: > > > 2. Nice Interface codewise. In terms of coding in C++ (Qt's native > > language), the code is very clean, without the infernal need for casting > > (as with GTK). The tools which are used with Qt, such as moc and uic, > > just make it that much nicer. Such methods as QObject::inherits() makes > > it easier to marry C++'s RTTI facilities with Euphoria's typechecking > > system. > > How does one go about wrapping Object Oriented C++ libraries with Euphoria? It > can > be done, Matt has demonstrated that with wxEuphoria. But I just dont > understand how. > Is there some interfacing library? > > If there is a C++ interfacing Euphoria library. I would like to have it in my > library >> There is a file included with wxEuphoria called cplusplus.e. It does some things to help when dealing with C++. Ultimately, it's not that different from dealing with C. The biggest difference is that you have to be able to handle the name mangling. You also have to remember to explicitly pass a pointer to the object (most compilers just add it as the first parameter list, MSVC uses a different calling convention). Also, EuCOM is effectively using C++. Matt Lewis
7. Re: Qt4, Windows, and Euphoria
- Posted by Travis Beaty <listaddy at technomajian.net> Jul 05, 2005
- 555 views
Vincent wrote: >How does one go about wrapping Object Oriented C++ libraries with Euphoria? It >can be done, Matt has demonstrated that with wxEuphoria. But I just dont >understand how. Is there some interfacing library? > >If there is a C++ interfacing Euphoria library. I would like to have it in my >library> Hello. I am unsure at what specific libraries are available in Euphoria for this task. The key problem to interfacing with C++ code is "name mangling." This mangling is done by C++ compilers in order to enable overloaded functions, functions which have the same name but are differentiated only by their footprint, or the types of parameters they take. Because of name mangling, a C++ method, say Foo(), could end up being seen by Euphoria as Z9943_object_Foo6. The process of name mangling is not random, but it is complicated. This can be defeated by externing functions. An example: Given the method void Foo::Bar(int) You first need to wrap this as a C function, externing it as a C function in your header file: extern "C" void Bar(Foo*, int); The implementation would be void Bar(Foo *f, int i) { f->Bar(i); } Bar() would now come through clearly in the shared library, so you could link it to Euphoria like this: define_c_proc(thelib, "Bar", {C_POINTER, C_INT}) Regards, Travis.
8. Re: Qt4, Windows, and Euphoria
- Posted by Matt Lewis <matthewwalkerlewis at gmail.com> Jul 05, 2005
- 561 views
Travis Beaty wrote: > > > Vincent wrote: > > >How does one go about wrapping Object Oriented C++ libraries with Euphoria? > >It can be done, Matt > has demonstrated that with wxEuphoria. But I just dont understand how. Is > there some interfacing library?</font></i> > > > >If there is a C++ interfacing Euphoria library. I would like to have it in my > >library> > > > Hello. > > I am unsure at what specific libraries are available in Euphoria for > this task. > > The key problem to interfacing with C++ code is "name mangling." This > mangling is done by C++ compilers in order to enable overloaded > functions, functions which have the same name but are differentiated > only by their footprint, or the types of parameters they take. Because > of name mangling, a C++ method, say Foo(), could end up being seen by > Euphoria as Z9943_object_Foo6. The process of name mangling is not > random, but it is complicated. > > This can be defeated by externing functions. An example: The way I dealt with it was to output the list of exports mangled and demangled. On Windows I used Dependency Walker, and on Linux I used nm. Then I could translate between mangled and demangled easily. How does using extern handle overloaded methods? Matt Lewis
9. Re: Qt4, Windows, and Euphoria
- Posted by Travis Beaty <listaddy at technomajian.net> Jul 05, 2005
- 561 views
Matt Lewis wrote: >The way I dealt with it was to output the list of exports mangled and >demangled. On Windows I used Dependency Walker, and on Linux I used nm. >Then I could translate between mangled and demangled easily. > >How does using extern handle overloaded methods? > Not real eloquently, unfortunately. Typically, I take such cases on a case-by-case basis. 1. If there is one predominant footprint that will be used most often by the Euphoria code, I'll wrap that one specific case in the library ... it will be the overload version called by the externed function. 2. If different overloaded version are needed, then ... a. If its simple data types, say one version takes an int, and one takes a double, I'll wrap both and make the decision of which to use at runtime on the Euphoria side of the code. b. If its classes, especially those which inherit QObject and therefore Qt's RTTI system, I'll make the decision at run time by passing the value in as a QObject, then use QObject::isA() or QObject::name() to determine which method to call in the C++ code. This can be done with my own classes as well, as long as I use the Q_OBJECT macro in the class declaration. Fortunately, there aren't a lot of wildly divergent overloaded methods in Qt. More often than not, most of the common methods, such as setText() and isChecked() take a base class such as QWidget as a parameter, so I can simply pass the pointer from the Euphoria side and rely on polymorphism to help figure out the mess. Otherwise, there is typically one particular method that really fits the needs of a Euphoria library. Regards, Travis.