Results 1 to 19 of 19

Thread: How to fix the boundary..??

  1. #1
    Join Date
    Jan 2007
    Posts
    29
    Thanks
    6
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Smile How to fix the boundary..??

    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

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to fix the boundary..??

    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

  3. The following user says thank you to marcel for this useful post:

    deepusrp (7th May 2007)

  4. #3
    Join Date
    Jan 2007
    Posts
    29
    Thanks
    6
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: How to fix the boundary..??

    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..??
    Last edited by deepusrp; 7th May 2007 at 06:47. Reason: updated contents

  5. #4
    Join Date
    Sep 2006
    Posts
    339
    Thanks
    15
    Thanked 21 Times in 16 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to fix the boundary..??

    Quote Originally Posted by deepusrp View Post
    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/designe...inwindows.html

  6. The following user says thank you to vermarajeev for this useful post:

    deepusrp (7th May 2007)

  7. #5
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to fix the boundary..??

    Well, how did you add your existing toolbar items in the first place?
    Could wee see the code?

  8. #6
    Join Date
    Jan 2007
    Posts
    29
    Thanks
    6
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: How to fix the boundary..??

    I got the Initial toolbar when i first started my new project using the default dialog.

    which file do u need...??

    Thanks

  9. #7
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to fix the boundary..??

    The one in which you add the toolbar items .
    And the UI file.

    regards

  10. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to fix the boundary..??

    Quote Originally Posted by marcel View Post
    1. Use setFixedSize( sizeHint() ), or layout()->setSizeConstraint( QLayout::SetFixedSize ) ( but this only if you have a valid layout set in your main window ).
    Quote Originally Posted by vermarajeev View Post
    Guys, he is using Qt3 and not Qt4 so stop giving him hints related to Qt4

    Quote Originally Posted by deepusrp View Post
    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.

  11. #9
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to fix the boundary..??

    Guys, he is using Qt3 and not Qt4 so stop giving him hints related to Qt4
    I guess I missed that little detail...

  12. #10
    Join Date
    Sep 2006
    Posts
    339
    Thanks
    15
    Thanked 21 Times in 16 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to fix the boundary..??

    Guys, he is using Qt3 and not Qt4 so stop giving him hints related to Qt4
    Sorry, I didnt see that

  13. #11
    Join Date
    Jan 2007
    Posts
    29
    Thanks
    6
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: How to fix the boundary..??

    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

  14. #12
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to fix the boundary..??

    Quote Originally Posted by deepusrp View Post
    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.

  15. #13
    Join Date
    Jan 2007
    Posts
    29
    Thanks
    6
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: How to fix the boundary..??

    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

  16. #14
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to fix the boundary..??

    Quote Originally Posted by deepusrp View Post
    I was able to drag, but was not able to drop.
    What did you try to drop it on?

  17. #15
    Join Date
    Jan 2007
    Posts
    29
    Thanks
    6
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: How to fix the boundary..??

    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.

  18. #16
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to fix the boundary..??

    Hmm.... what does it have to do with the toolbar?

  19. #17
    Join Date
    Jan 2007
    Posts
    29
    Thanks
    6
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: How to fix the boundary..??

    Quote Originally Posted by wysota View Post
    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!!!

  20. #18
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to fix the boundary..??

    Quote Originally Posted by deepusrp View Post
    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

  21. #19
    Join Date
    Jan 2007
    Posts
    29
    Thanks
    6
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: How to fix the boundary..??

    OOPS..!!!

    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.

Similar Threads

  1. Replies: 0
    Last Post: 2nd May 2007, 10:53

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.