Commit 7007c52a authored by Johannes Bergmeier's avatar Johannes Bergmeier

(incompletely) resolved the requirement of KsView subclasses to have QWidget as a base

svn path=/trunk/playground/games/ksudoku/; revision=649034
parent 630b9a19
......@@ -261,18 +261,7 @@ void KSudoku::addGame(const Game& game) {
}
// m_tabs->insertTab(view, "Test");
// m_tabs->showPage(view);
if(ksudokuView* view2 = dynamic_cast<ksudokuView*>(view))
{
setCentralWidget((ksudokuView*)view, true);
}
else if (RoxdokuView* view2 = dynamic_cast<RoxdokuView*>(view))
{
setCentralWidget((RoxdokuView*)view, true);
}
else
{
//error
}
setCentralWidget(view->widget(), true);
printf("out\n");
}
......@@ -1112,6 +1101,9 @@ ksudoku::KsView* KSudoku::currentView() const{
// return view;
// else
// return 0;
// TODO this might cause trouble as the central widget don't have to be a
// KsView instance
return dynamic_cast<KsView*>(centralWidget());
}
......
......@@ -17,7 +17,7 @@ namespace ksudoku {
ksudokuView::ksudokuView(QWidget *parent, const Game& game, bool customd)
: QWidget(parent)
, KsView(parent)
, KsView()
{
isWaitingForNumber = -1;
highlighted = -1;
......
......@@ -84,6 +84,8 @@ private slots:
void onCellChange(uint index);
void onFullChange();
QWidget* widget() { return this; }
private:
void setGame(const Game& game);
......
......@@ -9,9 +9,8 @@
namespace ksudoku{
KsView::KsView(QWidget* parent)
:/* QWidget(parent)
,*/ m_game()
KsView::KsView()
: m_game()
{
}
......
......@@ -33,7 +33,7 @@ private:
KsView& operator=(KsView const& other);
public:
KsView(QWidget* parent);
KsView();
virtual ~KsView();
///draw content to external qpainter (use for printing etc.)
......@@ -59,6 +59,8 @@ public:
///return some info on current status (can be used for status bar)
virtual QString status() const =0;
virtual QWidget* widget() = 0;
protected:
///pointer to external Game
......@@ -68,12 +70,6 @@ protected:
bool m_guidedMode;
};
class foo : public QWidget
{};
class foo2 : public foo,QGLWidget
{};
}
#endif
......
......@@ -40,7 +40,7 @@ Matrix3fT ThisRot = {{ {1.0f}, {0.0f}, {0.0f}, // NEW: This Rota
RoxdokuView::RoxdokuView(ksudoku::Game game, QWidget *parent, const char* /*name*/)
: QGLWidget(parent)
, KsView(parent)
, KsView()
{
m_game = ksudoku::Game();
......
......@@ -82,6 +82,8 @@ public:
glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
glLoadIdentity();
}
QWidget* widget() { return this; }
protected:
void paintGL();
protected:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment