PDA

View Full Version : Qt against WPF



soulbug
13th May 2010, 15:31
hey guys,
i plan to write an program about timemanagement and the ui of this program is very important.
that means i need (propably) selfmade calender widgets and so on.

i'm impressed of the qt forms style system but it seems to be a great affort to write own widgets which were good looking too.
qml on the other hand looks interessing but half baked - wpf looks to be better.

what do you think about qt froms or qml and its possibilities to ui's?
maybe in comparison with wpf

thanks a lot
soulbug

high_flyer
14th May 2010, 10:09
The major difference is that Qt is cross platform, and wpf is not.
So if your application only needs to run under windows, I guess the "better" solution would be to use the tool kit you are best familiar with.
I didn't work with wpf, so I can say.
But Qt surely has all the power you need.
If you are new to both tool kits, I would suggest Qt, since I think Qt is much simpler to learn, and you win your app being cross platform for free.
From what I read wpf is more like QML than the regular Qt.

But your question is very broad, its hard to say in such a general case.

npclaudiu
14th May 2010, 10:49
When working with WPF, you can build your GUI in a XAML file, which is Micro$oft's response to SVG, and build your application logic in code, or build both the GUI and app logic in code. With Qt you work in a similar way, using both QML and code, or code only.

If you are only targeting the Windows platform, both solutions are feasible. The problem comes if you plan to deploy your application on platforms other than Windows. While Qt is readily available on multiple platforms, WPF is supported only on Windows (there is a subset of XAML implemented in Silverlight/Moonlight, which is more like Flash and is available on several platforms).

However, if you are starting the development of your application from scratch, I would suggest Qt too.

soulbug
14th May 2010, 18:45
thanks for your responces.

can you tell me how difficult it is to create new complex widgets which may also contain other widgets in qt forms?
for example a calender (table) which contains buttons or labels at every singel day

wysota
14th May 2010, 18:58
It all depends what you mean by "complex". In Qt "complex" widgets usually mean "composed" widgets - widgets that contain layouts and other widgets inside. They don't necessarily have to be "complex" in term of number of objects inside.

soulbug
15th May 2010, 07:47
widgets which may also contain other widgets
yes i meant composed widgets.

i'm quiete sure qt
has all the power you need - but i have to know how much time and effort is needed

tbscope
15th May 2010, 08:30
Can you draw a sketch, or explain in detail what kind of widget you want to achieve.
A table with buttons isn't very difficult to create.

If you can't achieve what you want with just composing some widgets, then you need to subclass a widget.
The abstract model/view classes are ideal to display all kinds of data, but it will take you some effort to do all the painting and data handling.
Or you could use the QGraphicsView/Scene/Items.

But if you could explain in more detail what kind of data you want to show, and how you want to show it, it might be easier to give a more correct answer I think.

wysota
15th May 2010, 09:03
It's very easy to build composed widgets in Qt thanks to Designer and the concept of layouts.

soulbug
15th May 2010, 09:09
lets have as example the windows live (or outlook 2007) calender

4638

wysota
15th May 2010, 09:27
So? What about it? It's definitely not a single control but two completely separate controls one besides the other and the one on the right is not composed of subcontrols but rather from items, just like in Qt we'd do with GraphicsView. And it's not WPF (although I don't know much about WPF so I could be wrong but I think WPF was not available in 2006-2007 yet). I don't know if it answers your question, whatever it was :)

tbscope
15th May 2010, 09:59
Indeed.

You can do this with QGraphicsView which I think would be the easiest path for you.
Or, you can write a custom itemmodel and itemview, which I think is the most correct way to handle this widget, but also takes a little bit more work.

Zlatomir
15th May 2010, 10:16
This are two very different frameworks, not only for "presentation" of your data in simple to design/implement way. So we (by "we", i talk about members of this forum) like Qt and will recommend Qt, if you ask on some .NET forum they will recommend .NET (WPF).

Things to consider: Qt is native (C++ code), WPF/.Net runs in CLI (virtual machine), Qt code runs on Linux and Mac with most likely no modification to code (+ the things mentioned in posts before). There must be some advantages to .NET but i didn't work enough with that to know them (i worked only with C++, not with the CLI implementation, learning to write portable code is my reason for that)

Instead of Conclusion: Nobody can tell you witch of two different things is better for you ( better can be simple to learn, easy to use, fast enough for your task, etc...) and "better" for you might depend on what language you already know, if you know C++, Qt framework will be very easy to learn (for me it seams easier to learn then C++ standard library)

So, my advice: "play" with each and choose what you like/ learn easy/ does the job you are trying to do.

soulbug
15th May 2010, 10:16
thanks.

how much time would you approximately need to develop a widget as the shown windows live clander?

tbscope
15th May 2010, 10:28
thanks.

how much time would you approximately need to develop a widget as the shown windows live clander?

I do not think anyone can answer that correctly.
I think I would need 2 or 3 days. But I don't know you nor your skills

I would create a custom itemmodel CalenderModel, which handles CalenderItems.
Then I would create an itemview CalenderView, which displays the items in CalenderModel. Display those calender items in the model that belong to the selected month or day.
Then you can use delegates to draw items differently.

Of course, the more functionalities you need, the more work you need to invest. If you want to have weekviews, dayviews, monthviews, you need to create those.

It's about the same with using GraphicsView.
You need to create a container for calender items. Then use that container to draw GraphicsItems. The advantage here is that most of the painting is already done for you as there are several standard graphicsitems for text, rectangles etc...

But that's just my guess.

Zlatomir
15th May 2010, 10:30
thanks.

how much time would you approximately need to develop a widget as the shown windows live clander?

That's an even harder question, we can't know what you already know and how fast are you learning.

Take a book on Qt, do the examples, see how "things" are made and then try to do your own, because if you learn just by try/error/re-try/error and so on, you wont become more efficient with Qt (or any other programming framework or language) to really learn and get some knowledge from what you learned, you need to understand how to make things well, and why that aproatch is better than others.

soulbug
15th May 2010, 10:54
thanks guys,
espicially to tbscope

i will have a look on this GraphicsView class - the possiblities seem to be easiely available

wysota
15th May 2010, 11:20
If you are looking at a direct equivalent of WPF, you should pay close attention to QML although if all you are after is implementing a calendar then I doubt QML will have anything extra to offer besides what Graphics View offers.

soulbug
15th May 2010, 12:01
If you are looking at a direct equivalent of WPF, you should pay close attention to QML although if all you are after is implementing a calendar then I doubt QML will have anything extra to offer besides what Graphics View offers.

you had good expierences with it?

wysota
15th May 2010, 12:27
I have seen QML in action but didn't yet find time to do anything with it myself. Anyway it is a declarative rectangle and state-machine based language for defining user interfaces and simple interactions between elements that allow you to do some fancy stuff. But I think a calendar doesn't require any fancy stuff so superiority of QML over pure C++ in this case is very limited.

npclaudiu
17th May 2010, 19:48
You should look for a few samples/tutorials before starting to develop your application. You should also get some books about Qt (you can find a list of books here (http://qt.nokia.com/developer/books), and a free online book here (http://cartan.cas.suffolk.edu/oopdocbook/opensource/)).