#ifdef Q_WS_MAEMO_5
setMaximumHeight(150);
#else
- setMaximumHeight(70);
+ setMaximumHeight(100);
#endif
- horizontalLayout = new QHBoxLayout();
- verticalLayout = new QVBoxLayout();
+ horizontalLayout = new QHBoxLayout;
+ verticalLayout = new QVBoxLayout;
searchPushButton = new QPushButton(tr("Search"));
searchPushButton->setMinimumWidth(125);
- searchWordLineEdit = new QLineEdit();
+ searchWordLineEdit = new QLineEdit;
searchWordLineEdit->setMinimumWidth(250);
+
+
+ completerModel = new QStringListModel;
+
+
+ lineEditCompleter = new QCompleter(searchWordLineEdit);
+ lineEditCompleter->setModel(completerModel);
+ lineEditCompleter->setCaseSensitivity(Qt::CaseInsensitive);
+ lineEditCompleter->setCompletionMode(QCompleter::InlineCompletion);
+ searchWordLineEdit->setCompleter(lineEditCompleter);
+
+
#ifndef Q_WS_MAEMO_5
searchWordLineEdit->setMinimumHeight(
searchWordLineEdit->sizeHint().height()*3/2);
//create layout for lineEdit to have clear button on it
- QHBoxLayout* lineEditLayout = new QHBoxLayout();
+ QHBoxLayout* lineEditLayout = new QHBoxLayout;
searchWordLineEdit->setLayout(lineEditLayout);
- clearSearchWordToolButton = new QToolButton();
+ clearSearchWordToolButton = new QToolButton;
#ifdef Q_WS_MAEMO_5
clearSearchWordToolButton->setIcon(QIcon::fromTheme("general_stop"));
//tool buttons will have size 2 times smaller
#endif
- historyNextToolButton = new QToolButton();
+ historyNextToolButton = new QToolButton;
#ifdef Q_WS_MAEMO_5
historyNextToolButton->setIcon(
generateIcon(QIcon::fromTheme("general_forward")));
- historyPrevToolButton = new QToolButton();
+ historyPrevToolButton = new QToolButton;
#ifdef Q_WS_MAEMO_5
historyPrevToolButton->setIcon(
generateIcon(QIcon::fromTheme("general_back")));
- historyShowToolButton = new QToolButton();
+ historyShowToolButton = new QToolButton;
#ifdef Q_WS_MAEMO_5
historyShowToolButton->setIcon(
generateIcon(QIcon::fromTheme("general_back"), 90));
generateIcon(QIcon::fromTheme("go-up")));
#endif
- /*fullScreenToolButton = new QToolButton();
- #ifdef Q_WS_MAEMO_5
- fullScreenToolButton->setIcon(
- generateIcon(QIcon::fromTheme("general_fullsize")));
- #else
- fullScreenToolButton->setIcon(
- generateIcon(QIcon::fromTheme("view-fullscreen")));
- fullScreenToolButton->setMinimumSize(
- fullScreenToolButton->sizeHint().height()*2,
- fullScreenToolButton->sizeHint().height()*2);
- #endif*/
-
- searchingProgressBar = new QProgressBar();
+ searchingProgressBar = new QProgressBar;
//progress bar have minimum and maximum values set to 0, which will effect
//with "I'm alive" bar
searchingProgressBar->setMinimum(0);
searchingProgressBar->setMaximum(0);
- searchingProgressBar->hide();
#ifdef Q_WS_MAEMO_5
searchingProgressBar->setMaximumHeight(50);
#endif
+ searchingProgressBar->hide();
setLayout(verticalLayout);
horizontalLayout->addWidget(historyPrevToolButton);
horizontalLayout->addWidget(historyShowToolButton);
horizontalLayout->addWidget(historyNextToolButton);
- // horizontalLayout->addWidget(fullScreenToolButton);
//adding clear toolButton to textEdit with right alignment
lineEditLayout->addWidget(clearSearchWordToolButton, 0, Qt::AlignRight);
void SearchBarWidget::search(QString word) {
if(!_isSearching && !word.isEmpty()) {
+ completerModel->insertRow(completerModel->rowCount());
+ QModelIndex index =
+ completerModel->index(completerModel->rowCount() -1);
+
+ completerModel->setData(index, word);
+
+
searchWordLineEdit->setText(word);
Q_EMIT searchForTranslations(word);
}