I have this main window on which I would like to put 2 widgets on the same space, i.e. when the user clicks a button then one of the widgets should come up front and the other be hidden and then change places when clicking another button.
My Widget are of different types: one is a QGLWidget and the other one is a QGraphicsView.
How could I put these 2 widgets on the same place?
Use QStackedWidget. Qt Doc says that :
The QStackedWidget class provides a stack of widgets where only one
widget is visible at a time.
Related
I have a window in mono gtk#, which has lot of VBoxes & HBoxes. These boxes contain some buttons, labels, and some other widgets also. Now I need to make this window alone to transparent.
I created one drawingArea by referring zetcode page.
But inside this drawing area I'm not able to do the arrangements of my widgets, one Move function is available, but it is not much use for me. So how do I do widget arrangement neatly inside a drawingArea?
I am inheriting the maintenance of a few stacks.
I have two stacks called “AI Frames 5.0” and “Flex Frames 5.0”. I thought the two stacks were nearly identical. Not the case. Option menu buttons are behaving differently between the two. STACK properties between the two stacks are the same. BUTTON properties between the two stacks are different.
The button on “AI Frames 5.0” has a property inspector title of button “Lamps” and HAS the Menu Items list that can be updated.
The button on "Flex Frames 5.0" has a property inspector title of card button “Lamps” and does NOT contain the Menu Items list.
If I drag out an option menu button onto each of the stacks, the new buttons “Look” the same but their properties are not the same – one is a card button, one is a button. (Same thing happens for other field types dragged onto stack.)
When I look at the project browser the buttons are listed in the tree in different locations. (image of project browser is included 1)
AI Frames 5.0
|_ AIFrmEst
|_ Button1
Flex Frames 5.0
|_ FlxFrmEst
|_ Button1
Is there an explanation to all this? My main problem is that I need to change the menu options for the button on the “Flex Frames” stack. How can I get “Flex Frames” stack to be similar to the “AI Frames” stack?
What happens if, from the Message Box, you do this:
set the text of btn "lamps" to "This"&cr&"That" -- replace with your desired list
I recently updated some very old stacks (Rev2.something) and buttons were all listed as "card buttons" in the browser, and fields as "bkgnd fields". Cloning the stack brought everything back to normal, tho I don't know if it will fix the button style as you want.
I got a menu in an existing MFC application that has a standard MFC main menu.
But I would like to change its background colour so that it appears to more seamlessly belong to the rest of the application.
First picture: An MFC main menu. The application is skinned blue, as seen in the toolbar, but the menu is still standard grey background colour.
Second Picture: Spotify's menu, skinned to fit into the rest of the
colors.
I have not found any examples on anything similar. Could you please point me towards how to achieve this?
Approaches I thought of:
Subclassing CMenu to my own SkinnedMenu, but it is not created by our code but by a GetMenu() call in a mainframe class deriving from CFrameWnd. The only thing I can find here is its method signature, defined in afxwin.h so then how could I make use my own subclassed menu?
Removing the entire menu and add my own custom menu buttons, in a row, making it look like a menu. Maybe this is what spotify have done, as they have also removed the Windows window frame.
Editing the existing CMenu in some way, but the only customization I am able to find right now is modifying its MENUINFO. For example if I set info.hbrBack = skin.GetSysColorBrush(COLOR_MENU) the only colour that changes is the background of the dropdown, not the main menu itself.
Other :)
I like the default handling/layout that adding a dock widget to the main window with addDockWidget() provides. Specifically the following:
Uses a QSplitter (I assume) which allows user to resize 2 dock widget and central widget.
Cannot shrink the dock widget below it's minimum size hint.
When dragging the size of the entire window the dock widget stays it's original size (i.e. it's different than dragging the splitter). Thus, the central widget grows when dragging the entire window instead of both dock and central widget growing.
I'd like to mimic this behavior, but on a QDialog since I can't just call addDockWidget(). I'm not really concerned about being able to drag the dock widget around and drop it on other corners, etc. I just want a QLayout setup that can do the above 3 things.
You can use a QMainWindow instead of a QDialog in order to get dockwidget functionality for a dialog. You should not notice any difference in performace between QMainWindow and QDialog.
I'm trying to figure out a way of using Qt Designer to make a dynamic GUI. For example, let's say I have a main window with a horizontal layout. I have a push button on one side and an empty area on the other. When I click the button the empty area will be filled with a widget that I've made in Qt Designer. When the button is pressed again the widget will be replaced with another widget that I've made in Qt Designer. Would I have to go about making all my widgets, to fill the empty area, custom widgets?
I've tried setting the parent to the empty are, but on the second change I get this
QLayout: Attempting to add QLayout "" to QWidget "t2", which already has a layout
So then I tried deleting the layout but still see the old widget underneath the new one and the layout is now messed up.
help please
Never mind, figured it out. Simple really. Use QStackedWidget and as for the UIs made in Qt Designer wrap that in a class that inherits from QWidget.