Undo and Redo

Boudewijn Rempt boud at valdyas.org
Thu Oct 9 13:55:55 CEST 2003


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: signature
Url : http://mail.kde.org/pipermail/kimageshop/attachments/20031009/6df2248f/attachment.bin


More information about the kimageshop mailing list