PDA

View Full Version : How to fix the boundary..??



deepusrp
6th May 2007, 19:02
Helo sir,

1. I want to fix up the boundary of my application(outer form) so that no one can change the horizontal or vertical size. How can i do that.

2. I have used the default dialog while creating my project, it gives option to have the toolbar item. At that time i have coosen only few items. Can i add some more toolbar item. If so how. (I dont want to redo the entire design now)

A piece of code will help me a lot...

Thanks a lot :)

marcel
6th May 2007, 19:27
1. Use setFixedSize( sizeHint() ), or layout()->setSizeConstraint( QLayout::SetFixedSize ) ( but this only if you have a valid layout set in your main window ).

2. Do you want to add items to your existing toolbar or add a new toolbar?
Adding a toolbar can be done with QAminWindow::addToolbar() and adding items can be done easily if you have the instance of the existing toolbar( I guess you should be able to get it from the UI ).

For code snippets and detailed description you can look at the above functions in Qt Assistant.

Regards

deepusrp
7th May 2007, 06:43
THanks sir,

I'll try it and then reply u sir

I want to add new icons to existing tool bar.

Lets say i have added fileNew, fileOpen, fileSave by default; Now i want to add editCut, editCopy and so on. Can i do this with the help of UI. If so how..??

vermarajeev
7th May 2007, 06:56
THanks sir,

I'll try it and then reply u sir

I want to add new icons to existing tool bar.

Lets say i have added fileNew, fileOpen, fileSave by default; Now i want to add editCut, editCopy and so on. Can i do this with the help of UI. If so how..??

Try this
http://doc.trolltech.com/4.2/designer-creating-mainwindows.html

marcel
7th May 2007, 07:08
Well, how did you add your existing toolbar items in the first place?
Could wee see the code?

deepusrp
7th May 2007, 08:55
I got the Initial toolbar when i first started my new project using the default dialog.

which file do u need...??

Thanks

marcel
7th May 2007, 08:57
The one in which you add the toolbar items :).
And the UI file.

regards

wysota
7th May 2007, 13:14
1. Use setFixedSize( sizeHint() ), or layout()->setSizeConstraint( QLayout::SetFixedSize ) ( but this only if you have a valid layout set in your main window ).


Try this
http://doc.trolltech.com/4.2/designer-creating-mainwindows.html

Guys, he is using Qt3 and not Qt4 so stop giving him hints related to Qt4 :)


1. I want to fix up the boundary of my application(outer form) so that no one can change the horizontal or vertical size. How can i do that.
Set the resize mode of the layout to QLayout::Fixed (it can be done from within Designer (although I'm not sure you can do that for QMainWindow) or using hand written code).


2. I have used the default dialog while creating my project, it gives option to have the toolbar item. At that time i have coosen only few items. Can i add some more toolbar item. If so how. (I dont want to redo the entire design now)

Did you use Designer for that? If so, then reopen the form and drag actions from the action editor to the toolbar where you can drop them.

marcel
7th May 2007, 13:35
Guys, he is using Qt3 and not Qt4 so stop giving him hints related to Qt4


:) I guess I missed that little detail...

vermarajeev
8th May 2007, 05:15
Guys, he is using Qt3 and not Qt4 so stop giving him hints related to Qt4 :)

Sorry, I didnt see that

deepusrp
8th May 2007, 12:07
then reopen the form and drag actions from the action editor to the toolbar where you can drop them.


I tried that one, but it didn't work. No problem as i took a piece of code from an existing file(somefile.ui) and pasted in my .ui file, its working fine.

But can u please tell me exactly which property i have to change ant to what value in the designer so as to get the fixed boundry. I am not using any layouts explicitly. Is it by default Qt creates a layout for an application.

Thanks a lot :)

wysota
8th May 2007, 12:22
I tried that one, but it didn't work.
Meaning? You couldn't drag, couldn't drop or drop didn't do anything?


But can u please tell me exactly which property i have to change ant to what value in the designer so as to get the fixed boundry. I am not using any layouts explicitly. Is it by default Qt creates a layout for an application.

I think I already said that. The property is called "resizeMode" and the value is "Fixed". If it doesn't work for a QMainWindow, you'll have to do it from within code on your central widget layout (for example from within init() or subclass constructor). You can also set the size policy of the central widget (from within code) to Fixed, but results will be a bit different.

deepusrp
10th May 2007, 04:16
Hi


Meaning? You couldn't drag, couldn't drop or drop didn't do anything?

I was able to drag, but was not able to drop.


The property is called "resizeMode" and the value is "Fixed". If it doesn't work for a QMainWindow, you'll have to do it from within code on your central widget layout (for example from within init() or subclass constructor). You can also set the size policy of the central widget (from within code) to Fixed, but results will be a bit different.

I'll try this and then reply

Thanks a lot

wysota
10th May 2007, 11:33
I was able to drag, but was not able to drop.

What did you try to drop it on?

deepusrp
12th May 2007, 08:30
Helo sir,

Actually i got what exactly i wanted. I was asking that bucause when i tried to resize using the border the border was covering the widgets. so i wasasking. now i grouped those widgets. Its working fine..

Thanks for all those have helped me.

wysota
12th May 2007, 08:48
Hmm.... what does it have to do with the toolbar?

deepusrp
12th May 2007, 12:23
Hmm.... what does it have to do with the toolbar?

I told that day itself, I copied the contents from an existing project and modified that to mine and its working.

Initially when i created the ui using the dialog option, i gave only filenew, file open, and file save as toolbar elements. When i tried to add edit menu items, i was unable to drag and drop from edit menu. So i asked. Then i saw the code of some existing project, i copied the code and pasted in my some.ui; it worked!!!

wysota
12th May 2007, 13:35
When i tried to add edit menu items, i was unable to drag and drop from edit menu.

You should drag from the action editor, not the menu in the form!

The action editor is depicted on the bottom of this page:
http://doc.trolltech.com/3.3/designer-manual-15.html

deepusrp
17th May 2007, 04:41
OOPS..!!! :rolleyes:

I didn't know that... Some one told me that so i tried...

Thanks a lot for guiding.... The project now is at the final stage... Thanks for all who has guided me.