PDA

View Full Version : Qt dialog



franco.amato
6th February 2010, 21:06
Hi,
I'm trying to learn how to create and launch a dialog from my main application but I don't find valid tutorial or resources.
Can I have a help please?

Best Regards,
Franco

faldzip
6th February 2010, 21:56
It depends on what dialog do you want to have. If some simple warning or question then use QMessageBox's static methods (like QMessageBox::warning()). If it is not enough then either create your own dialog by subclassing QDialog and connecting some buttons or whatever you will have there to accept() and reject() slots of your dialog and then just create object of your class and call QDialog::exec() on it or you can create object of QDialog, set widgets and layouts to it (connect what you want to accept() and reject()) and call exec() on it.

franco.amato
6th February 2010, 23:25
It depends on what dialog do you want to have. If some simple warning or question then use QMessageBox's static methods (like QMessageBox::warning()). If it is not enough then either create your own dialog by subclassing QDialog and connecting some buttons or whatever you will have there to accept() and reject() slots of your dialog and then just create object of your class and call QDialog::exec() on it or you can create object of QDialog, set widgets and layouts to it (connect what you want to accept() and reject()) and call exec() on it.

Hi sorry but I don't understand. I would create a audio track list that used can drag and drop on the main application. I would use qtdesigner but it generates a .ui files. I never did this. Can you help me? Maybe with some examples?

faldzip
7th February 2010, 08:23
Hi sorry but I don't understand. I would create a audio track list that used can drag and drop on the main application. I would use qtdesigner but it generates a .ui files. I never did this. Can you help me? Maybe with some examples?

Ok, so where in this case you want to use dialog?

franco.amato
7th February 2010, 10:50
Ok, so where in this case you want to use dialog?

Hi, I would use the dialog when a user wants add files to the track list or when a user wants do some operation on a file of the track list.
For example a user press File->"Open From Track list"

squidge
7th February 2010, 12:34
Maybe you can draw a rough sketch of what you need and post it?

franco.amato
7th February 2010, 17:16
Maybe you can draw a rough sketch of what you need and post it?

Ok I try it.

When I press File->add to list as you can see in the image 1 4256 I would launch a dialog similar to this in the image 24257 but I'm unable to create the dialog. I would use designer to do faster but I saw that designer only create a *.ui file.

What I have to do with this ui file?

Best Reards,
Franco

squidge
7th February 2010, 18:01
You can use 'uic' to convert 'ui' file to '.h' file. This file contains a class with a function 'setupUi' that will create the ui you designed in QtDesigner.

franco.amato
7th February 2010, 18:15
You can use 'uic' to convert 'ui' file to '.h' file. This file contains a class with a function 'setupUi' that will create the ui you designed in QtDesigner.

Ah is there any tutorial on how to do it? Must I create a custom rule? I work with visual studio