Zwrotomat/codedisplay.cpp
/**
 * @brief CodeDisplay::processCurrentLine adding or removing lines from given &multiFileComment
 * @param multiFileComment &multiFileComment comment containing lines
 * @param selectedFile selectedFile
 */
@brief CodeDisplay::processCurrentLine adding or removing lines from given &multiFileComment
@param multiFileComment &multiFileComment comment containing lines
@param selectedFile selectedFile
@brief CodeDisplay :: processCurrentLine adding or removing lines from given &multiFileComment @param multiFileComment &multiFileComment comment containing lines @param selectedFile selectedFile
void CodeDisplay::processCurrentLine(MultiFileComment &multiFileComment, QString selectedFile)
{
    const QString fileName = selectedFile;
    Qt::KeyboardModifiers key = QGuiApplication::queryKeyboardModifiers();
    int selectedline = this->textCursor().blockNumber(); 
    if(!multiFileComment.containFile(fileName))
        multiFileComment.addNewFile(fileName);
    if(isMouseOver()) {
        QTextCursor cur = this->textCursor();
        QTextBlockFormat f;
        if(multiFileComment.getLinesByName(fileName)->contains(selectedline)) {
            if(key != Qt::ShiftModifier) 
                return;
            multiFileComment.
                    getLinesByName(selectedFile)->
                    removeAt(multiFileComment.getLinesByName(selectedFile)->
                             indexOf(selectedline)); 
            f.setBackground(Qt::white); 
        }else
             if(key != Qt::ShiftModifier){
                 multiFileComment.getLinesByName(fileName)->append(selectedline); 
                 f.setBackground(Qt::gray); 
             }
        this->setTextCursor(cur);
        cur.select(QTextCursor::LineUnderCursor);
        cur.setBlockFormat(f); 
      }
}
void CodeDisplay :: processCurrentLine ( MultiFileComment & multiFileComment , QString selectedFile ) { const QString fileName = selectedFile ; Qt :: KeyboardModifiers key = QGuiApplication :: queryKeyboardModifiers ( ) ; int selectedline = this -> textCursor ( ) . blockNumber ( ) ; if ( ! multiFileComment . containFile ( fileName ) ) multiFileComment . addNewFile ( fileName ) ; if ( isMouseOver ( ) ) { QTextCursor cur = this -> textCursor ( ) ; QTextBlockFormat f ; if ( multiFileComment . getLinesByName ( fileName ) -> contains ( selectedline ) ) { if ( key != Qt :: ShiftModifier ) return ; multiFileComment . getLinesByName ( selectedFile ) -> removeAt ( multiFileComment . getLinesByName ( selectedFile ) -> indexOf ( selectedline ) ) ; f . setBackground ( Qt :: white ) ; } else if ( key != Qt :: ShiftModifier ) { multiFileComment . getLinesByName ( fileName ) -> append ( selectedline ) ; f . setBackground ( Qt :: gray ) ; } this -> setTextCursor ( cur ) ; cur . select ( QTextCursor :: LineUnderCursor ) ; cur . setBlockFormat ( f ) ; } }
@brief CodeDisplay::processCurrentLine adding or removing lines from given &multiFileComment
 @param multiFileComment &multiFileComment comment containing lines
 @param selectedFile selectedFile
@brief CodeDisplay :: processCurrentLine adding or removing lines from given &multiFileComment @param multiFileComment &multiFileComment comment containing lines @param selectedFile selectedFile
//selected line index //if shift isn't pressed //removing selected line //painting white //adding selected line //painting gray //highlighting line