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

Code before:
                        clearSearch();
                        createNewNote();
                    }

                    m_textEdit->setFocus();

                }else if(m_proxyModel->rowCount() == 0){
                    createNewNote();
                }
            }
        }

        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;
    }

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(isMouseOnScrollBar){
            if(object == m_textEdit->verticalScrollBar()){
                m_textEdit->setFocusPolicy(Qt::StrongFocus);
            }
        }
        break;
    }
    case QEvent::FocusIn:{
        if(object == m_textEdit){
            if(!m_isOperationRunning){
                if(!m_searchEdit->text().isEmpty()){
                    if(!m_currentSelectedNoteProxy.isValid()){
                        clearSearch();
                        createNewNote();
                    }

                    m_textEdit->setFocus();

                }else if(m_proxyModel->rowCount() == 0){
                    createNewNote();
                }
            }
        }

        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);"