Qt-interest Archive, April 2007
how to use a placeholder in qt designer?
Message 1 in thread
hi, all
have anyone once used placeholders in qt designer?
i use a QFrame as a placeholder in a .ui file , then i want to replace it
in my app. then i find that i konw nothing about replacing.
give me some suggestions
thank you
regards
fengli
Message 2 in thread
Hi,
ååä wrote:
> have anyone once used placeholders in qt designer?
> i use a QFrame as a placeholder in a .ui file , then i want to replace
> it in my app. then i find that i konw nothing about replacing.
> give me some suggestions
Why not just add your widgets as children of the placeholder? Or do you
mean that you can't work out how get hold of a pointer to the placeholder?
Tim
--
[ signature omitted ]
Message 3 in thread
I used to do this in QT 3, when the "custom widget" support in designer was less then supurb. However, in QT 4, its pretty trivial.
Add a the base type (in your case it would be QFrame) and right mouse on it, "Promote To Custom Widget" (or something like that :)) and type in the name of your class, and the header its defined in.
Then the ui_Class.h file will construct one of them and include the header file for you... It works rather well.
That said, you can still use the placeholded method, in a very similar way that you use it with MFCs RC based dialogs, except its even easier.
First, name the frame to something meaningful (as opposed to frame_1 et)
Then depending on the type of layout the parent has, you will need to find the frame in the layout, if there is no layout, you dont need to do this, just construct your frame and positon it use move()
Finding it in a box layout, you can use findWidget, store the positoion, delete the placeholder, and insert the new object at the position.
Finding it in a grid is the same, but yoru storing 2 locations row and column.
Now, If I understood you completely wrong, and this is not what you needed... just ignore :)
Happy Friday!
Scott
________________________________
From: ??? [mailto:zhangfenglisdu@xxxxxxxxx]
Sent: Fri 4/13/2007 7:33 AM
To: qt-interest
Subject: how to use a placeholder in qt designer?
hi, all
have anyone once used placeholders in qt designer?
i use a QFrame as a placeholder in a .ui file , then i want to replace it in my app. then i find that i konw nothing about replacing.
give me some suggestions
thank you
regards
fengli
--
[ signature omitted ]