PyQT Dialog Window with Toolbar - dialog

What is the standard approach of adding a toolbar to a dialog window in PyQT? I seem to be able to add toolbars only to a main window class.

Unfortunately this feature doesn't seem to be supported. See
Can you add a toolbar to QDialog? for answers to the same situation but in C++ and Qt.
However maybe you can just use a QMainWindow as a dialog window with a toolbar?

Related

Caption bar not being repainted in MFC

Alright, I'm using VS2012 with MFC in Windows 8 and I'm having a problem.
Let's say I have a very simple dialog in my application. When I click on a different window (for example on the Taskbar), the caption bar color indicates that the dialog is still focused!
This problem happens in several cases. For example, when I use CFileDialog to select some files, after closing the dialog, caption bar color indicates that the dialog is still inactive while it's automatically focused after closing the open dialog!
Now let's say I have two dialogs in my application. Dialog A is my primary dialog and I use a button to show modal dialog B. In standard applications, if I click on dialog A, dialog B caption bar flashes. This doesn't happen in my application and I think it's because of a bug in MFC.
Any ideas how to fix this problem?

How to skin MFC main menu

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 :)

Popup menu in toolbar MFC

I am created toolbar in MFC, now I am trying to add pop-up menu on one of button. Can anyone please give me some hint for doing this.
Infact I am not getting how to show the down arrow which used to attached with the toolbar buttons.
Thanks
see this http://msdn.microsoft.com/en-us/library/1ke6s1fc(v=vs.80).aspx
for creating the pop-up menu I have gone through overriding this function.
afx_msg int OnCreateControl(LPCREATECONTROLSTRUCT lpCreateControl);

how to add a custom mfc control to the dialog window?

I've derived a class from CStatic in MFC. But I don't know how to add it to my dialog window.
This mfc application that I'm working on is a dialog based application.
In Gtk+ or Qt we could use layouts and add our widgets to them, but in mfc it doesn't seem to be such a mechanism. I'm wondering how is it possible for an custom made control to be added to another GUI element!!!
Please give me a simple example if you can.
thank you
I think the technique you are looking for is subclassing (MSDN).
There is a good sample on that page too.

QToolBar: Is there a way to add QAction to a QToolBar in QtDesigner?

I've a PyQt4 Installed on Python 2.6. I wish to insert actions or widgets into a toolbar in QtDesigner instead of adding them in code, with addAction or addWidget (as simple as adding actions to a menu in design time).
You can add actions by dragging them to your tool bar from the "Action editor" dock window. You cannot add widgets to the tool bar in Qt Designer, I'm afraid you'll have to do this from your code.
You can create your own widget plugins with new or extended functionalities.
Just follow the definition rules from the documentation .
I use a lot of custom widgets inside the Qt Designer.
Once you have figured out, how it works, it becomes a really power full method for your design work flow inside Qt Designer.

Resources