[Kde-games-devel] KZoomMainWindow and adjustSize() tale :)

Dmitry Suzdalev dimsuz at gmail.com
Tue Aug 1 17:55:58 CEST 2006


Well, I moved KZoomMainWindow to libkdegames.
But I left it unchanged, i.e. didn't implemented things that I suggested 
yesterday. And here's why.

The idea of

class ZoomableWidget : public QWidget 
{
public:
 virtual zoomChanged();
}

and then...

class SomeGameWidget : public ZoomableWidget 
{
   // reimplement zoomChanged here
}

won't work out, because in current code each "SomeGameWidget" already has 
QWidget as its base class (direct or indirect). For example BaseBoard in 
libksirtet is "public QGraphicsView".
And double-inheriting from QWidget is impossible (and even if it were possible 
i wouldn't do it ;) ).

If I made ZoomableWidget to not inherit from QWidget (to remove this  
double-inheriting), than code in KZoomMainWindow becomes a rude hack filled 
with casts here and there :).

Earlier all worked just fine - adjustSize() was in QWidget and it was 
inherited by all classes that use KZoomMainWindow.

So, any ideas, solutions? :)

Cheers,
Dmitry.


More information about the kde-games-devel mailing list