Skip to content

Commit

Permalink
Merge pull request #3 from talha1230/pr/2
Browse files Browse the repository at this point in the history
updated Readability
  • Loading branch information
talha1230 authored Jan 9, 2024
2 parents a08f190 + 5b5e557 commit c0751ce
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
6 changes: 6 additions & 0 deletions nameconvertormainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ void nameconvertorMainWindow::onPlainTextEditTextChangedLength() {
// Your implementation here
}

/**
* @brief Converts the input name to ASCII and displays the result.
*
* This function retrieves the input value from the QLineEdit, converts each character of the name to its corresponding ASCII value,
* and prepares a final message to display the ASCII result. The result is then set as the text of the QLabel.
*/
void nameconvertorMainWindow::onConvertNameToASCII() {
// Get the input value from the QLineEdit
QString name = ui->lineEdit_name->text();
Expand Down
16 changes: 16 additions & 0 deletions unitconvertormainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ UnitConvertorMainWindow::UnitConvertorMainWindow(QWidget *parent) :
QLabel *label_16;


/**
* @brief Slot function called when the text in plainTextEdit_2 is changed.
* It converts the input value to different units and updates the corresponding labels.
*/
void UnitConvertorMainWindow::onPlainTextEditTextChangedLength() {
// Get the input value from plainTextEdit_2
QString inputValue = plainTextEdit_2->toPlainText();
Expand All @@ -112,7 +116,15 @@ void UnitConvertorMainWindow::onPlainTextEditTextChangedLength() {
if (!isNumber) {
QMessageBox::critical(this, "Error", "Please enter a valid number");
}

{
case /* constant-expression */:
/* code */
break;

default:
break;
}
// Convert the input to different units
double valueInMeter = value / 100.0; // Centimeter to Meter
double valueInKilometer = value / 100000.0; // Centimeter to Kilometer
Expand All @@ -138,6 +150,10 @@ void UnitConvertorMainWindow::onPlainTextEditTextChangedLength() {
QLabel *label_29;
QLabel *label_28;

/**
* @brief Slot function called when the text in plainTextEdit_2 is changed.
* It converts the input value to various square units and updates the corresponding labels.
*/
void UnitConvertorMainWindow::onPlainTextEditTextChangedArea() {
// Get the input value from plainTextEdit_2
QString inputValue = plainTextEdit_4->toPlainText();
Expand Down

0 comments on commit c0751ce

Please sign in to comment.