#include <QApplication>
#include <QFormLayout>
+#include <QKeyEvent>
#include <QLineEdit>
#include "trace.h"
label_size.width(), label_size.height());
}
+bool Trace::eventFilter(QObject *obj, QEvent *evt)
+{
+ QKeyEvent *keyEvent;
+
+ (void)obj;
+
+ if (evt->type() == QEvent::KeyPress) {
+ keyEvent = static_cast<QKeyEvent*>(evt);
+ if (keyEvent->key() == Qt::Key_Enter ||
+ keyEvent->key() == Qt::Key_Return) {
+ close_popup();
+ return true;
+ }
+ }
+
+ return false;
+}
+
QColor Trace::get_text_colour() const
{
return (_colour.lightness() > 64) ? Qt::black : Qt::white;
this, SLOT(on_text_changed(const QString&)));
form->addRow(tr("Name"), name_edit);
+ // We want to close the popup when the Enter key was pressed.
+ name_edit->installEventFilter(this);
+
add_colour_option(parent, form);
}