From kde-kimageshop Thu Oct 09 22:06:53 2003 From: Patrick Julien Date: Thu, 09 Oct 2003 22:06:53 +0000 To: kde-kimageshop Subject: Re: Undo and Redo X-MARC-Message: https://marc.info/?l=kde-kimageshop&m=106573739125711 On October 9, 2003 06:55 am, Boudewijn Rempt wrote: > Okay... This is curious. > > The following snippet correctly implements undo/redo. The funny thing is, > when I press the mouse button, nothing seems to happen -- the display is > not getting updated. When I undo and then redo the 'test' action, the red > square _does_ appear. > > void KisToolTest::mousePress(QMouseEvent *e) > { > Q_INT32 x = e->pos().x(); > Q_INT32 y = e->pos().y(); > KisImageSP img = m_view -> currentImg(); > if (img) { > KisPaintDeviceSP device = img -> activeDevice(); > if (device) { > KisPainter p( device ); > p.beginTransaction( "Test" ); > p.fillRect( x, y, 10, 10, KoColor(QColor( "red" )) ); > m_doc->addCommand(p.endTransaction()); > device->anchor(); > } > } OK, didn't have anything to invalidate a region in a device? If not, you should probably add this to KisPainter directly, i.e. KisPainter calls it instead of client code. > m_view -> updateCanvas(x, y, 10, 10); > } > > Oh, and this appears on the console: > > kdecore (KAction): WARNING: KAction::updateShortcut(): name = "edit_undo", > cut = Ctrl+Z; No KAccel, probably missing a parent collection > > When using the 'tool'. _______________________________________________ kimageshop mailing list kimageshop@mail.kde.org http://mail.kde.org/mailman/listinfo/kimageshop