-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainwindow.cpp
More file actions
50 lines (38 loc) · 997 Bytes
/
mainwindow.cpp
File metadata and controls
50 lines (38 loc) · 997 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
Copyright (c) 2014 Raivis Strogonovs
*/
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
connect(ui->stemBtn, SIGNAL(clicked(bool)), this, SLOT(stemWord()));
}
void MainWindow::stemWord()
{
if(ui->wordEdit->text().isEmpty())
return;
switch (ui->langComboBox->currentIndex()) {
case LANG_EN:
ui->stemResultLbl->setText( ENPorterStemmer::stem(ui->wordEdit->text()) );
break;
case LANG_LV:
ui->stemResultLbl->setText( LVPorterStemmer::stem(ui->wordEdit->text()) );
break;
default:
break;
}
ui->wordEdit->clear();
}
void MainWindow::keyReleaseEvent(QKeyEvent *e)
{
if(e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return)
stemWord();
QMainWindow::keyReleaseEvent( e );
}
MainWindow::~MainWindow()
{
delete ui;
}