Repository: nuttyartist/notes
File: src/mainwindow.cpp (C++)

Code before:
                                 "} "
                                 "QToolButton { "
                                 "  border: none; "
                                 "  padding: 0px;"
                                 "}"
                                 );

            m_searchEdit->setStyleSheet(ss);
        }
        break;
    }
    case QEvent::FocusOut:{
        if(object == m_searchEdit){
            QString ss = QStringLiteral("QLineEdit{ "
                                 "  padding-left: 21px;"
                                 "  padding-right: 19px;"
                                 "  border: 1px solid rgb(205, 205, 205);"
                                 "  border-radius: 3px;"
                                 "  background: rgb(255, 255, 255);"
                                 "  selection-background-color: rgb(61, 155, 218);"
                                 "} "
                                 "QToolButton { "
                                 "  border: none; "
                                 "  padding: 0px;"
                                 "}"
                                 );

            m_searchEdit->setStyleSheet(ss);
        }
        break;
    }
    case QEvent::Show:
        if(object == &m_updater){

            QRect rect = m_updater.geometry();
            QRect appRect = geometry();
            int titleBarHeight = 28 ;

            int x = int(appRect.x() + (appRect.width() - rect.width())/2.0);
            int y = int(appRect.y() + titleBarHeight  + (appRect.height() - rect.height())/2.0);

            m_updater.setGeometry(QRect(x, y, rect.width(), rect.height()));
        }
        break;
    case QEvent::MouseButtonPress:
    case QEvent::MouseButtonDblClick:
        // Only allow double click (maximise/minimise) or dragging (move)
        // from the top part of the window
        if(object == ui->frame){
            QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
            if(mouseEvent->y() >= ui->searchEdit->y()){

Review comment (performance):
QLatin1String can be used here as QString has` QString & operator=(QLatin1String str)`
From https://doc.qt.io/qt-5/qstring.html#QStringLiteral : 

> Note: QLatin1String can still be more efficient than QStringLiteral when the string is passed to a function that has an overload taking QLatin1String and this overload avoids conversion to QString. For instance, QString::operator==() can compare to a QLatin1String directly:

Code after:
                }
            }
        }

        if(object == m_searchEdit){
            QString ss = QStringLiteral("QLineEdit{ "
                                 "  padding-left: 21px;"
                                 "  padding-right: 19px;"
                                 "  border: 2px solid rgb(61, 155, 218);"
                                 "  border-radius: 3px;"
                                 "  background: rgb(255, 255, 255);"
                                 "  selection-background-color: rgb(61, 155, 218);"
                                 "} "
                                 "QToolButton { "
                                 "  border: none; "
                                 "  padding: 0px;"
                                 "}"
                                 );

            m_searchEdit->setStyleSheet(ss);
        }
        break;
    }
    case QEvent::FocusOut:{
        if(object == m_searchEdit){
            QString ss = QStringLiteral("QLineEdit{ "
                                 "  padding-left: 21px;"
                                 "  padding-right: 19px;"
                                 "  border: 1px solid rgb(205, 205, 205);"
                                 "  border-radius: 3px;"
                                 "  background: rgb(255, 255, 255);"
                                 "  selection-background-color: rgb(61, 155, 218);"
                                 "} "
                                 "QToolButton { "
                                 "  border: none; "
                                 "  padding: 0px;"
                                 "}"
                                 );

            m_searchEdit->setStyleSheet(ss);
        }
        break;
    }
    case QEvent::Show:
        if(object == &m_updater){

            QRect rect = m_updater.geometry();
            QRect appRect = geometry();
            int titleBarHeight = 28 ;

            int x = int(appRect.x() + (appRect.width() - rect.width())/2.0);