[Applet handle] Problem with new implementation

Loïc Marteau loic.marteau at gmail.com
Sun Jul 6 22:43:52 CEST 2008


Hi Aaron,

We have two problems with the new applet handle shape.

The first one, thanks to friedrich, is lookable here : 
http://dl.trem-servers.com/rotate-bug.ogv
we can't found an exact way to reproduce the problem. sometimes it 
occurs, sometimes not.

Can you please take a look on the code, i'm afraid that we have to 
revert the commit i made yesterday if we can't fixe that before rc1 ?!

we have a second problem, when user rotate a plasmoid so the handle 
becomes outside the screen.

For the moment i have this :
void AppletHandle::calculateSize()
{
    int requiredHeight =  ICON_MARGIN + //first margin
    (ICON_SIZE + ICON_MARGIN) * 4 + //XXX remember to update this if the 
number of buttons changes
    ICON_MARGIN;  //blank space before the close button
   
    if (m_applet->hasConfigurationInterface()) {
        requiredHeight += (ICON_SIZE + ICON_MARGIN);
    }
   
    qreal top = 0;
    if (requiredHeight > m_applet->size().height()) {
        top = (m_applet->size().height() - requiredHeight) / 2.0;
    }

    //put the rect on the left of the applet by default
    qreal left = - HANDLE_WIDTH;
    if (m_applet->pos().x() <= (HANDLE_WIDTH * 2)) {
        //put the rect on the right of the applet
        left = m_applet->size().width();
 
        m_buttonsOnRight = true;
    }

    m_rect = QRectF(left, top, HANDLE_WIDTH, requiredHeight);
    m_rect = m_applet->mapToParent(m_rect).boundingRect();
    m_totalRect = m_rect.united(m_applet->geometry());
}

I would like to replace this stuff :
    //put the rect on the left of the applet by default
    qreal left = - HANDLE_WIDTH;
    if (m_applet->pos().x() <= (HANDLE_WIDTH * 2)) {
        //put the rect on the right of the applet
        left = m_applet->size().width();
 
        m_buttonsOnRight = true;
    }

by something like

m_rect = QRectF(- HANDLE_WIDTH, top, HANDLE_WIDTH, requiredHeight);
if (m_rect coordonates after the applet transformation are outside the 
screen ) {
        //put the rect on the right of the applet
        m_rect = QRectF(m_applet->size().width(), top, HANDLE_WIDTH, 
requiredHeight);
 
        m_buttonsOnRight = true;
}

i don't know how to obtains the coordonates of m_rect in the real screen.

I'm on irc this next two hours and surely will go to bed after.

Thanks for your help :)

Cheers


Loic


More information about the Panel-devel mailing list