Well, I finally feel like this thing does what it advertises.
I will at the very least, be using it.
Hit up the download page:
http://code.google.com/p/cross-platform-qt-template/
Showing posts with label Qt. Show all posts
Showing posts with label Qt. Show all posts
28 April 2011
11 April 2011
Lunarcloud's Cross-Platform Qt App Template
When I write Qt Apps, or Java apps for that matter, there's a bunch of things I have to do to get it to a starting point that I'm happy about.
Although these are crossplatform languages/tools, it's very easy to write yourself into a specific platform, or easier, to look half-assed on platforms you care less about/ don't use much.
This is why I decided to create a Qt Creator template.
This template should provide something important for each of the big 3 OS's.
Windows
We enable blur behind, extending the glass to the toolbars, and other Windows sexiness found here: http://labs.qt.nokia.com/2009/09/15/using-blur-behind-on-windows/
Also, the taskbar icon and progress bar support from ECWin7 is included for use: http://www.msec.it/blog/?p=100
The only Windows 7 goody that couldn't be integrated was Jumplists. The only Qt implementation is found is a really nice commercial package. http://www.strixcode.com/q7goodies/ NOT INCLUDED - COMMERCIAL.
There's also an rc file and ico.
Mac OSX
For Mac, I included an empty menu to add actions to, which will show up as the dock's menu.
I also turned on unified title and toolbar, creating the very mac effect of your toolbars being on the outside of the app, like in Finder or iTunes.
There's an included icns icon file.
Kubuntu / Ubuntu / Debian
For the debian family of Linux OS's, I included the files necessary to create a .deb using cdbs tools.
simply cd to your project directory and run
There's also a .desktop file,so when you install the deb you've made it'll show up in the gnome/kde menu, and a png icon.
Download
http://code.google.com/p/cross-platform-qt-template/downloads/list
Although these are crossplatform languages/tools, it's very easy to write yourself into a specific platform, or easier, to look half-assed on platforms you care less about/ don't use much.
This is why I decided to create a Qt Creator template.
This template should provide something important for each of the big 3 OS's.
Windows
We enable blur behind, extending the glass to the toolbars, and other Windows sexiness found here: http://labs.qt.nokia.com/2009/09/15/using-blur-behind-on-windows/
Also, the taskbar icon and progress bar support from ECWin7 is included for use: http://www.msec.it/blog/?p=100
The only Windows 7 goody that couldn't be integrated was Jumplists. The only Qt implementation is found is a really nice commercial package. http://www.strixcode.com/q7goodies/ NOT INCLUDED - COMMERCIAL.
There's also an rc file and ico.
Mac OSX
For Mac, I included an empty menu to add actions to, which will show up as the dock's menu.
I also turned on unified title and toolbar, creating the very mac effect of your toolbars being on the outside of the app, like in Finder or iTunes.
There's an included icns icon file.
Kubuntu / Ubuntu / Debian
For the debian family of Linux OS's, I included the files necessary to create a .deb using cdbs tools.
simply cd to your project directory and run
debuild --no-tgz-checkThis will create unnecessary files, some of which can be cleared out by running
make clean
There's also a .desktop file,so when you install the deb you've made it'll show up in the gnome/kde menu, and a png icon.
Download
http://code.google.com/p/cross-platform-qt-template/downloads/list
08 October 2010
Web Services with Qt
To create a Qt client application that connects to a SOAP/WSDL web service, you should use the C++ library/tools from gSOAP. There have been Qt specific SOAP libraries, but they either dissapeared, or are feature incomplete. This is a simple how-to, explaining project setup for Qt development, assuming Qt Creator.
Create gSOAP code
To import all WSDLs to one header, ensure the server is running (irrelevant of source, web or file)
wsdl2h -o name.h http://service1?WSDL C:\service1downloaded.wsdl
To change the namespace prefix (used in soap variables), use the -n 'prefix' option. Then, to produce client-side working code and bindings:
soapcpp2 -C -i -I"C:\path\to\gsoap\imports" -x name.h
• -C : client-side code only
• -i : generate proxies
• -I : import path, necessary
• -x : without the example SOAP messages
Setting up your Qt Project
Add all generated code into your Qt project.
Open your .pro file and add:
INCLUDEPATH += path\to\gsoap
#ifdef Q_WS_WIN
LIBS += C:\Qt\VERSION\mingw\lib\libws2_32.a
#endif
Usage
Include the proxy class. Create a proxy object:
ServiceProxy proxy = new ServiceProxy();
Make request and response objects:
ns1__Function *request = new _ns1__Function();
ns1__FunctionResponse *response = new _ns1__FunctionResponse();
And then set the arguments:
request ->arg0 = &variable;
request ->arg1 = &variable;
Perform the communication, receiving a soap code, we then handle and perform tasks based on the response
int soap_code = proxy ->Function(request ,response)
if (soap_code == SOAP_OK)
{
variable = response->OutVariable;
variable = response->return
}
else
{
displayError();
}
Special Quirks
I've found that the proxy class does not like to be included in headers, so instead we forward declare them if necessary and include it in the .cpp as per common practice when programming in Qt.
The *.nsmap and stdsoap.cpp must be included only once in the entire project.
Create gSOAP code
To import all WSDLs to one header, ensure the server is running (irrelevant of source, web or file)
wsdl2h -o name.h http://service1?WSDL C:\service1downloaded.wsdl
To change the namespace prefix (used in soap variables), use the -n 'prefix' option. Then, to produce client-side working code and bindings:
soapcpp2 -C -i -I"C:\path\to\gsoap\imports" -x name.h
• -C : client-side code only
• -i : generate proxies
• -I : import path, necessary
• -x : without the example SOAP messages
Setting up your Qt Project
Add all generated code into your Qt project.
Open your .pro file and add:
INCLUDEPATH += path\to\gsoap
#ifdef Q_WS_WIN
LIBS += C:\Qt\VERSION\mingw\lib\libws2_32.a
#endif
Usage
Include the proxy class. Create a proxy object:
ServiceProxy proxy = new ServiceProxy();
Make request and response objects:
ns1__Function *request = new _ns1__Function();
ns1__FunctionResponse *response = new _ns1__FunctionResponse();
And then set the arguments:
request ->arg0 = &variable;
request ->arg1 = &variable;
Perform the communication, receiving a soap code, we then handle and perform tasks based on the response
int soap_code = proxy ->Function(request ,response)
if (soap_code == SOAP_OK)
{
variable = response->OutVariable;
variable = response->return
}
else
{
displayError();
}
Special Quirks
I've found that the proxy class does not like to be included in headers, so instead we forward declare them if necessary and include it in the .cpp as per common practice when programming in Qt.
The *.nsmap and stdsoap.cpp must be included only once in the entire project.
Subscribe to:
Posts (Atom)
