From 0ecf7762a927edcda3ce80aec7ef6fec7890178d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Tr=C3=B6ger?= Date: Thu, 24 Sep 2015 08:45:59 +0200 Subject: [PATCH] Fix usability bugs of new expression input - click on background closes popup - size on open is now correct if expression is set initially --- src/Gui/DlgExpressionInput.cpp | 15 +++++++++++---- src/Gui/DlgExpressionInput.h | 1 + 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Gui/DlgExpressionInput.cpp b/src/Gui/DlgExpressionInput.cpp index 3d3531d942..d8cc47199f 100644 --- a/src/Gui/DlgExpressionInput.cpp +++ b/src/Gui/DlgExpressionInput.cpp @@ -28,6 +28,7 @@ #include "ui_DlgExpressionInput.h" #include "ExpressionCompleter.h" #include +#include #include #include @@ -41,7 +42,7 @@ DlgExpressionInput::DlgExpressionInput(const App::ObjectIdentifier & _path, boos path(_path), discarded(false), impliedUnit(_impliedUnit), - minimumWidth(300) + minimumWidth(10) { assert(path.getDocumentObject() != 0); @@ -64,10 +65,8 @@ DlgExpressionInput::DlgExpressionInput(const App::ObjectIdentifier & _path, boos setWindowFlags(Qt::Widget | Qt::FramelessWindowHint); setAttribute(Qt::WA_NoSystemBackground, true); setAttribute(Qt::WA_TranslucentBackground, true); - setParent(0); - setWindowFlags(Qt::Popup); - setModal(true); + ui->expression->setFocus(); } @@ -155,5 +154,13 @@ void DlgExpressionInput::setExpressionInputSize(int width, int height) { minimumWidth = width; } +void DlgExpressionInput::mousePressEvent(QMouseEvent*) { + + + //we need to reject the dialog when clicked on the background. As the background is transparent + //this is the expected behaviour for the user + this->reject(); +} + #include "moc_DlgExpressionInput.cpp" diff --git a/src/Gui/DlgExpressionInput.h b/src/Gui/DlgExpressionInput.h index d69cf08e8b..d5b950e23e 100644 --- a/src/Gui/DlgExpressionInput.h +++ b/src/Gui/DlgExpressionInput.h @@ -66,6 +66,7 @@ public: private Q_SLOTS: void textChanged(const QString & text); void setDiscarded(); + void mousePressEvent(QMouseEvent*); private: ::Ui::DlgExpressionInput *ui;