author | zecke <zecke> | 2005-02-14 17:53:31 (UTC) |
---|---|---|
committer | zecke <zecke> | 2005-02-14 17:53:31 (UTC) |
commit | 41881e3dcd695dc8ecdc5ef22cefd6f842858992 (patch) (side-by-side diff) | |
tree | bd533c7e75700bbafb69ab8a7cd53eb031969080 | |
parent | 0e6780c400fbae2ccd8895e40480adb4273906ae (diff) | |
download | opie-41881e3dcd695dc8ecdc5ef22cefd6f842858992.zip opie-41881e3dcd695dc8ecdc5ef22cefd6f842858992.tar.gz opie-41881e3dcd695dc8ecdc5ef22cefd6f842858992.tar.bz2 |
Remove the special Ok/Cancel handling and go with what QDialog provides
This also fixes crashes when the user clicked ok in the Dialog
-rw-r--r-- | noncore/net/opierdesktop/qtwin.cpp | 21 | ||||
-rw-r--r-- | noncore/net/opierdesktop/qtwin.h | 6 |
2 files changed, 5 insertions, 22 deletions
diff --git a/noncore/net/opierdesktop/qtwin.cpp b/noncore/net/opierdesktop/qtwin.cpp index 181d275..54a5a03 100644 --- a/noncore/net/opierdesktop/qtwin.cpp +++ b/noncore/net/opierdesktop/qtwin.cpp @@ -177,23 +177,12 @@ QMyDialog::QMyDialog(QWidget* parent) : QDialog(parent, "Settings", true) connect(RemoveButton, SIGNAL(clicked()), this, SLOT(RemoveClicked())); // full screen check box FullScreenCheckBox = new QCheckBox(this, "Full Screen"); FullScreenCheckBox->setText("Full Screen"); FullScreenCheckBox->move(10, 230); // ok button - OKButton = new QPushButton(this); - OKButton->setText("OK"); - OKButton->move(100, 240); - OKButton->resize(50, 20); - connect(OKButton, SIGNAL(clicked()), this, SLOT(OKClicked())); - // cancel button - CancelButton = new QPushButton(this); - CancelButton->setText("Cancel"); - CancelButton->move(160, 240); - CancelButton->resize(50, 20); - connect(CancelButton, SIGNAL(clicked()), this, SLOT(CancelClicked())); for (i = 0; i < 10; i++) { ConnectionList[i] = new QMyConnectionItem; ConnectionList[i]->ServerName = ""; ConnectionList[i]->UserName = ""; @@ -274,29 +263,25 @@ void QMyDialog::ComboChanged(int index) WidthEdit->setText("800"); HeightEdit->setText("600"); } } //***************************************************************************** -void QMyDialog::OKClicked() +void QMyDialog::accept() { ServerName = ServerNameEdit->text(); UserName = UserNameEdit->text(); Width = WidthEdit->text().toInt(); Height = HeightEdit->text().toInt(); ServerIP = IPEdit->text(); FullScreen = FullScreenCheckBox->isChecked(); - done(1); -} -//***************************************************************************** -void QMyDialog::CancelClicked() -{ - done(0); + QDialog::accept(); } + //***************************************************************************** void QMyDialog::AddClicked() { int i; QMyConnectionItem* Item; diff --git a/noncore/net/opierdesktop/qtwin.h b/noncore/net/opierdesktop/qtwin.h index 38ad190..7a2110b 100644 --- a/noncore/net/opierdesktop/qtwin.h +++ b/noncore/net/opierdesktop/qtwin.h @@ -25,14 +25,12 @@ class QMyDialog: public QDialog Q_OBJECT public: QMyDialog(QWidget*); ~QMyDialog(); public: QListBox* ListBox; - QPushButton* OKButton; - QPushButton* CancelButton; QLabel* Label1; QLineEdit* ServerNameEdit; QLabel* Label2; QLineEdit* UserNameEdit; QLabel* Label3; QLineEdit* IPEdit; @@ -43,14 +41,12 @@ class QMyDialog: public QDialog QPushButton* EditButton; QPushButton* SaveButton; QPushButton* RemoveButton; QCheckBox* FullScreenCheckBox; public slots: void ComboChanged(int); - void OKClicked(); - void CancelClicked(); void AddClicked(); void EditClicked(); void SaveClicked(); void RemoveClicked(); void ListBoxChanged(); void ListBoxSelected(int); @@ -59,12 +55,14 @@ class QMyDialog: public QDialog QString UserName; QString ServerIP; int Width; int Height; int FullScreen; QMyConnectionItem* ConnectionList[10]; + protected slots: + void accept(); }; class QMyScrollView: public QScrollView { Q_OBJECT public: |