Commit 1453bc07 authored by Thomas Zander's avatar Thomas Zander
Browse files

Alter API slightly. Make it more sane.

svn path=/trunk/koffice/; revision=546479
parent cb37c564
......@@ -26,6 +26,7 @@
#include <QPoint>
#include <QRectF>
#include <QRect>
#include <QWidget>
class KoSelection;
......@@ -98,6 +99,10 @@ public:
*/
virtual KoViewConverter *viewConverter() = 0;
/**
* Return the widget that will be added to the scrollArea.
*/
virtual QWidget* canvasWidget() = 0;
#if 0
/* The next list of methods are naming taken from Krita, which means they have allready been
......
......@@ -36,17 +36,8 @@ KoCanvasView::KoCanvasView(QWidget *parent)
void KoCanvasView::setCanvas(KoCanvasBase *canvas) {
Q_ASSERT(m_canvas == 0 /* Only allowed one time */);
Q_ASSERT(canvas); // param is not null
qDebug() << "canvas: " << canvas;
QWidget *cv = dynamic_cast<QWidget*> (canvas);
if(cv == 0) { // for now; since I don't get why kwcanvas is 0 here.
qWarning("KoCanvasView::setCanvas ERROR: canvas is not a widget?");
return;
}
Q_ASSERT(cv != 0 /* canvas is not a widget? */);
m_viewport->setCanvas(cv);
m_viewport->setCanvas(canvas->canvasWidget());
m_canvas = canvas;
m_canvasWidget = cv;
m_canvasWidget->setAutoFillBackground(true);
}
KoCanvasBase* KoCanvasView::canvas() const {
......@@ -85,6 +76,7 @@ KoCanvasView::Viewport::Viewport()
}
void KoCanvasView::Viewport::setCanvas(QWidget *canvas) {
canvas->setAutoFillBackground(true);
m_layout->addWidget(canvas, 0, 1, Qt::AlignHCenter);
}
......
......@@ -5,8 +5,7 @@
Note that we want a refCounter in the model-backend of the Shape. (picture/text)
* add a ShearingStrategy
* Add 'ensureVisible()' to KoShape
* Add 'ensureVisible(KoShape)' to KoCanvasView
Bugs:
* rescaling does not alter the positions of the connectors. I expect their
......
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