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

List:       kde-kimageshop
Subject:    Undo and Redo
From:       Boudewijn Rempt <boud () valdyas ! org>
Date:       2003-10-09 10:55:55
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


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();
         }
    }
    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'.

-- 
Boudewijn Rempt | http://www.valdyas.org/index2.html

[Attachment #5 (application/pgp-signature)]

_______________________________________________
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