-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | noncore/graphics/drawpad/drawpad.cpp | 6 | ||||
-rw-r--r-- | noncore/graphics/drawpad/drawpad.h | 3 | ||||
-rw-r--r-- | noncore/graphics/drawpad/drawpadcanvas.cpp | 6 | ||||
-rw-r--r-- | noncore/graphics/drawpad/main.cpp | 1 |
5 files changed, 11 insertions, 6 deletions
@@ -1,10 +1,11 @@ 2004-??-?? The Opie Team <opie@handhelds.org> + * Fixed Drawpad initialization (Bug #1314) (mickeyl) * Added four themes courtesy Robert Griebl (http://www.softforge.de/zstyle) * Added Conversion tool for pim-data (eilers) * Modifcation of the PIM API for providing generic use of OPimRecords. (eilers) 2004-25-04 The Opie Team <opie@handhelds.org> * Released as Version 1.1.3 (devel) * Introduced first implementation of SQL-Support using SQLite (eilers) diff --git a/noncore/graphics/drawpad/drawpad.cpp b/noncore/graphics/drawpad/drawpad.cpp index d9d0ce0..c0f42d9 100644 --- a/noncore/graphics/drawpad/drawpad.cpp +++ b/noncore/graphics/drawpad/drawpad.cpp @@ -44,17 +44,16 @@ #include <qfile.h> #include <qmessagebox.h> #include <qspinbox.h> #include <qtoolbutton.h> #include <qtooltip.h> #include <qwhatsthis.h> using namespace Opie::Ui; -using namespace Opie::Ui; DrawPad::DrawPad(QWidget* parent, const char* name, WFlags /*fl*/ ) : QMainWindow(parent, name, WStyle_ContextHelp) { // init members connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), this, SLOT(slotAppMessage(const QCString&, const QByteArray&)) ); m_pDrawPadCanvas = new DrawPadCanvas(this, this); @@ -276,17 +275,20 @@ DrawPad::DrawPad(QWidget* parent, const char* name, WFlags /*fl*/ ) connect(brushColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, SLOT(changeBrushColor(const QColor&))); QToolTip::add(m_pBrushColorToolButton, tr("Fill Color")); m_pBrushColorToolButton->setPopup(brushColorPopupMenu); m_pBrushColorToolButton->setPopupDelay(0); changeBrushColor(Qt::white); - finishStartup(); + // delay the rest of the initialization and do it from within the mainloop + // if we don't do this, the widget layout may not be constructed upon + // and we will end up with a wrong QScrollview page size (Mickeyl) + QTimer::singleShot( 100, this, SLOT( finishStartup() ) ); } void DrawPad::finishStartup() { // init pages QFile file(Global::applicationFileName("drawpad", "drawpad.xml")); diff --git a/noncore/graphics/drawpad/drawpad.h b/noncore/graphics/drawpad/drawpad.h index ba9e47d..63d3057 100644 --- a/noncore/graphics/drawpad/drawpad.h +++ b/noncore/graphics/drawpad/drawpad.h @@ -36,19 +36,20 @@ public: static QString appName() { return QString::fromLatin1("drawpad"); } Tool* tool() { return m_pTool; } QPen pen() { return m_pen; } QBrush brush() { return m_brush; } bool antiAliasing(); - void finishStartup(); private slots: + void finishStartup(); + void newPage(); void clearPage(); void deletePage(); void slotAppMessage( const QCString&, const QByteArray& ); void setPointTool(); void setLineTool(); diff --git a/noncore/graphics/drawpad/drawpadcanvas.cpp b/noncore/graphics/drawpad/drawpadcanvas.cpp index 423ef26..5d0c6e4 100644 --- a/noncore/graphics/drawpad/drawpadcanvas.cpp +++ b/noncore/graphics/drawpad/drawpadcanvas.cpp @@ -511,21 +511,23 @@ void DrawPadCanvas::contentsMouseReleaseEvent(QMouseEvent* e) void DrawPadCanvas::contentsMouseMoveEvent(QMouseEvent* e) { m_pDrawPad->tool()->mouseMoveEvent(e); } void DrawPadCanvas::drawContents(QPainter* p, int cx, int cy, int cw, int ch) { + Page* currentPage = m_pages.current(); + if ( !currentPage ) return; // no page yet --> initialization not finished (Mickeyl) QRect clipRect(cx, cy, cw, ch); - QRect pixmapRect(0, 0, m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); + QRect pixmapRect(0, 0, currentPage->pixmap()->width(), m_pages.current()->pixmap()->height()); QRect drawRect = pixmapRect.intersect(clipRect); - p->drawPixmap(drawRect.topLeft(), *(m_pages.current()->pixmap()), drawRect); + p->drawPixmap(drawRect.topLeft(), *(currentPage->pixmap()), drawRect); if (drawRect.right() < clipRect.right()) { p->fillRect(drawRect.right() + 1, cy, cw - drawRect.width(), ch, colorGroup().dark()); } if (drawRect.bottom() < clipRect.bottom()) { p->fillRect(cx, drawRect.bottom() + 1, cw, ch - drawRect.height(), colorGroup().dark()); } diff --git a/noncore/graphics/drawpad/main.cpp b/noncore/graphics/drawpad/main.cpp index e48bb2e..f468022 100644 --- a/noncore/graphics/drawpad/main.cpp +++ b/noncore/graphics/drawpad/main.cpp @@ -11,10 +11,9 @@ * * ***************************************************************************/ #include "drawpad.h" #include <opie2/oapplicationfactory.h> using namespace Opie::Core; -using namespace Opie::Core; OPIE_EXPORT_APP( OApplicationFactory<DrawPad> ) |