PDA

View Full Version : Initialise toolbar in a different area



georgie
4th May 2006, 01:34
I would like for my toolbar to be movable (i.e. I can't just set one area only to be the allowed area), but to start off in the right toolbar area instead of the top....

I am using QT 4.1

I tried set orientation, but that keeps the toolbar in the same position, just changes the position of the moving handle....

I also tried

this->setCorner(Qt::BottomRightCorner, Qt::TopDockWidgetArea);

but I get an assert failure


ASSERT failure in QMainWindow::setCorner: "'area' is not valid for 'corner'", file widgets/qmainwindow.cpp, line 452
Aborted

and I can't 100% tell if it is the function I want anyway....because it seems that I can't specify a single toolbar to be in a different position to the other one.....

thanks :)

init2null
4th May 2006, 02:11
To position a toolbar on the right, just can just use
addToolBar(Qt::RightToolBarArea, toolBar);
Is that what you wanted?

georgie
4th May 2006, 02:50
that's cool....it is about 95% what I meant....and I will totally use it if I can't find exactly what I want (i looked and looked through the docs, but because I was coming at the prob with preconceptions of what the solution would be, I was looking in the wrong place --- always seems to happen when I think I'm right :p)

I didn't describe it very well....so I have attached a pic which kinda describes what I want better

I know it is a pretty trivial change....but I think it makes a difference because it uses less screen real estate and makes the whole thing less cluttered.....

thanks

init2null
4th May 2006, 03:38
I tried different ways of making it work like your mockup, but I couldn't. There is one option, although it probably won't be one you like.


QWidget *w = new QWidget(toolBar);
w->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
toolBar->addWidget(w);

This puts in a spacer which will push all the following entries to the right or bottom.

georgie
4th May 2006, 03:49
.....mmm.....yeah.....i guess i'll have to think more seriously about exactly the functionality I want this to have.....seems trivial, but I really want to make this easy to use :)

thankyou so much for your effort.....it is definitely a solution which I will take into consideration