PDA

View Full Version : Reducing width of maintoolbar



aaditya190
18th December 2013, 10:46
I want to reduce the width of maintoolbar in my gui app and I have tried something like this..




ui->mainToolBar->setFixedWidth(400);



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


9866


I wish to do something like this...

9867

Can anyone help me out ??

wysota
18th December 2013, 14:26
You mean you want the background to be white? It would look very bad...

aaditya190
18th December 2013, 15:58
Yes @wysota.. is there some way to do so? If yes, please help me out....

wysota
18th December 2013, 16:43
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?

aaditya190
20th December 2013, 05:43
@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??

wysota
20th December 2013, 06:47
@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.

aaditya190
20th December 2013, 06:56
@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..

wysota
20th December 2013, 06:58
Yes. You just need to implement your own toolbar positioning. And you still didn't tell me why you want that.

aaditya190
20th December 2013, 07:03
@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.

wysota
20th December 2013, 07:06
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.

aaditya190
20th December 2013, 07:07
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.