Try the Nana C++ Library for your hobby project. It's free and open-source.
This is a pure C++ library written in standard C++, it makes you create a GUI program faster through HAND-CODING
Try the Nana C++ Library for your hobby project. It's free and open-source.
This is a pure C++ library written in standard C++, it makes you create a GUI program faster through HAND-CODING
Nana C++ Library is a GUI framework that designed to be C++ style, cross-platform and easy-to-use.
What does it do better than Qt?
Ah! Like a not-ugly version of FLTK. That would be great actually. Qt has a fairly steep learning curve.
I have not used Qt - -!
Qt is very powerful, Nana is lightweight.
Qt has its own syntax, Nana uses standard C++.
In fact, the main aim of Nana is providing comman concepts for programming, it should not break your thought and architecture of your design, thread-safe and thread-free features can make happy programming.
This is a pure C++ library, so lambda works if compiler is allowed.
Output "hello,world" if you click on the form.Code:#include <nana/gui/wvl.hpp> #include <iostream> int main() { using namespace nana::gui; form fm; fm.make_event<events::click>( []{ std::cout<<"Hello, World"<<std::endl; } ); fm.show(); exec(); }
Last edited by jinhao; 12-08-2011 at 11:56 PM.
Nana C++ Library is a GUI framework that designed to be C++ style, cross-platform and easy-to-use.
The reason Qt went with their own syntax (signals and slots) was because they thought, the way everyone else was doing it, with event callbacks (I haven't looked into your library, so I don't know if you are using that), was too un-intuitive. The whole point of the signals and slots system was to make it more intuitive, and more OO.
I read that their explanation is "using callbacks overrides the type system for the arguments."
But I never understood that point...if you use functors instead of function pointers as expected in C++ code,..that does not remain a problem.
The second argument also does not sound very convincing to me....after all, you can just pass objects(or references to them) around for that.Originally Posted by Qt docs
Last edited by manasij7479; 12-08-2011 at 11:47 PM.
I don't think it's just the type system. The callback system assumes that the "interested party" is a function (or functor, which is conceptually a function), instead of an object, which is not OO.
I'm not really sure about this. UI design is really not my speciality.
Qt says a callback is a pointer to function, but IMO, callback is more like a pattern that is a implememtion of Dependency Injection.
nowadays, we have function objects.
Nana C++ Library is a GUI framework that designed to be C++ style, cross-platform and easy-to-use.
It is an object, but it doesn't represent a function in the world. It represents an action, a function. It's not REALLY conceptually an object.
Functor is not a function, but it can be invoked by function-call syntax. So, we should not take care about whether it is a function, and it is a good solution to be a substitute for pointer to function in a common purpose library/framework.
Nana C++ Library is a GUI framework that designed to be C++ style, cross-platform and easy-to-use.
Or we can also think of them as a function that is defined like an object. I think from places I have seen functors used, that's a more conceptually accurate description. It's not an object that represents something in the world. For example, you wouldn't call a functor Cat. Instead, it would be something like a Comparator, which really represents an operation/function.
So while that solves the technical problem of type safety, it still isn't conceptually OOP. That's just defining callback functions in another way.
What if it has multiple functions?
Classic OOP theory says objects should represent "things" with state (properties), and actions (methods).
If something only does one thing, isn't it a function?