Merge branch 'master' into google
[mdictionary] / trunk / src / base / gui / SearchBarWidget.cpp
index 60fd4e6..6921e26 100644 (file)
@@ -123,7 +123,7 @@ void SearchBarWidget::initializeUI() {
 
 
     //create layout for lineEdit to have clear button on it
-    QHBoxLayout* lineEditLayout = new QHBoxLayout;
+    QHBoxLayout* lineEditLayout = new QHBoxLayout();
     searchWordLineEdit->setLayout(lineEditLayout);
 
 
@@ -134,11 +134,13 @@ void SearchBarWidget::initializeUI() {
         clearSearchWordToolButton->setMaximumSize(
                 clearSearchWordToolButton->sizeHint().height()/2,
                 clearSearchWordToolButton->sizeHint().height()/2);
+        lineEditLayout->setContentsMargins(0,0,10,0);
     #else
         clearSearchWordToolButton->setIcon(QIcon::fromTheme("edit-clear"));
         clearSearchWordToolButton->setMinimumSize(
-                clearSearchWordToolButton->sizeHint().height(),
-                clearSearchWordToolButton->sizeHint().height());
+                searchWordLineEdit->sizeHint().height()*1.2,
+                searchWordLineEdit->sizeHint().height()*1.2);
+        lineEditLayout->setContentsMargins(0,0,5,0);
     #endif
 
 
@@ -185,7 +187,6 @@ void SearchBarWidget::initializeUI() {
                 fullScreenToolButton->sizeHint().height()*2);
     #endif*/
 
-
     searchingProgressBar = new QProgressBar();
     //progress bar have minimum and maximum values set to 0, which will effect
     //with "I'm alive" bar
@@ -210,8 +211,8 @@ void SearchBarWidget::initializeUI() {
    // horizontalLayout->addWidget(fullScreenToolButton);
 
     //adding clear toolButton to textEdit with right alignment
-    lineEditLayout->addWidget(clearSearchWordToolButton, 0,
-                              Qt::AlignRight | Qt::AlignVCenter);
+    lineEditLayout->addWidget(clearSearchWordToolButton, 0, Qt::AlignRight);
+
 
     verticalLayout->addLayout(horizontalLayout);
 }
@@ -219,7 +220,7 @@ void SearchBarWidget::initializeUI() {
 
 void SearchBarWidget::searchPushButtonClicked() {
     if(_isSearching) {
-        emit stopSearching();
+        Q_EMIT stopSearching();
     }
     else {
         search(searchWordLineEdit->text());
@@ -230,7 +231,7 @@ void SearchBarWidget::searchPushButtonClicked() {
 void SearchBarWidget::search(QString word) {
     if(!_isSearching && !word.isEmpty()) {
         searchWordLineEdit->setText(word);
-        emit searchForTranslations(word);
+        Q_EMIT searchForTranslations(word);
     }
 }
 
@@ -251,7 +252,7 @@ void SearchBarWidget::searchDelay(QString word) {
 void SearchBarWidget::delaySearchTimeout() {
     delayTimer.stop();
     if(!_isSearching) {
-        emit searchForTranslations(delayString);
+        Q_EMIT searchForTranslations(delayString);
     }
 }
 
@@ -279,7 +280,7 @@ void SearchBarWidget::setIdle() {
     searchPushButton->setText(tr("Search"));
     setEnabled(true);
     _isSearching = false;
-    emit refreshHistoryButtons();
+    Q_EMIT refreshHistoryButtons();
 }