Skip to content

Commit

Permalink
popup appears when no logs match
Browse files Browse the repository at this point in the history
  • Loading branch information
AmericanEnglish committed Jun 21, 2017
1 parent 887e71b commit 45bbf9c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cpp/widgets/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ void MainWindow::run() {
if (results.keys().isEmpty()) {
// Show some dialog box
NoResults *noresults = new NoResults("No Logs Matched Your Search!", this);
noresults->show();
noresults->exec();
delete noresults;
}
else if (reader == nullptr) {
Expand Down
15 changes: 9 additions & 6 deletions cpp/widgets/popups.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@


NoResults::NoResults(QString message, QWidget *parent) : QDialog(parent) {
QVBoxLayout *layout = new QVBoxLayout(this);
QLabel *displayMessage = new QLabel(message, this);
QPushButton *accept = new QPushButton("OK", this);
QVBoxLayout *layout = new QVBoxLayout(this);
QLabel *displayMessage = new QLabel(message, this);
QPushButton *acceptButton = new QPushButton("OK", this);

layout->addWidget(displayMessage);
layout->addWidget(accept);
setLayout(layout);
connect(acceptButton, SIGNAL(clicked()), this, SLOT(accept()));

layout->addWidget(displayMessage);
layout->addWidget(acceptButton);
setModal(true);
setLayout(layout);
}


3 changes: 2 additions & 1 deletion headers/widgets/popups.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#pragma once
#include <QDialog>
#include <QString>
#include <QWidget>

// All additional popups go here

class NoResults : public QDialog {

Q_OBJECT

public:
Expand Down

0 comments on commit 45bbf9c

Please sign in to comment.