these methods aren't used and were fairly ugly to begin with =)
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=842654
This commit is contained in:
parent
b46dd9832f
commit
ad7a1256a9
31
dialog.cpp
31
dialog.cpp
@ -104,36 +104,5 @@ void Dialog::resizeEvent(QResizeEvent *e)
|
||||
setMask(d->background->mask());
|
||||
}
|
||||
|
||||
void Dialog::position(QGraphicsSceneEvent *event, const QRectF boundingRect, QPointF scenePos)
|
||||
{
|
||||
QWidget *viewWidget = event->widget() ? event->widget()->parentWidget() : 0;
|
||||
//QPointF scenePos = mapToScene(boundingRect.topLeft());
|
||||
QGraphicsView *view = qobject_cast<QGraphicsView*>(viewWidget);
|
||||
position(view,boundingRect,scenePos);
|
||||
}
|
||||
|
||||
void Dialog::position(QGraphicsView * view,const QRectF boundingRect,QPointF scenePos)
|
||||
{
|
||||
if (view) {
|
||||
QPoint viewPos = view->mapFromScene(scenePos);
|
||||
QPoint globalPos = view->mapToGlobal(viewPos);
|
||||
|
||||
if ((globalPos.ry()-height())< 0) {
|
||||
scenePos = QPointF(scenePos.x() + boundingRect.width(), scenePos.y() + boundingRect.height());
|
||||
viewPos = view->mapFromScene(scenePos);
|
||||
globalPos = view->mapToGlobal(viewPos)+QPoint(0,10);
|
||||
} else {
|
||||
globalPos.ry() -= (height()+10);
|
||||
}
|
||||
|
||||
if ((globalPos.rx() + width()) > view->width()) {
|
||||
globalPos.rx()-=((globalPos.rx() + width())-view->width());
|
||||
}
|
||||
|
||||
move(globalPos);
|
||||
kDebug() << globalPos;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#include "dialog.moc"
|
||||
|
14
dialog.h
14
dialog.h
@ -55,20 +55,6 @@ class PLASMA_EXPORT Dialog : public QWidget
|
||||
*/
|
||||
explicit Dialog(QWidget * parent = 0, Qt::WindowFlags f = Qt::Window);
|
||||
virtual ~Dialog();
|
||||
/**
|
||||
* @arg event the event that is used to position the dialog. Usually, you want
|
||||
* to pass this on from the mouseevent.
|
||||
* @arg boundingRect the boundingRect() from the applet.
|
||||
* @arg scenePos the absolute position on the scene.
|
||||
*/
|
||||
void position(QGraphicsSceneEvent *event, const QRectF boundingRect, QPointF scenePos);
|
||||
|
||||
/**
|
||||
* @arg view The QGV where is displayed the applet
|
||||
* @arg scenePos the absolute position on the scene.
|
||||
* @arg boundingRect the boundingRect() from the applet.
|
||||
*/
|
||||
void position(QGraphicsView * view,const QRectF boundingRect,QPointF scenePos);
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user