SoftbloksC++ 应用框架
Softbloks 是一款免费的跨平台的应用框架,为开发者提供一个有效的开发模式,自下而上或者自上而下,提高开发效率。
示例代码:
class MainObject : public sb::AbstractSoft
{
public:
MainObject()
{
// 1) register the property Qt.mainview in read-only mode
// - the method get_widget is passed as reading accessor (std::bind is
// used to convert the method into a std::function bound to this)
// - empty value (nullptr) is passed as writing accessor
this->register_property<QWidget*>(
"Qt.mainview",
sb::READ_ONLY,
std::bind(&MySoft::get_widget, this),
nullptr
);
}
QWidget* get_widget()
{
return new QLabel("Hello World!!!");
}
};
SB_DECLARE_CLASS(
MainObject,
"MainObject",
sb::AbstractSoft
)
// 2) declare the properties of the class
SB_DECLARE_PROPERTIES(
MainObject,
{"Qt.mainview", {typeid(QWidget*), sb::READ_ONLY}}
)
SB_DECLARE_MODULE(/*a description should go here*/)
{
sb::register_object<MainObject>();
}评论
