Skip to content

Commit

Permalink
initial import
Browse files Browse the repository at this point in the history
  • Loading branch information
digikata committed Jun 8, 2013
0 parents commit 6e99901
Show file tree
Hide file tree
Showing 8 changed files with 184 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.user
11 changes: 11 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "mainwindow.h"
#include <QApplication>

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();

return a.exec();
}
21 changes: 21 additions & 0 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
@@ -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;
}
27 changes: 27 additions & 0 deletions mainwindow.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>

#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
66 changes: 66 additions & 0 deletions mainwindow.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>424</width>
<height>290</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralWidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="mainline"/>
</item>
<item>
<widget class="QPushButton" name="pb_opt">
<property name="maximumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="text">
<string>opt</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QListView" name="doclist"/>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>424</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QToolBar" name="mainToolBar">
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<widget class="QStatusBar" name="statusBar"/>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>
16 changes: 16 additions & 0 deletions searcher.cpp
Original file line number Diff line number Diff line change
@@ -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);
}
20 changes: 20 additions & 0 deletions searcher.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#ifndef SEARCHER_H
#define SEARCHER_H

#include <QObject>

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
22 changes: 22 additions & 0 deletions test1.pro
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 6e99901

Please sign in to comment.