QuantitySpinBox: Fixed placement of expression editor pop-up.

This commit is contained in:
Eivind Kvedalen
2015-09-22 22:46:58 +02:00
parent 8da76b5c4e
commit 12e79ba65c
3 changed files with 19 additions and 4 deletions

View File

@@ -35,7 +35,6 @@ using namespace App;
using namespace Gui::Dialog;
const int DlgExpressionInput::h = 15;
const int DlgExpressionInput::l = 30;
const int DlgExpressionInput::r = 30;
const int DlgExpressionInput::d = 7;
@@ -45,7 +44,8 @@ DlgExpressionInput::DlgExpressionInput(const App::ObjectIdentifier & _path, boos
expression(_expression ? _expression->copy() : 0),
path(_path),
discarded(false),
impliedUnit(_impliedUnit)
impliedUnit(_impliedUnit),
l(30)
{
assert(path.getDocumentObject() != 0);
@@ -91,6 +91,19 @@ QPoint DlgExpressionInput::tip() const
return QPoint(l - d, 0);
}
void DlgExpressionInput::setGeometry(int x, int y, int w, int h)
{
QDesktopWidget widget;
int screenWidth = widget.availableGeometry(widget.primaryScreen()).width();
if (x + w > screenWidth) {
l = l + (x + w - screenWidth);
x = screenWidth - w - 10;
}
QWidget::setGeometry(x, y, w, h);
}
void DlgExpressionInput::paintEvent(QPaintEvent * event) {
QPainter painter(this);
QPainterPath path;