Zwrotomat/mainwindow.cpp
/**
 * @brief MainWindow::removeComment
 * Removes the item from the comment list
 * @param text
 * key of the comment to remove
 */
@brief MainWindow::removeComment
Removes the item from the comment list
@param text
key of the comment to remove
@brief MainWindow :: removeComment Removes the item from the comment list @param text key of the comment to remove
void MainWindow::removeComment(const QString &text) {
    if(m_Comments->size() == 1){
        this->m_currentComment = new MultiFileComment();
        loadCurrentFile();
    }
    for (int i = 0; i < ui->listWidget->count(); ++i) {
        auto item = ui->listWidget->item(i);
        auto itemWidget = dynamic_cast<ItemDisplay*>(ui->listWidget->itemWidget(item));
        if (itemWidget->getText() == text){
            if(m_Comments->value(text) == this->m_currentComment){
                ui->textBrowser->document()->setPlainText("");
                ui->commentEdit->document()->setPlainText("");
            }
            delete m_Comments->value(text);
            m_Comments->remove(text);
            delete item;
            break;
        }
    }
}
void MainWindow :: removeComment ( const QString & text ) { if ( m_Comments -> size ( ) == 1 ) { this -> m_currentComment = new MultiFileComment ( ) ; loadCurrentFile ( ) ; } for ( int i = 0 ; i < ui -> listWidget -> count ( ) ; ++ i ) { auto item = ui -> listWidget -> item ( i ) ; auto itemWidget = dynamic_cast < ItemDisplay * > ( ui -> listWidget -> itemWidget ( item ) ) ; if ( itemWidget -> getText ( ) == text ) { if ( m_Comments -> value ( text ) == this -> m_currentComment ) { ui -> textBrowser -> document ( ) -> setPlainText ( " " ) ; ui -> commentEdit -> document ( ) -> setPlainText ( " " ) ; } delete m_Comments -> value ( text ) ; m_Comments -> remove ( text ) ; delete item ; break ; } } }
@brief MainWindow::removeComment
 Removes the item from the comment list
 @param text
 key of the comment to remove
@brief MainWindow :: removeComment Removes the item from the comment list @param text key of the comment to remove