[Kde-bindings] Qyoto - how to Ok/Cancel dialog?

linuxoidoz at yahoo.com.au linuxoidoz at yahoo.com.au
Wed Feb 24 13:06:07 UTC 2010


Hello,

Here's a C++ example for a two button dialog:

         int button = QMessageBox::question(this,
             tr("Confirm Remove"),
             tr("Are you sure you want to remove \"%1\"?").arg(name),
             QMessageBox::Yes | QMessageBox::No);

         if (button == QMessageBox::Yes) {
		//do something
         }

If I translate it to C#:

	int button = QMessageBox.Question(this, "Confirm Remove", "Are you sure you want to remove?", QMessageBox.StandardButton.Ok, QMessageBox.StandardButton.Cancel);

         if (button == QMessageBox.StandardButton.Ok) {
		//do something
         }

it says "Operator `==' cannot be applied to operands of type `int' and `Qyoto.QMessageBox.StandardButton". 

I've also tried this part:

	int ret = dlg.Exec();
	switch (ret) {
		case QMessageBox.StandardButton.Ok:
		   // Save was clicked
		   break;
		case QMessageBox.StandardButton.Cancel:
		   // Don't Save was clicked
		   break;
	}

 same thing: "Cannot implicitly convert type `Qyoto.QMessageBox.StandardButton' to `int'. An explicit conversion exists (are you missing a cast?)"

How do you get the dialog to work in Qyoto? Thank you.



More information about the Kde-bindings mailing list