ui(new Ui::MainWindow)
{
ui->setupUi(this);
+ setAttribute(Qt::WA_Maemo5StackedWindow);
+
+ searchBarWidget = new SearchBarWidget();
+ wordListWidget = new WordListWidget();
+ translationWidget = new TranslationWidget(this);
+
+ connect(wordListWidget, SIGNAL(clicked(QModelIndex)), translationWidget, SLOT(show(QModelIndex)));
+
+ ui->centralWidget->layout()->addWidget(wordListWidget);
+ ui->centralWidget->layout()->addWidget(searchBarWidget);
+
+
}
MainWindow::~MainWindow()
#define MAINWINDOW_H
#include <QMainWindow>
+#include "gui/TranslationWidget.h"
+#include "gui/WordListWidget.h"
+#include "gui/SearchBarWidget.h"
namespace Ui {
class MainWindow;
private:
Ui::MainWindow *ui;
+ SearchBarWidget* searchBarWidget;
+ TranslationWidget* translationWidget;
+ WordListWidget* wordListWidget;
};
#endif // MAINWINDOW_H
<property name="autoFillBackground">
<bool>true</bool>
</property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>800</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="SearchBarWidget" name="widget" native="true">
- <property name="enabled">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
+ <layout class="QVBoxLayout" name="verticalLayout"/>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
</widget>
</widget>
<layoutdefault spacing="6" margin="11"/>
- <customwidgets>
- <customwidget>
- <class>SearchBarWidget</class>
- <extends>QWidget</extends>
- <header>gui/SearchBarWidget.h</header>
- <container>1</container>
- </customwidget>
- </customwidgets>
<resources/>
<connections/>
</ui>
--- /dev/null
+/*******************************************************************************
+
+ This file is part of mDictionary.
+
+ mDictionary is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ mDictionary is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with mDictionary. If not, see <http://www.gnu.org/licenses/>.
+
+ Copyright 2010 Comarch S.A.
+
+*******************************************************************************/
+
+//Created by Mateusz Półrola
+
+#include "TranslationWidget.h"
+#include <QDebug>
+
+TranslationWidget::TranslationWidget(QWidget *parent) :
+ QWidget(parent) {
+ setAttribute(Qt::WA_Maemo5StackedWindow);
+ setWindowFlags(windowFlags() | Qt::Window);
+}
+
+void TranslationWidget::show(QModelIndex index) {
+ QWidget::show();
+
+ qDebug()<<index.model()->data(index);
+}
--- /dev/null
+/*******************************************************************************
+
+ This file is part of mDictionary.
+
+ mDictionary is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ mDictionary is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with mDictionary. If not, see <http://www.gnu.org/licenses/>.
+
+ Copyright 2010 Comarch S.A.
+
+*******************************************************************************/
+
+//Created by Mateusz Półrola
+
+#ifndef TRANSLATIONWIDGET_H
+#define TRANSLATIONWIDGET_H
+
+#include <QWidget>
+#include <QModelIndex>
+
+class TranslationWidget : public QWidget {
+ Q_OBJECT
+public:
+ explicit TranslationWidget(QWidget *parent = 0);
+
+Q_SIGNALS:
+
+public Q_SLOTS:
+ void show(QModelIndex);
+
+};
+
+#endif // TRANSLATIONWIDGET_H
--- /dev/null
+/*******************************************************************************
+
+ This file is part of mDictionary.
+
+ mDictionary is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ mDictionary is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with mDictionary. If not, see <http://www.gnu.org/licenses/>.
+
+ Copyright 2010 Comarch S.A.
+
+*******************************************************************************/
+
+//Created by Mateusz Półrola
+
+#include "WordListWidget.h"
+#include <QDebug>
+
+WordListWidget::WordListWidget(QWidget *parent) :
+ QListView(parent) {
+ wordListModel = new QStringListModel();
+
+ setModel(wordListModel);
+
+ addWord("ala");
+ addWord("ma");
+ addWord("kota");
+ addWord("ala");
+ addWord("ma");
+ addWord("kota");
+ addWord("ala");
+ addWord("ma");
+ addWord("kota");
+ addWord("ala");
+ addWord("ma");
+ addWord("kota");
+ addWord("ala");
+ addWord("ma");
+ addWord("kota");
+
+ setAttribute(Qt::WA_Maemo5StackedWindow);
+}
+
+void WordListWidget::addWord(QString word) {
+ int wordsCount = wordListModel->rowCount();
+
+ wordListModel->insertRow(wordsCount);
+
+ QModelIndex newWordIndex = wordListModel->index(wordsCount);
+
+ wordListModel->setData(newWordIndex, word);
+}
+
+void WordListWidget::clear() {
+ int wordsCount = wordListModel->rowCount();
+
+ for(int i = 0; i < wordsCount; i++) {
+ wordListModel->removeRow(0);
+ }
+}
--- /dev/null
+/*******************************************************************************
+
+ This file is part of mDictionary.
+
+ mDictionary is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ mDictionary is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with mDictionary. If not, see <http://www.gnu.org/licenses/>.
+
+ Copyright 2010 Comarch S.A.
+
+*******************************************************************************/
+
+//Created by Mateusz Półrola
+
+#ifndef WORDLISTWIDGET_H
+#define WORDLISTWIDGET_H
+
+#include <QWidget>
+#include <QtGui>
+#include <QStringListModel>
+
+class WordListWidget : public QListView {
+ Q_OBJECT
+public:
+ explicit WordListWidget(QWidget *parent = 0);
+
+Q_SIGNALS:
+
+private Q_SLOTS:
+
+private:
+ QStringListModel *wordListModel;
+ void addWord(QString word);
+ void clear();
+};
+
+#endif // WORDLISTWIDGET_H
SOURCES += main.cpp\
MainWindow.cpp \
- gui/SearchBarWidget.cpp
+ gui/SearchBarWidget.cpp \
+ gui/WordListWidget.cpp \
+ gui/TranslationWidget.cpp
HEADERS += MainWindow.h \
- gui/SearchBarWidget.h
+ gui/SearchBarWidget.h \
+ gui/WordListWidget.h \
+ gui/TranslationWidget.h
FORMS += MainWindow.ui