[Psi-devel] Re: Remembering Window Sizes
Michail Pishchagin
mblsha-psi at affinix.com
Tue Mar 8 15:13:06 PST 2005
Nolan Eakins wrote:
> Michail Pishchagin wrote:
> |>An inheritable class would be ideal, yes.
> | And it probably should inherit AdvancedWidget
> [psi/src/tools/advwidget], and
> | be named as PsiAdvancedWidget :-)
> |
> | -mblsha
>
> I've only discovered the AdvancedWidget today. Should I just add this
> functionality to AdvancedWidget, or would there be instances where we
> don't want this in an AdvancedWidget?
I'd prefer, that AdvancedWidget would not depend on Psi, so we could easily
use it with other projects. You need to do something like I did to
AdvancedWidget (and that was the best thing I was able to think of for that
case).
class GPsiAdvancedWidget {
public:
// it will hold some private data and real functions implementation
};
template <class BaseClass>
class PsiAdvancedWidget : public AdvancedWidget<BaseClass>
{
private:
GPsiAdvancedWidget *gPsiAdvWidget;
public:
// ... initialize gPsiAdvWidget in overridden constructor
void funcName(int p1, int p2) {
gPsiAdvWidget->funcName(p1, p2);
}
// ...
};
This way, we can add our functions to any QWidget-subclass. And this is good,
because Psi's top level dialogs are mostly subclassed from QWidget, but there
is also QMainWindow, and possibly others. Template should be compatible with
all. And with using GPsiAdvancedWidget class, our template would eat less
memory. The only bad thing is that MOC can't handle templates :-(
-mblsha
More information about the Psi-devel-affinix.com
mailing list