From 41881e3dcd695dc8ecdc5ef22cefd6f842858992 Mon Sep 17 00:00:00 2001 From: zecke Date: Mon, 14 Feb 2005 17:53:31 +0000 Subject: Remove the special Ok/Cancel handling and go with what QDialog provides This also fixes crashes when the user clicked ok in the Dialog --- (limited to 'noncore/net/opierdesktop') 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 @@ -180,17 +180,6 @@ QMyDialog::QMyDialog(QWidget* parent) : QDialog(parent, "Settings", true) 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++) { @@ -277,7 +266,7 @@ void QMyDialog::ComboChanged(int index) } //***************************************************************************** -void QMyDialog::OKClicked() +void QMyDialog::accept() { ServerName = ServerNameEdit->text(); UserName = UserNameEdit->text(); @@ -285,15 +274,11 @@ void QMyDialog::OKClicked() Height = HeightEdit->text().toInt(); ServerIP = IPEdit->text(); FullScreen = FullScreenCheckBox->isChecked(); - done(1); -} -//***************************************************************************** -void QMyDialog::CancelClicked() -{ - done(0); + QDialog::accept(); } + //***************************************************************************** void QMyDialog::AddClicked() { 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 @@ -28,8 +28,6 @@ class QMyDialog: public QDialog ~QMyDialog(); public: QListBox* ListBox; - QPushButton* OKButton; - QPushButton* CancelButton; QLabel* Label1; QLineEdit* ServerNameEdit; QLabel* Label2; @@ -46,8 +44,6 @@ class QMyDialog: public QDialog QCheckBox* FullScreenCheckBox; public slots: void ComboChanged(int); - void OKClicked(); - void CancelClicked(); void AddClicked(); void EditClicked(); void SaveClicked(); @@ -62,6 +58,8 @@ class QMyDialog: public QDialog int Height; int FullScreen; QMyConnectionItem* ConnectionList[10]; + protected slots: + void accept(); }; class QMyScrollView: public QScrollView -- cgit v0.9.0.2