From 80e36da2bbb4c6ce0e6f04ccff595f61769bb4ab Mon Sep 17 00:00:00 2001 From: Stefan Suhren Date: Mon, 30 Mar 2015 10:33:49 +0200 Subject: Adds comments and uses naming convention for auto connection --- dlgpreferences.cpp | 21 +++++++++++++++++++-- dlgpreferences.h | 13 +++++++++++++ mainwindow.cpp | 10 +++++++--- mainwindow.h | 5 ++++- mainwindow.ui | 16 ---------------- 5 files changed, 43 insertions(+), 22 deletions(-) diff --git a/dlgpreferences.cpp b/dlgpreferences.cpp index 4661fa5..9174401 100644 --- a/dlgpreferences.cpp +++ b/dlgpreferences.cpp @@ -17,6 +17,11 @@ DlgPreferences::~DlgPreferences() delete ui; } +/** + * @brief DlgPreferences::setHeight + * @param arg + * The hight that will be displayed in the lineEditHeight. + */ void DlgPreferences::setHeight(int arg) { if (m_Height == arg) @@ -27,6 +32,11 @@ void DlgPreferences::setHeight(int arg) emit HeightChanged(arg); } +/** + * @brief DlgPreferences::setWidth + * @param arg + * The width that will be displayed in the lineEditWidth. + */ void DlgPreferences::setWidth(int arg) { if (m_Width == arg) @@ -38,14 +48,18 @@ void DlgPreferences::setWidth(int arg) } - +/** + * @brief DlgPreferences::on_buttonOk_clicked + */ void DlgPreferences::on_buttonOk_clicked() { qDebug() << "Height: " << ui->lineEditHeight->text(); qDebug() << "Width:" << ui->lineEditWidth->text(); } - +/** + * @brief DlgPreferences::accept + */ void DlgPreferences::accept() { setHeight(ui->lineEditHeight->text().toInt()); @@ -54,6 +68,9 @@ void DlgPreferences::accept() QDialog::accept(); } +/** + * @brief DlgPreferences::reject + */ void DlgPreferences::reject() { QDialog::reject(); diff --git a/dlgpreferences.h b/dlgpreferences.h index 2921959..6848cc6 100644 --- a/dlgpreferences.h +++ b/dlgpreferences.h @@ -8,6 +8,9 @@ namespace Ui { class DlgPreferences; } +/** + * @brief The DlgPreferences class + */ class DlgPreferences : public QDialog { Q_OBJECT @@ -19,11 +22,21 @@ public: explicit DlgPreferences(QWidget *parent = 0); ~DlgPreferences(); + /** + * @brief Height from lineEditHeight + * @return + * The hight entered by the user. + */ int Height() const { return m_Height; } + /** + * @brief Width from lineEditWidth + * @return + * The width entered by the user. + */ int Width() const { return m_Width; diff --git a/mainwindow.cpp b/mainwindow.cpp index 94b879e..155bd28 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -13,7 +13,11 @@ MainWindow::~MainWindow() delete ui; } -void MainWindow::on_action_Preferences_triggered() +/** + * @brief MainWindow::on_actionPreferences_triggered + * Creates a DlgPreferences Dialog and sets hight and width of the MainWindow. + */ +void MainWindow::on_actionPreferences_triggered() { qDebug() << "Preferences called"; DlgPreferences *tmp = new DlgPreferences(this); @@ -25,8 +29,8 @@ void MainWindow::on_action_Preferences_triggered() { qDebug() << "DlgPreferences okay clicked."; - int width = tmp->width(); - int height = tmp->height(); + int width = tmp->Width(); + int height = tmp->Height(); if(width >= 100 && width <= 800 && height >= 100 && height <= 800) { diff --git a/mainwindow.h b/mainwindow.h index 87080d1..6f225be 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -9,6 +9,9 @@ namespace Ui { class MainWindow; } +/** + * @brief The MainWindow class + */ class MainWindow : public QMainWindow { Q_OBJECT @@ -18,7 +21,7 @@ public: ~MainWindow(); private slots: - void on_action_Preferences_triggered(); + void on_actionPreferences_triggered(); private: Ui::MainWindow *ui; }; diff --git a/mainwindow.ui b/mainwindow.ui index 5f71cc1..43bf0f5 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -120,22 +120,6 @@ - - actionPreferences - triggered() - MainWindow - on_action_Preferences_triggered() - - - -1 - -1 - - - 199 - 149 - - - on_action_Preferences_triggered() -- cgit v1.2.3-70-g09d2