diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8a9d35c --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.user diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..9e2d83c --- /dev/null +++ b/main.cpp @@ -0,0 +1,11 @@ +#include "mainwindow.h" +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + MainWindow w; + w.show(); + + return a.exec(); +} diff --git a/mainwindow.cpp b/mainwindow.cpp new file mode 100644 index 0000000..faed78c --- /dev/null +++ b/mainwindow.cpp @@ -0,0 +1,21 @@ +#include "mainwindow.h" +#include "ui_mainwindow.h" + +MainWindow::MainWindow(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::MainWindow) +{ + ui->setupUi(this); + search = new Searcher(this); + + connect( ui->mainline, SIGNAL(textChanged(QString)), + search, SLOT(search_update(QString))); + + connect( search, SIGNAL(search_status(QString)), + ui->statusBar, SLOT(showMessage(QString))); +} + +MainWindow::~MainWindow() +{ + delete ui; +} diff --git a/mainwindow.h b/mainwindow.h new file mode 100644 index 0000000..19ed5d9 --- /dev/null +++ b/mainwindow.h @@ -0,0 +1,27 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include + +#include "searcher.h" + + + +namespace Ui { +class MainWindow; +} + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + explicit MainWindow(QWidget *parent = 0); + ~MainWindow(); + +private: + Ui::MainWindow *ui; + Searcher* search; +}; + +#endif // MAINWINDOW_H diff --git a/mainwindow.ui b/mainwindow.ui new file mode 100644 index 0000000..dc659a9 --- /dev/null +++ b/mainwindow.ui @@ -0,0 +1,66 @@ + + + MainWindow + + + + 0 + 0 + 424 + 290 + + + + MainWindow + + + + + + + + + + + + + 64 + 64 + + + + opt + + + + + + + + + + + + + + 0 + 0 + 424 + 25 + + + + + + TopToolBarArea + + + false + + + + + + + + diff --git a/searcher.cpp b/searcher.cpp new file mode 100644 index 0000000..bbe38e2 --- /dev/null +++ b/searcher.cpp @@ -0,0 +1,16 @@ +#include "searcher.h" + +Searcher::Searcher(QObject *parent) : + QObject(parent) +{ +} + +void Searcher::search_clear() +{ + emit search_status("Search clear"); +} + +void Searcher::search_update(QString str) +{ + emit search_status("Searching: " + str); +} diff --git a/searcher.h b/searcher.h new file mode 100644 index 0000000..871f7bb --- /dev/null +++ b/searcher.h @@ -0,0 +1,20 @@ +#ifndef SEARCHER_H +#define SEARCHER_H + +#include + +class Searcher : public QObject +{ + Q_OBJECT +public: + explicit Searcher(QObject *parent = 0); + +signals: + void search_status(QString); + +public slots: + void search_clear(); + void search_update(QString); +}; + +#endif // SEARCHER_H diff --git a/test1.pro b/test1.pro new file mode 100644 index 0000000..3baa9c1 --- /dev/null +++ b/test1.pro @@ -0,0 +1,22 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2013-06-08T13:17:18 +# +#------------------------------------------------- + +QT += core gui + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +TARGET = test1 +TEMPLATE = app + + +SOURCES += main.cpp\ + mainwindow.cpp \ + searcher.cpp + +HEADERS += mainwindow.h \ + searcher.h + +FORMS += mainwindow.ui