23 #include <QApplication>
24 #include <QtGui/QGraphicsSceneMouseEvent>
25 #include <QtGui/QLinearGradient>
26 #include <QtGui/QPainter>
27 #include <QtGui/QApplication>
28 #include <QtGui/QMenu>
29 #include <QTouchEvent>
32 #include <QPropertyAnimation>
34 #include <kcolorscheme.h>
35 #include <kglobalsettings.h>
37 #include <kiconloader.h>
38 #include <kwindowsystem.h>
43 #include <Plasma/Corona>
44 #include <Plasma/PaintUtils>
45 #include <Plasma/Theme>
46 #include <Plasma/View>
47 #include <Plasma/FrameSvg>
52 using namespace Plasma;
60 m_pressedButton(NoButton),
61 m_iconSize(KIconLoader::SizeSmall),
64 m_backgroundBuffer(0),
65 m_buttonsOnRight(false),
73 m_pressedButton(NoButton),
74 m_iconSize(KIconLoader::SizeSmall),
77 m_backgroundBuffer(0),
78 m_buttonsOnRight(false),
87 delete m_backgroundBuffer;
90 void FreeHandle::init()
92 setFlags(flags() | QGraphicsItem::ItemStacksBehindParent);
93 KColorScheme colorScheme(QPalette::Active, KColorScheme::View,
94 Theme::defaultTheme()->colorScheme());
95 setAcceptTouchEvents(
true);
96 m_gradientColor = colorScheme.background(KColorScheme::NormalBackground).color();
97 m_originalGeom = mapToScene(QRectF(QPoint(0,0),
widget()->size())).boundingRect();
98 m_originalTransform =
widget()->transform();
100 QPointF center = QRectF(QPointF(),
widget()->size()).center();
101 m_angle =
_k_pointAngle(m_originalTransform.map(center + QPointF(1.0, 0.0)) - center);
103 m_hoverTimer =
new QTimer(
this);
104 m_hoverTimer->setSingleShot(
true);
105 m_hoverTimer->setInterval(333);
107 m_leaveTimer =
new QTimer(
this);
108 m_leaveTimer->setSingleShot(
true);
109 m_leaveTimer->setInterval(500);
111 connect(m_hoverTimer, SIGNAL(timeout()),
this, SLOT(hoverTimeout()));
112 connect(m_leaveTimer, SIGNAL(timeout()),
this, SLOT(leaveTimeout()));
113 connect(
widget(), SIGNAL(destroyed(QObject*)),
this, SLOT(widgetDestroyed()));
115 setAcceptsHoverEvents(
true);
116 m_hoverTimer->start();
119 m_configureIcons =
new Svg(
this);
120 m_configureIcons->setImagePath(
"widgets/configuration-icons");
121 m_configureIcons->setContainsMultipleImages(
true);
123 m_background =
new FrameSvg(
this);
124 m_background->setImagePath(
"widgets/background");
125 widget()->installSceneEventFilter(
this);
160 QPainterPath path = PaintUtils::roundedRectangle(m_decorationRect, 10);
163 return QGraphicsItem::shape();
172 path.moveTo(rect.left(), rect.top());
173 path.lineTo(rect.right() - radius, rect.top());
174 path.quadTo(rect.right(), rect.top(),
175 rect.right(), rect.top() + radius);
176 path.lineTo(rect.right(), rect.bottom() - radius);
177 path.quadTo(rect.right(), rect.bottom(),
178 rect.right() - radius, rect.bottom());
179 path.lineTo(rect.left(), rect.bottom());
182 path.moveTo(QPointF(rect.left(), rect.top() + radius));
183 path.quadTo(rect.left(), rect.top(),
184 rect.left() + radius, rect.top());
185 path.lineTo(rect.right(), rect.top());
186 path.lineTo(rect.right(), rect.bottom());
187 path.lineTo(rect.left() + radius, rect.bottom());
188 path.quadTo(rect.left(), rect.bottom(),
189 rect.left(), rect.bottom() - radius);
202 if (qFuzzyCompare(m_opacity + 1.0, 1.0)) {
205 QTimer::singleShot(0,
this, SLOT(emitDisappear()));
212 if (m_buttonsOnRight) {
215 translation = -(1 - m_opacity) * m_rect.width();
217 translation = (1 - m_opacity) * m_rect.width();
220 painter->translate(translation, 0);
222 painter->setPen(Qt::NoPen);
223 painter->setRenderHints(QPainter::Antialiasing|QPainter::SmoothPixmapTransform);
225 int iconMargin = m_iconSize / 2;
227 const QSize pixmapSize(
int(m_decorationRect.width()),
228 int(m_decorationRect.height()) + m_iconSize * 5 + 1);
229 const QSize iconSize(KIconLoader::SizeSmall, KIconLoader::SizeSmall);
231 bool isRunning =
false;
233 isRunning = m_anim.data()->state() == QAbstractAnimation::Running ? \
238 if (isRunning || !m_backgroundBuffer || m_backgroundBuffer->size() != pixmapSize) {
239 QColor transparencyColor = Qt::black;
240 transparencyColor.setAlphaF(qMin(m_opacity, qreal(0.99)));
242 QLinearGradient g(QPoint(0, 0), QPoint(m_decorationRect.width(), 0));
244 if (m_rect.height() > qreal(minimumHeight()) * 1.25) {
245 if (m_buttonsOnRight) {
247 (m_background->marginSize(LeftMargin) - translation) / m_decorationRect.width();
250 g.setColorAt(0.0, Qt::transparent);
251 g.setColorAt(qMax(qreal(0.0), opaquePoint - qreal(0.05)), Qt::transparent);
252 g.setColorAt(opaquePoint, transparencyColor);
253 g.setColorAt(1.0, transparencyColor);
256 1 - ((m_background->marginSize(RightMargin) + translation) / m_decorationRect.width());
257 g.setColorAt(1.0, Qt::transparent);
258 g.setColorAt(opaquePoint + 0.05, Qt::transparent);
259 g.setColorAt(qMax(qreal(0), opaquePoint), transparencyColor);
260 g.setColorAt(0.0, transparencyColor);
264 g.setColorAt(0.0, transparencyColor);
267 m_background->resizeFrame(m_decorationRect.size());
269 if (!m_backgroundBuffer || m_backgroundBuffer->size() != pixmapSize) {
270 delete m_backgroundBuffer;
271 m_backgroundBuffer =
new QPixmap(pixmapSize);
273 m_backgroundBuffer->fill(Qt::transparent);
274 QPainter buffPainter(m_backgroundBuffer);
276 m_background->paintFrame(&buffPainter);
281 QRectF iconRect(QPointF(0, m_decorationRect.height() + 1), iconSize);
282 if (m_buttonsOnRight) {
284 pixmapSize.width() - m_iconSize - m_background->marginSize(LeftMargin));
286 iconRect.moveLeft(m_background->marginSize(RightMargin));
290 if (m_buttonsOnRight) {
291 m_configureIcons->paint(&buffPainter, iconRect,
"size-diagonal-tr2bl");
293 m_configureIcons->paint(&buffPainter, iconRect,
"size-diagonal-tl2br");
295 iconRect.translate(0, m_iconSize);
297 m_configureIcons->paint(&buffPainter, iconRect,
"rotate");
298 iconRect.translate(0, m_iconSize);
301 if ((
applet() &&
applet()->hasConfigurationInterface()) || (
group() &&
group()->hasConfigurationInterface())) {
302 m_configureIcons->paint(&buffPainter, iconRect,
"configure");
303 iconRect.translate(0, m_iconSize);
306 if (
applet() &&
applet()->hasValidAssociatedApplication()) {
307 m_configureIcons->paint(&buffPainter, iconRect,
"maximize");
308 iconRect.translate(0, m_iconSize);
311 m_configureIcons->paint(&buffPainter, iconRect,
"close");
313 buffPainter.setCompositionMode(QPainter::CompositionMode_DestinationIn);
315 buffPainter.fillRect(m_backgroundBuffer->rect(), g);
321 painter->drawPixmap(m_decorationRect.toRect(), *m_backgroundBuffer,
322 QRect(QPoint(0, 0), m_decorationRect.size().toSize()));
325 QPointF basePoint = m_rect.topLeft() + QPointF(HANDLE_MARGIN, iconMargin);
326 QPointF step = QPointF(0, m_iconSize + iconMargin);
327 QPointF separator = step + QPointF(0, iconMargin);
336 switch(m_pressedButton)
339 shiftC = QPointF(2, 2);
342 shiftD = QPointF(2, 2);
345 shiftR = QPointF(2, 2);
348 shiftM = QPointF(2, 2);
351 shiftMx = QPointF(2, 2);
357 QRectF sourceIconRect(QPointF(0, m_decorationRect.height() + 1), iconSize);
358 if (m_buttonsOnRight) {
359 sourceIconRect.moveLeft(
360 pixmapSize.width() - m_iconSize - m_background->marginSize(LeftMargin));
362 sourceIconRect.moveLeft(m_background->marginSize(RightMargin));
370 QRectF(basePoint + shiftM, iconSize), *m_backgroundBuffer, sourceIconRect);
373 sourceIconRect.translate(0, m_iconSize);
376 painter->drawPixmap(QRectF(basePoint + shiftR, iconSize), *m_backgroundBuffer, sourceIconRect);
377 sourceIconRect.translate(0, m_iconSize);
381 if ((
applet() &&
applet()->hasConfigurationInterface()) || (
group() &&
group()->hasConfigurationInterface())) {
383 QRectF(basePoint + shiftC, iconSize), *m_backgroundBuffer, sourceIconRect);
384 sourceIconRect.translate(0, m_iconSize);
389 if (
applet() &&
applet()->hasValidAssociatedApplication()) {
391 QRectF(basePoint + shiftMx, iconSize), *m_backgroundBuffer, sourceIconRect);
392 sourceIconRect.translate(0, m_iconSize);
397 basePoint = m_rect.bottomLeft() + QPointF(HANDLE_MARGIN, 0) - step;
398 painter->drawPixmap(QRectF(basePoint + shiftD, iconSize), *m_backgroundBuffer, sourceIconRect);
401 void FreeHandle::emitDisappear()
408 int iconMargin = m_iconSize / 2;
410 QPointF basePoint = m_rect.topLeft() + QPointF(HANDLE_MARGIN, iconMargin);
411 QPointF step = QPointF(0, m_iconSize + iconMargin);
412 QPointF separator = step + QPointF(0, iconMargin);
415 QRectF activeArea = QRectF(basePoint, QSizeF(m_iconSize, m_iconSize));
420 if (activeArea.contains(point)) {
423 activeArea.translate(step);
426 if (activeArea.contains(point)) {
429 activeArea.translate(step);
432 if ((
applet() &&
applet()->hasConfigurationInterface()) || (
group() &&
group()->hasConfigurationInterface())) {
433 if (activeArea.contains(point)) {
436 activeArea.translate(step);
439 if (
applet() &&
applet()->hasValidAssociatedApplication()) {
440 if (activeArea.contains(point)) {
445 activeArea.moveTop(m_rect.bottom() - activeArea.height() - iconMargin);
446 if (activeArea.contains(point)) {
458 QGraphicsItem::mousePressEvent(event);
467 if (event->button() == Qt::LeftButton) {
468 m_originalGeom = mapToScene(QRectF(QPoint(0,0),
widget()->size())).boundingRect();
469 QPointF center =
widget()->boundingRect().center();
470 m_originalTransform =
widget()->transform();
471 m_angle =
_k_pointAngle(m_originalTransform.map(center + QPointF(1.0, 0.0)) - center);
473 m_pressedButton = mapToButton(event->pos());
477 m_zValue =
widget()->zValue();
486 m_originalGeom = mapToScene(QRectF(QPoint(0,0),
widget()->size())).boundingRect();
487 m_origWidgetCenter = m_originalGeom.center();
488 m_origWidgetSize = QPointF(
widget()->size().width(),
widget()->size().height());
491 if (m_buttonsOnRight) {
492 m_resizeStaticPoint =
widget()->mapToScene(QPointF(0,
widget()->size().height()));
494 m_resizeStaticPoint =
widget()->mapToScene(m_origWidgetSize);
496 m_resizeGrabPoint =
event->scenePos();
499 m_rotateAngleOffset = m_angle -
_k_pointAngle(event->scenePos() - m_origWidgetCenter);
508 m_mousePos =
event->screenPos() -
currentView()->mapToGlobal(localpos);
513 QGraphicsItem::mousePressEvent(event);
522 m_pendingFade =
false;
525 ButtonType releasedAtButton = mapToButton(event->pos());
527 if (
widget() &&
event->button() == Qt::LeftButton) {
528 switch (m_pressedButton) {
531 if (
applet() && m_pressedButton == releasedAtButton) {
532 applet()->showConfigurationInterface();
533 }
else if (
group() &&
group()->hasConfigurationInterface()) {
538 if (m_pressedButton == releasedAtButton) {
555 Corona * corona = qobject_cast<Corona*>(scene());
557 foreach (Containment *
containment, corona->containments()) {
559 QGraphicsView *v = containment->view();
561 pos = v->mapToScene(v->mapFromGlobal(event->screenPos() - m_mousePos));
563 if (containment->sceneBoundingRect().contains(pos)) {
582 applet()->runAssociatedApplication();
596 return std::sqrt(point.x() * point.x() + point.y() * point.y());
601 qreal r = sqrt(point.x() * point.x() + point.y() * point.y());
602 qreal cosine = point.x() / r;
604 if (point.y() >= 0) {
607 return -acos(cosine);
613 return QTransform().rotateRadians(angle).map(point);
618 v /= sqrt(v.x() * v.x() + v.y() * v.y());
619 qreal a = v.x() * v.x();
620 qreal b = v.x() * v.y();
621 qreal d = v.y() * v.y();
622 return QMatrix(a, b, b, d, 0., 0.).map(point);
627 static const qreal snapAngle = M_PI_2 ;
630 QGraphicsItem::mouseMoveEvent(event);
635 QPointF deltaScene =
event->scenePos() -
event->lastScenePos();
639 Plasma::View *v = Plasma::View::topLevelViewAt(event->screenPos());
641 Containment *c = v->containment();
643 QPoint pos = v->mapFromGlobal(event->screenPos());
652 QPointF curPos =
event->pos();
653 QPointF lastPos =
event->lastPos();
655 QTransform transform =
widget()->transform();
657 QTransform t(transform.m11(), transform.m12(), transform.m21(), transform.m22(), 0, 0);
658 QPointF delta = t.map(curPos - lastPos);
659 widget()->moveBy(delta.x(), delta.y());
661 QPointF cursorPoint =
event->scenePos();
669 QSizeF min =
widget()->minimumSize();
670 QSizeF max =
widget()->maximumSize();
672 if (min.width() < KIconLoader::SizeSmall || min.height() < KIconLoader::SizeSmall) {
673 min =
widget()->effectiveSizeHint(Qt::MinimumSize);
677 max =
widget()->effectiveSizeHint(Qt::MaximumSize);
682 if (min.width() < KIconLoader::SizeSmall || min.height() < KIconLoader::SizeSmall) {
683 min =
widget()->boundingRect().size() -
widget()->contentsRect().size();
684 min = QSizeF(KIconLoader::SizeSmall, KIconLoader::SizeSmall);
688 newSize = m_origWidgetSize;
689 newCenter = m_origWidgetCenter;
691 QPointF centerRelativePoint = cursorPoint - m_origWidgetCenter;
696 newAngle = m_rotateAngleOffset + cursorAngle;
697 if (fabs(remainder(newAngle, snapAngle)) < 0.15) {
698 newAngle = newAngle - remainder(newAngle, snapAngle);
704 QTransform t(
widget()->sceneTransform());
706 qreal angle = (t.m12() > 0 ? acos(t.m11()) : -acos(t.m11()));
708 QPointF rStaticPoint =
_k_rotatePoint(m_resizeStaticPoint, -angle);
712 if (m_buttonsOnRight) {
713 newSize = m_origWidgetSize + QPointF(rCursorPoint.x() - rGrabPoint.x(), rGrabPoint.y() - rCursorPoint.y());
715 newSize = m_origWidgetSize + QPointF(rGrabPoint.x() - rCursorPoint.x(), rGrabPoint.y() - rCursorPoint.y());
719 if (
applet() && ((
applet()->aspectRatioMode() != Plasma::IgnoreAspectRatio &&
720 !(
event->modifiers() & Qt::ControlModifier)) ||
721 (
applet()->aspectRatioMode() == Plasma::IgnoreAspectRatio &&
722 (
event->modifiers() & Qt::ControlModifier)))) {
726 qreal ratio = m_origWidgetSize.y() / m_origWidgetSize.x();
727 newSize.rx() = qMin(max.width(), qMax(min.width(), newSize.x()));
728 newSize.ry() = newSize.x() * ratio;
729 newSize.ry() = qMin(max.height(), qMax(min.height(), newSize.y()));
730 newSize.rx() = newSize.y() / ratio;
733 newSize.rx() = qMin(max.width(), qMax(min.width(), newSize.x()));
734 newSize.ry() = qMin(max.height(), qMax(min.height(), newSize.y()));
738 if (m_buttonsOnRight) {
739 newCenter =
_k_rotatePoint(QPointF(rStaticPoint.x() + newSize.x()/2,
740 rStaticPoint.y() - newSize.y()/2), angle);
742 newCenter =
_k_rotatePoint(QPointF(rStaticPoint.x() - newSize.x()/2,
743 rStaticPoint.y() - newSize.y()/2), angle);
750 widget()->resize(newSize.x(), newSize.y());
754 widget()->setPos(
widget()->parentItem()->mapFromScene(newCenter - newSize/2));
759 at.translate(newSize.x()/2, newSize.y()/2);
760 at.rotateRadians(newAngle);
761 at.translate(-newSize.x()/2, -newSize.y()/2);
762 widget()->setTransform(at);
765 QGraphicsItem::mouseMoveEvent(event);
771 switch (event->type()) {
772 case QEvent::TouchEnd: {
773 QTransform t =
widget()->transform();
774 QRectF geom =
widget()->geometry();
775 QPointF translation(t.m31(), t.m32());
776 QPointF center = geom.center();
777 geom.setWidth(geom.width()*qAbs(t.m11()));
778 geom.setHeight(geom.height()*qAbs(t.m22()));
779 geom.moveCenter(center);
781 widget()->setGeometry(geom);
783 t.translate(
widget()->size().width()/2,
widget()->size().height()/2);
784 t.rotateRadians(m_angle);
785 t.translate(-
widget()->size().width()/2, -
widget()->size().height()/2);
788 widget()->setTransform(t);
791 case QEvent::TouchBegin:
792 case QEvent::TouchUpdate:
794 QList<QTouchEvent::TouchPoint> touchPoints =
static_cast<QTouchEvent *
>(event)->touchPoints();
795 if (touchPoints.count() == 2) {
796 const QTouchEvent::TouchPoint &touchPoint0 = touchPoints.first();
797 const QTouchEvent::TouchPoint &touchPoint1 = touchPoints.last();
800 QLineF line0(touchPoint0.lastScenePos(), touchPoint1.lastScenePos());
801 QLineF line1(touchPoint0.scenePos(), touchPoint1.scenePos());
802 m_angle = m_angle+(line1.angleTo(line0)*M_PI_2/90);
803 QTransform t =
widget()->transform();
804 t.translate(
widget()->size().width()/2,
widget()->size().height()/2);
805 t.rotate(line1.angleTo(line0));
808 qreal scaleFactor = 1;
809 if (line0.length() > 0) {
810 scaleFactor = line1.length() / line0.length();
813 t.scale(scaleFactor, scaleFactor);
814 t.translate(-
widget()->size().width()/2, -
widget()->size().height()/2);
815 widget()->setTransform(t);
823 return QGraphicsItem::sceneEvent(event);
832 if (m_leaveTimer->isActive()) {
833 m_leaveTimer->stop();
836 else if (!m_anim.data() && m_animType ==
FadeOut) {
851 QMenu *menu = qobject_cast<QMenu*>(
widget);
852 if (menu && menu->isVisible()) {
853 connect(menu, SIGNAL(aboutToHide()),
this, SLOT(leaveTimeout()));
860 if (m_hoverTimer->isActive()) {
861 m_hoverTimer->stop();
862 QTimer::singleShot(0,
this, SLOT(emitDisappear()));
863 }
else if (m_pressedButton !=
NoButton) {
864 m_pendingFade =
true;
867 m_leaveTimer->start();
873 if (watched ==
widget() && event->type() == QEvent::GraphicsSceneHoverLeave) {
880 void FreeHandle::setFadeAnimation(qreal progress)
882 m_opacity = progress;
884 if (qFuzzyCompare(progress, qreal(1.0))) {
885 delete m_backgroundBuffer;
886 m_backgroundBuffer = 0;
897 void FreeHandle::hoverTimeout()
902 void FreeHandle::leaveTimeout()
904 if (!isUnderMouse()) {
909 void FreeHandle::widgetResized()
911 prepareGeometryChange();
918 m_entryPos = hoverPos;
921 m_leaveTimer->start();
927 QPropertyAnimation *propAnim = m_anim.data();
933 propAnim =
new QPropertyAnimation(
this,
"fadeAnimation",
this);
938 m_entryPos = hoverPos;
943 setFadeAnimation(1.0);
949 prepareGeometryChange();
950 bool wasOnRight = m_buttonsOnRight;
952 m_buttonsOnRight = m_entryPos.x() > (
widget()->size().width() / 2);
957 if (region !=
widget()->mapToParent(m_rect)) {
960 m_buttonsOnRight = !m_buttonsOnRight;
963 if (region2 != mapToParent(m_rect)) {
965 QRectF f1 = region.boundingRect();
966 QRectF f2 = region2.boundingRect();
969 if ((f2.width() * f2.height()) < (f1.width() * f1.height())) {
971 m_buttonsOnRight = !m_buttonsOnRight;
977 if (wasOnRight != m_buttonsOnRight &&
984 time *= 1.0 - m_opacity;
990 propAnim->setStartValue(0);
991 propAnim->setEndValue(1);
992 propAnim->setDuration(time);
997 if (m_animType ==
FadeIn) {
998 propAnim->setDirection(QAbstractAnimation::Forward);
1000 }
else if (propAnim) {
1001 propAnim->setDirection(QAbstractAnimation::Backward);
1002 propAnim->start(QAbstractAnimation::DeleteWhenStopped);
1006 void FreeHandle::forceDisappear()
1008 setAcceptsHoverEvents(
false);
1012 int FreeHandle::minimumHeight()
1014 int iconMargin = m_iconSize / 2;
1015 int requiredHeight = iconMargin +
1016 (m_iconSize + iconMargin) * 4 +
1019 if (
applet() &&
applet()->hasConfigurationInterface()) {
1020 requiredHeight += (m_iconSize + iconMargin);
1023 return requiredHeight;
1026 void FreeHandle::calculateSize()
1028 KIconLoader *iconLoader = KIconLoader::global();
1030 m_iconSize = iconLoader->loadIcon(
"transform-scale", KIconLoader::Small).width();
1032 int handleHeight = qMax(minimumHeight(),
int(
widget()->contentsRect().height() * 0.8));
1033 int handleWidth = m_iconSize + 2 * HANDLE_MARGIN;
1035 widget()->contentsRect().top() + (
widget()->contentsRect().height() - handleHeight) / 2.0;
1037 qreal marginLeft, marginTop, marginRight, marginBottom;
1038 m_background->getMargins(marginLeft, marginTop, marginRight, marginBottom);
1040 if (m_buttonsOnRight) {
1042 m_rect = QRectF(
widget()->size().width(), top, handleWidth, handleHeight);
1045 m_rect = QRectF(-handleWidth, top, handleWidth, handleHeight);
1048 if (
widget()->contentsRect().height() > qreal(minimumHeight()) * 1.25) {
1049 int addedMargin = marginLeft / 2;
1060 addedMargin =
widget()->contentsRect().width() / 2;
1064 if (m_buttonsOnRight) {
1065 marginLeft += addedMargin;
1067 marginRight += addedMargin;
1072 m_decorationRect = m_rect.adjusted(-marginLeft, -marginTop, marginRight, marginBottom);
1076 #include "freehandle.moc"
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
qreal _k_distanceForPoint(const QPointF &point)
void hoverEnterEvent(QGraphicsSceneHoverEvent *event)
void disappearDone(Handle *self)
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
FreeHandle(GroupingContainment *parent, Plasma::Applet *applet)
void startFading(FadeType anim, const QPointF &hoverPos, bool preserveSide=false)
void raise(QGraphicsWidget *widget)
Raises a widget above all the other Applets or Groups.
virtual void showConfigurationInterface()
Lets the user interact with the Group options.
void hoverMoveEvent(QGraphicsSceneHoverEvent *event)
QPointF _k_rotatePoint(const QPointF &point, qreal angle)
QPointF _k_projectPoint(QPointF point, QPointF v)
virtual void detachWidget()
void mouseMoveEvent(QGraphicsSceneMouseEvent *event)
void setMovingWidget(QGraphicsWidget *widget)
Call this function when an Applet or a Group is being moved by the user.
QPainterPath FreeHandleRect(const QRectF &rect, int radius, bool onRight)
GroupingContainment * containment() const
Plasma::Applet * applet() const
QGraphicsView * currentView() const
void mousePressEvent(QGraphicsSceneMouseEvent *event)
AbstractGroup * group() const
void switchContainment(GroupingContainment *containment, const QPointF &pos)
move our widget to another containment
bool sceneEvent(QEvent *)
void setHoverPos(const QPointF &hoverPos)
QGraphicsWidget * widget() const
bool sceneEventFilter(QGraphicsItem *watched, QEvent *event)
The transformations of the applet are constrained by, e.g.
bool leaveCurrentView(const QPoint &pos) const
The base Containment class.
QRectF boundingRect() const
void destroy()
Destroy this Groups and its children, deleting the configurations too.
qreal _k_pointAngle(const QPointF &point)
void widgetMoved(QGraphicsWidget *widget)
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
QPainterPath shape() const