This is my first question in this community. I always search a lot when having problems and I always find an answer. But not in this one. Maybe I am not asking Google correctly.
Anyways this looks like a bug to me but I might get it wrong.
Using VS2012 (or 2013) I create the default Multiple documents MFC application. I do not write a single line of code. I compile and run. Then as a user I dock the properties window which by default is at the right to the output window as shown below .
Then I close the application and restart. The window is where it should be but with different width as shown below
If you dock the window to the right (in the view and not in another window) then there is no problem. The position and width are restored just fine. Also this only happens if the main window is maximized. The behaviour, if the main window is not, is as expected.
Do you think it is actually how Microsoft wanted to make this work or they missed that? Is there a workaround for this?
Again forgive me if this question has been asked before but really...
I couldn't find anything.
Appreciate any kind of help.
Related
I found a weird behaviour of QDockWidget when I tried to insert it into own application. The problem is that after dragging border of widget, it size goes back, so I can't change its size. So then I opened official qt example. But the same problem exist in this example. You can see it below. (After undocking and docking again problem disappears)
Another KDE applications in my system doesn't have such bug, so I think there is some function in Qt wich fixes this problem. Please help me to fix this example.
The only thing you need to do is to call QMainWindow::resizeDocks. After that the bug will disappear.
I am using QSystemTrayIcon for the first time, and it was trivial to implement. My code looks like this:
if(!connect(mTrayIcon, &QSystemTrayIcon::activated, this, &MiniStudio::onTrayActivated)) {
qWarning()<<"ERROR: could not connect QSystemTrayIcon";
}
mTrayIcon->setIcon(QIcon(":/icons/record.svg"));
mTrayIcon->setToolTip("Show MiniStudio controls");
mTrayIcon->setContextMenu(nullptr);
mTrayIcon->show();
As you probably understand from my code I don't want to display a context menu, I simply want a button in the tray that when clicked shows my application window.
The code sort of works, however, even if I specify a "nullptr" context menu, there still is a strange-looking box appearing under my tray icon whenever I click it, as if there is a context menu without any items in it (please see screenshot below).
So my questions are:
Am I doing something wrong?
How can I make the strange box go away?
Is this a bug, or maybe a feature of Qt on my platform?
PS: I am developing this code for Ubuntu 16.04 amd64 but I think the answer to this question should be relevant to any platform.
NOTE: I have also tried just omitting the setContextMenu() call instead of calling it with nullptr, and that didn't work either. The result was exactly the same.
Any input welcome,
Thank you!
I'm new at programming and I just downloaded C-free 5.0 software. I just compiled a program, it showed that the program has 5 errors. But I can't find a way to see what errors and where. Any help will be appreciated.
They will probably be in a dock window called "build". Like all other IDEs, you may need to use the menu to open that window first. If the window is already open, scroll up.
The build dock window is the one at the bottom, in this screenshot:
There are a lot of articles related to customizing main menu of the dialog window on, including "custom-drawn" menus. But none of them seem to answer my question.
I have a (borderless) window that has a custom-drawn by hand title bar:
I need to display somehow a main menu under this "fat" title bar. How could I do this, using MFC? By default "native" menus seem to be able to be located only in the top of the client area of the dialog window (or am I wrong here?). Is there any solution for my problem?
If someone could give some links related to my issue, I'd greatly appreciate this! I've seen a lot of products that implement this, for example Ontrack comes on mind, but never met any explanation on how this was achieved.
Thank you!
I need to display somehow a main menu under this "fat" title bar.
That's precisely where it is being drawn, according to the image you posted.
By default "native" menus seem to be able to be located only in the top of the client area of the dialog window (or am I wrong here?).
No, that's correct. The menu will be automatically drawn where menu bars belong: at the top of the window, just below the title bar.
You've decided to mess up the defaults and throw usability of your application to hell by reimplementing the non-client area. That means you can't rely on Windows to draw these elements for you. Instead, you'll need to take responsibility for drawing all of these things yourself, which requires you to write code to do so. I don't know what "Ontrack" is, but any application that does this is owner-drawing its menus.
Another popular option (used by Internet Explorer for a while) is to create your own menu-like object using a rebar control. This has the advantage of integrating into an existing toolbar control and allowing the user to rearrange items as desired. It, like writing your own menu control, has the disadvantage of not conforming to standard platform conventions and user expectations (although it's probably a lot better than whatever you can come up with yourself). There's a how-to article here on MSDN.
I suspect that in undertaking this project you've probably bitten off more than you can chew. Keep in mind that there's hardly ever (if even that) a reason to draw your own title bar. As you're seeing, conforming to your platform's standard expectations is often easier on the programmer and far better received by your users.
I always been interested on how we can accomplish this (hide/show the main menu using the alt key), and now some applications do this very often. One that really please me is the visual studio 2010 with this plugin:
http://visualstudiogallery.msdn.microsoft.com/bdbcffca-32a6-4034-8e89-c31b86ad4813?SRC=VSIDE
(firefox also do this, but i think that is in a different way)
Can anyone explain me how this can be achieved or if you known of any sample project that demonstrate this please tell me.
(what i can see in some replies here in stack is that we have to destroy the menu when is to hide and create it when is to show?! but this seems a bit bad solution...)
Thanks
The SetMenu function lets you add/remove the menu from the window. It does not destroy the menu.
Note that most applications which have the dynamic menu hide/show behavior are not really showing a menu. They're showing a custom control that looks like a menu.
You might also take a look at MFC support for auto hiding menus. I used this technique and it worked really well.
in CMainFrame::OnCreate I did
m_wndMenuBar.ShowWindow(SW_HIDE);
which actually works fine in our project
I stumbled across a related pit fall that will show a hidden main frame without your consent:
Whenever the focus for a child window in an MDI application changes (e.g. due to right clicking in it), the function CMDIChildWnd::OnMDIActivate will be called, which in turn shows the main menu (even if it was removed or destroyed previously) of the MDI application.
This works basically by adding the saved main manu from the underlying's CMDIChildWnd m_hMenuShared variable.
A quick&dirty hack to prevent this, is setting m_hMenuShared to NULL (it's protected in CMDIChildWnd so this needs a custom derived child class of CMDIChildWnd) for all child frames.