improve regex filter UX

This commit is contained in:
Akash Mozumdar 2018-12-03 18:29:54 -05:00
parent 74383ee0d8
commit 9068228427
2 changed files with 15 additions and 2 deletions

View File

@ -1,5 +1,6 @@
#include "window.h" #include "window.h"
#include "ui_window.h" #include "ui_window.h"
#include <QLabel>
Window::Window(QWidget *parent) : Window::Window(QWidget *parent) :
QMainWindow(parent), QMainWindow(parent),
@ -15,7 +16,9 @@ Window::~Window()
void Window::on_regexInput_textEdited(const QString& newRegex) void Window::on_regexInput_textEdited(const QString& newRegex)
{ {
QLabel* info = findChild<QLabel*>("info");
std::lock_guard<std::mutex> l(m); std::lock_guard<std::mutex> l(m);
try { regex = newRegex.toStdWString(); } try { regex = newRegex.toStdWString(); }
catch (...) {} catch (...) { return findChild<QLabel*>("info")->setText("Invalid regex"); }
findChild<QLabel*>("info")->setText("Currently filtering: " + newRegex);
} }

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>350</width> <width>350</width>
<height>50</height> <height>60</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -18,6 +18,16 @@
<item> <item>
<widget class="QLineEdit" name="regexInput"/> <widget class="QLineEdit" name="regexInput"/>
</item> </item>
<item>
<widget class="QLabel" name="info">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</widget> </widget>