PDA

View Full Version : Managing Widgets that aren't on the top level



prusikknot
19th April 2010, 16:51
I have a question about managing widgets that won't be on the top level. I'm writing in PyQt but since no one answered this question on the pyqt forum I'm hoping someone can tell me how to do this in Qt and I'll convert it to PyQt.

In the top level I have QPushButton("convert") and QPushButton("converter options"). There are multiple converters and the "converter options" button pulls up a dialog box to select the algorithm and set the algorithm options. Each converter is it's own widget and includes the methods for the conversion. When the "convert" button is clicked, it calls the conversion algorithm that was selected by the "converter options" dialog.

What is the best way to program this? My original plan was to store the converter options dialog in the main function and just show it when needed. Here is the psudeo code:

main
pbConvert=QPushButton("convert")
pbConvertOptions = QPushButton("converter options")

connect(pbConvert, "clicked", convert)
connect(pbShowConvertOptions,"clicked", showConvertOptions)

//create a dialog to manage the converters
convertManagerDlg = converterManagerDialog()

function convert
//run the conversion for the algorithm selected in the options widget
convertManagerDlg -> runConvert()

function showConvertOptions
convertManagerDlg->show

Is there a better way to manage the converters?

Brian