I have this code that checks the sizes of the images

If the host image is less than the cover image a message box will appear and will clear the text of the line edits of the hostImageLEdit and the coverImageLEdit. It will also do the same thing when the host image and cover image has the same sizes.

But when I run the program to check it only clears the text of the hostImageLEdit and not the coverImageLEdit.

It looks logically correct since it's able to clear the hostImageLEdit but clearly there's something wrong since it doesn't clear out the text of the coverImageLEdit. Any comments??

Qt Code:
  1. void MainWindow::checkImageSize()
  2. {
  3. // host and cover variables are of type int
  4. if(host < cover)
  5. {
  6. QMessageBox::about(this, tr("Error"),
  7. tr("Size of <b>Host Image</b> must be greater than the <b>Cover Image</b>!"));
  8.  
  9. ui->hostImageLEdit->clear();
  10. ui->coverImageLEdit->clear();
  11. }
  12. else if(host == cover)
  13. {
  14. QMessageBox::about(this, tr("Error"),
  15. tr("Size of <b>Host Image</b> and <b>Cover Image</b> are the same!"));
  16.  
  17. ui->hostImageLEdit->clear();
  18. ui->coverImageLEdit->clear();
  19. }
  20. }
To copy to clipboard, switch view to plain text mode