[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-kimageshop
Subject:    Re: Undo and Redo
From:       Patrick Julien <freak () codepimps ! org>
Date:       2003-10-09 22:06:53
[Download RAW message or body]

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
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic