Fix usability bugs of new expression input

- click on background closes popup
- size on open is now correct if expression is set initially
This commit is contained in:
Stefan Tröger
2015-09-24 08:45:59 +02:00
committed by wmayer
parent 181e90471f
commit 0ecf7762a9
2 changed files with 12 additions and 4 deletions

View File

@@ -28,6 +28,7 @@
#include "ui_DlgExpressionInput.h"
#include "ExpressionCompleter.h"
#include <Base/Tools.h>
#include <Base/Console.h>
#include <App/Expression.h>
#include <App/DocumentObject.h>
@@ -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"

View File

@@ -66,6 +66,7 @@ public:
private Q_SLOTS:
void textChanged(const QString & text);
void setDiscarded();
void mousePressEvent(QMouseEvent*);
private:
::Ui::DlgExpressionInput *ui;