PDA

View Full Version : Some Questions



vimal
23rd June 2012, 12:55
1.Can be edit the ui extension file outside the qt designer....in any editor??If yes then what step will take.

2.ClassA
{
.....
.....
};
Class B : Q_Object
{
...........
..........
};
Can be do the singnal and slot mechanism between these classes if yes then how.

3.Can we use both horizental and vertical layout in the same dialog.Can be use the horizental layout twice in a dialog.If yes then what error will occcur.

folibis
23rd June 2012, 13:41
1. ui is XML file, you can edit it with any text editor
2. classA must inherit from QObject and mast have O_OBJECT macro. in one class you define signal and in other one define slot and connect signal to slot.
3. here i cant understand what is a problem

sedi
23rd June 2012, 18:11
3. You can't use one specific layout twice but you can use as many layouts and sub layouts, horizontal, vertical or grid, as you want. I think you may need child Widgets to apply the sub layouts in that way:

(This is NO Qt code!)

topWidget
-> topVerticallayout
-> rowWidget1
-> horizontalLayout1
-> columnwidget11
-> columnwidget12
-> rowWidget2
-> horizontalLayout2
-> columnwidget21
-> columnwidget22
-> rowWidget3
-> horizontalLayout3
-> columnwidget31
-> columnwidget32

This very symmetrical structure, though, is normally better done with one gridLayout, which is very flexible.

vimal
23rd June 2012, 18:26
Hi
Thnaks for reply.........1.but if we edit the XML file in any editor then to reflect the change we should compile it in QT designer.
2.I also think that without the help of Q_object we can't use signal and slot........
3.Why we can't use one specific layout twice

wysota
23rd June 2012, 18:33
Thnaks for reply.........1.but if we edit the XML file in any editor then to reflect the change we should compile it in QT designer.
Designer doesn't compile anything. If you modify the ui file externally (which you shouldn't do), you don't have to open it in Designer.


2.I also think that without the help of Q_object we can't use signal and slot........
Without Q_OBJECT you can't use signals and slots.


3.Why we can't use one specific layout twice
You can use the same layout class (or different ones) as many times as you want.

sedi
23rd June 2012, 18:36
Because it is only one instance. But you can instantiate as many layouts as you wish:
QHorizontalLayout *hLay1 = new (QHorizontalLayout());
QHorizontalLayout *hLay2 = new (QHorizontalLayout());
QHorizontalLayout *hLay3 = new (QHorizontalLayout());
and use them. But you can't use hLay1 twice.

You can't drive the BMW that your wife wants to take. That would lead to serious trouble when she tries to get in and take a seat (she'd crash). But you are always allowed to buy a similar one - depending on your ressources of course. Luckily memory is cheaper than bavarian cars.