I see no reason to make the Dialog an action object aka: this.dialog
The dialog lives only as long as it is active and data is retrieved from it.
This always worked for me:
Code: Select all
/**
* Shows the Krokus dialog.
* Retrieves user preferences.
*
* \return True if the dialog was accepted, false if it was rejected.
*/
Krokus.prototype.showDialog = function() {
// Create a dialog based on the UI file:
var dialog = WidgetFactory.createDialog(Krokus.includeBasePath, "KrokusDialog.ui");
// List of QWidgets in dialog:
var widgets = getWidgets(dialog);
// Load persistent dialog entries:
WidgetFactory.restoreState(dialog);
// Activate the Krokus dialog:
if (!dialog.exec()) { // When the dialog was rejected
dialog.destroy();
EAction.activateMainWindow();
return false; // Dialog rejected
}
// -> Continue with the dialog accepted
// Retrieve user preferences:
this.radius = widgets["Radius"].getValue(); // RMathLineEdit
/*
* Add additional parameters here
*/
// Save persistent dialog entries and finish:
WidgetFactory.saveState(dialog);
dialog.destroy();
return true; // Dialog accepted
};
Code: Select all
// Show Dialog and terminate tool if canceled:
if (!this.showDialog()) { // When the dialog was rejected
return; // Return to terminate in beginEvent
}
// -> Continue with the dialog accepted
var unitCombo = this.dialog.findChild("OutputUnitsComboBox")
While this does the same: var unitCombo = widgets["OutputUnitsComboBox"];
There are other odd/wrong things in this "Shaper" code too, I would refer to well established QCAD resources: https://github.com/qcad/qcad
About CLOG ... Probably, but I have no purpose for it there whole the qDebug thing doesn't work on a Windows platform.
I know that I need to log that to a file but it doesn't work out because I can't reach the protected Programs area from within an OS command line.
I settled with using the EAction user messages/warnings, works immediate and I don't have to reload a log file each trial, each error, each ...
As last may I remark that there is an odd buddy declared in your UI file:
https://github.com/marekw2143/krokus/bl ... C19-L12C19
Regards,
CVH