move the dialog to make it still look attached to the panel/screen edge

when its size is synced with the graphicswidget one
BUG:193100

svn path=/trunk/KDE/kdelibs/; revision=969468
This commit is contained in:
Marco Martin 2009-05-18 12:36:19 +00:00
parent 8b7bb8b125
commit fd1a5a98fc

View File

@ -205,6 +205,21 @@ void DialogPrivate::adjustView()
view->resize(graphicsWidget->size().toSize());
view->centerOn(graphicsWidget);
//if the view resized and a border is disabled move the dialog to make sure it will still look attached to panel/screen edge
qreal topHeight;
qreal leftWidth;
qreal rightWidth;
qreal bottomHeight;
background->getMargins(leftWidth, topHeight, rightWidth, bottomHeight);
if (rightWidth == 0) {
q->move(q->pos().x() + (prevSize.width() - q->size().width()), q->pos().y());
}
if (bottomHeight == 0) {
q->move(q->pos().x(), q->pos().y() + (prevSize.height() - q->size().height()));
}
if (q->size() != prevSize) {
//the size of the dialog has changed, emit the signal:
emit q->dialogResized();