I’m new to Qt development, am writing a level editor for a game I’m working on, and I’m having trouble with Layouts in the Designer.
Here’s what I want it to look like:
(I don’t have enough rep to post images, here’s a link:)
http://img855.imageshack.us/img855/6474/editori.jpg
There’s obviously going to be more buttons and things on the right, and stuff actually showing up inside the OpenGL canvas.
So I have two specific questions:
1) How do I set it up so that if the user re-sizes the window, the application re-sizes its contents appropriately? I can get close to what I want with by putting the buttons into a Vertical layout, then putting that and the OpenGLCanvasinto a Splitter layout, but that results in the canvas being the size width as the buttons, as opposed to the buttons being fixed to say, the right-most 100 pixels of the screen.
2) Is there an easy way to allow scrolling the canvas? The size of the level could potentially be much bigger than what can fit on the screen, so if that’s the case, I want to add horizontal and vertical scrollbars to the canvas. (if the level is too big or if the user makes the window small enough so it no longer fits. In the latter case, the scrollbars should only appear if it actually doesn’t fit). Is there an easy way to do this, or do I have to do everything manually?
Thanks!
If the contents are not being resized correctly, it sounds as though you may not have set a top-level layout. Also, are you sure you want to use a Splitter layout? I’m not sure what benefit that would give you in this case and it would make it possible to hide the buttons by resizing the canvas over them. Maybe you have a reason to prefer this though. Regardless, in Designer, I am able to create something similar to what you’ve shown that resizes correctly by:
By modifying this slightly, you should be able to scroll the canvas: