Results 1 to 11 of 11

Thread: Reducing width of maintoolbar

  1. #1
    Join Date
    Nov 2013
    Location
    Chandigarh, India
    Posts
    62
    Thanks
    8
    Thanked 11 Times in 7 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Reducing width of maintoolbar

    I want to reduce the width of maintoolbar in my gui app and I have tried something like this..

    Qt Code:
    1. ui->mainToolBar->setFixedWidth(400);
    To copy to clipboard, switch view to plain text mode 

    But still the entire toolbox is visible on the main window. Here is its image.


    img1.jpg


    I wish to do something like this...

    img2.jpg

    Can anyone help me out ??
    Last edited by aaditya190; 18th December 2013 at 11:02.

  2. The following user says thank you to aaditya190 for this useful post:

    ebirdseystew (18th December 2013)

  3. #2
    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: Reducing width of maintoolbar

    You mean you want the background to be white? It would look very bad...
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  4. #3
    Join Date
    Nov 2013
    Location
    Chandigarh, India
    Posts
    62
    Thanks
    8
    Thanked 11 Times in 7 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: Reducing width of maintoolbar

    Yes @wysota.. is there some way to do so? If yes, please help me out....

  5. #4
    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: Reducing width of maintoolbar

    The toolbar filling the whole width of the main window is a standard Qt behaviour. You can probably override it by not using QMainWindow but rather placing the toolbar manually on the widget but that's not very convenient. What do you need such behaviour for?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #5
    Join Date
    Nov 2013
    Location
    Chandigarh, India
    Posts
    62
    Thanks
    8
    Thanked 11 Times in 7 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: Reducing width of maintoolbar

    @wysota, i just want to keep the size of toolbox till the place where the last icon is finished. Just like I posted in my first thread. If it is possible, Can you please help me out??

  7. #6
    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: Reducing width of maintoolbar

    Quote Originally Posted by aaditya190 View Post
    @wysota, i just want to keep the size of toolbox till the place where the last icon is finished.
    I'm asking WHY you want that.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  8. #7
    Join Date
    Nov 2013
    Location
    Chandigarh, India
    Posts
    62
    Thanks
    8
    Thanked 11 Times in 7 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: Reducing width of maintoolbar

    @wysota, because the entire right hand side of toolbox will remain empty .. So I want to remove that blank space rather than displaying it. Is there a way possible? Please help me out if yes..

  9. #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: Reducing width of maintoolbar

    Yes. You just need to implement your own toolbar positioning. And you still didn't tell me why you want that.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  10. #9
    Join Date
    Nov 2013
    Location
    Chandigarh, India
    Posts
    62
    Thanks
    8
    Thanked 11 Times in 7 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: Reducing width of maintoolbar

    @wysota, the space to the right hand size of the last icon is entirely vacant, I want to remove that vacant space because it is just occupying the screen without displaying anything. Can any code help out instead of toolbar positioning? I tried playing with the geometry of it but no change is visible.

  11. #10
    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: Reducing width of maintoolbar

    If you remove the toolbar from there, the space will still be "vacant", it will just look ugly. So I don't see the point of the whole operation. If you don't want a toolbar then don't use a toolbar, put a row of buttons on your form. It will look less ugly than a broken toolbar.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  12. The following user says thank you to wysota for this useful post:

    aaditya190 (20th December 2013)

  13. #11
    Join Date
    Nov 2013
    Location
    Chandigarh, India
    Posts
    62
    Thanks
    8
    Thanked 11 Times in 7 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: Reducing width of maintoolbar

    Thanks a lot @wysota... I am stuck at a problem. I have a plaintextedit on the left hand side. I wish to pass the text written in the PlainTextEdit to the compiler. Is it possible ? If yes, please help me out. I have posted this problem no. of times but didn't get a fruitful reply....Please help me out if there is some way to do this.
    Last edited by aaditya190; 20th December 2013 at 07:30.

Similar Threads

  1. How to hide the mainToolBar automatically?
    By drunknight in forum Qt Programming
    Replies: 7
    Last Post: 3rd December 2013, 13:30
  2. Reducing CPU Usage
    By Kapil in forum Qt Programming
    Replies: 8
    Last Post: 3rd April 2011, 14:43
  3. Replies: 3
    Last Post: 5th August 2009, 21:15
  4. Reducing deployment size
    By zoharl in forum Installation and Deployment
    Replies: 3
    Last Post: 11th March 2008, 20:16
  5. Reducing latency in mouse moves
    By PhilFM in forum Qt Programming
    Replies: 4
    Last Post: 6th September 2007, 09:38

Tags for this Thread

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.