> apart that ToolButton should be used instead, don't really like a > fuction that does enabling -and- repositioning in one. positioning should > be done by a layout, really > I now have a layout, however I'm having to call update() on it everytime I change the button's size since it doesn't realise this itself, which seems a bit strange to me. On the other hand no position calculations are required, making life simpler.
> i'd also position the buttons so they overlap the border of the svg. > e.g. for the right-hand button in a horizontal panel, something like: > qreal left, top, right, bottom; > containment()->getContentsMargins(&left, &top, &right, &bottom) > setContentsMargins(0, 0, m_hideButton.width() - int(right), 0); > m_hideButton->move(0, geometry().right() - m_hideButton.width()); > > (obviously would need to be generalized for vertical panels and > top/left/right/bottom buttons) I've now implemented the buttons as part of a layout (which is part of the view), so the positioning isn't required, however what I have noticed is that for setContentsMargins(left, top...), when used on the view, only the top and bottom values have any influence, with the left and right values not doing anything. However the margins on the view don't affect the containment (i.e. only these hiding buttons are affected, the containment behaves in exactly the same way), and the problem is I need the containment to know that it isn't allowed to put anything below where the hiding buttons are, which I only seem to be able to do by setting its margins, and even then, while the applets on the panel move correctly, the cashew stays at the end of the panel, leaving a gap between it and the first applet, instead of the gap being beneath the hide button. (Without the cashew everything works fine.) One solution I'm thinking of now is adding a special method to the panel containment such as requestEmptySpace(int left, int top, ...), which in the containment creates empty spacer objects, similar to the cashew which is also permanent (i.e. separate from the applets), giving the required space without editing the contentsMargins. (A better method might be requestEndSpace(int leftTop, int rightBottom), since we only need the spaces at the ends.) This also means the cashew doesn't have to be modified to move with the contents margins since the spacer objects already shift it along by the required amount. -- Andrzej JR Hunt -- andrzej (at) ahunt.org _______________________________________________ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel