WtDesigner
WtDesigner copied to clipboard
Getters for UI-elements in generated UI-class
Instead of exposing the actual pointers to the widgets, the generated UI-class should expose them through getters. This way we can prevent some self-injuries.
class Ui_foo
{
public:
Wt::WContainerWidget *
wt_root()
{
return m_wt_root;
}
...
Wt::WText *
text()
{
return m_text;
}
void setupUi(Wt::WContainerWidget *PageRoot)
{
...
}
...
private:
Wt::WContainerWidget *m_wt_root;
Wt::WSlider *m_slider_volume;
Wt::WPushButton *m_button;
Wt::WText *m_text;
...
};
Regards Uli
Hi,
This is the tool I used to inspire myself for WtDesigner. I did not invent my own way, I just adapted an existing idea to solve a new problem. Take look at it.
https://www.qt.io/ide/
This style follows the Qt style which might be good or might be bad but is the one that I know. QtDesigner does exactly the same and I was inspired by WtDesigner. Also other Qt developers are used to this style. Might not be the best option but I don't like re-inventing the wheel, so I think I will keep it this way.
Best.
Hi Juan,
no problem! I think your application has great potential so I try to contribute at least through feedback.
I generally try to rule out the greatest possible amount of bugs in my code by use of information hiding and other techniques which are considered good practice, aka "make interfaces easy to use correctly and hard to use incorrectly" (Scott Meyers). By exposing the data members any code can modify the pointers (even by accident) and cause obscure bugs.
Regards Uli