Hover on dropdown menu - list

http://www.funky7inc.com/product/detroit-police
if you hover over the area where the dropdown is on "Detroit Apparel" the list pops up instead of only appearing when you hover over the nav.
any ideas how to fix this?

Sure, you only change the opacity of that <ul class="sub-menu">... So it is actually always there, only 100% seethrough... But you can still hover over it which changes the opacity back to fully visible.
I don't know how you change this (CSS:hover of Javascript or something, I tried looking but you have minified CSS) but you can solve this by not changing just the opacity but also the display:block to display:none so it is actually gone, or use javascript $(".sub-menu").hide() or .FadeIn()/fadeOut() or something similar...

It is because you are changing the opacity of the drop down list. Opacity:0 still registers mouse over event.
Instead use visibility property or display:none
When you will hide the drop down using visibility or display:none, drop down list would not register mouse over and hence the list would not show up till the time hover is on the navigation bar.
Hope this helps.

Related

Is it possible to disable the light-blue mouse over highlighting on a QTreeWidgetItem?

I've a QTreeWidget and need to disable the mouse over highlighting on the childItems but not the click selection. The point here is, that I need to set this per Item because some are selectable. I was thinking about the QTreeWidget::itemEntered signal to check if the item should be highlighted or not but I can't get it to work because the description says
QTreeWidget mouse tracking needs to be enabled for this feature to
work.
and I can't figure out how.
So my questions for are: How can I enable mouse tracking?
Is there an easier way to disable the highlighting?
Simply invoke setMouseTracking() to enable mouse tracking for a specific widget.
I ran into this problem (I know this is an old post, but I might as well post my solution, since it can be useful for others).
I could not properly disable the mouse feedback while keeping the mouse tracking enabled, but I could make this feedback invisible. I'm using qss stylesheets, and I set the mousehover feedback color to transparent:
MyTreeWidget::item:hover {
background-color: transparent
}
It did the trick for me. Sadly it makes the feedback invisible all the time, rather than allowing to turn it off and on.
So as a next step, for when I needed it, I implemented my own feedback by using a delegate and overwritting the paint function.
The QTreeView overwrite mouseMoveEvent and sends mouse coordinates to the delegate. This way, the delegate can adapt what it does in paint to this position. It feels pretty heavy, and a bit dirty, but it works. Delegate should also allow to have different behavior for different items.
PS: If you're using a delegate, in most cases, that should be enough without the qss change. In my case it wasn't, because I call QStyledItemDelegate::paint in my overwritten paint method, so I inherited some unwanted behavior.

MFC Print Preview 'Prev' button not enabling when used with Objective Grid from Rogue Wave - Stingray Studio

I have an MFC app that uses Rogue Wave's Stingray Studio Objective Grid to display a dialog with a grid in it. When doing a print preview, the grid uses the MFC print preview mechanism to generate the print preview dialog. On the dialog I see all the buttons you would expect, including next and previous, and zoom in and zoom out. I have more than one page worth of data in the grid and so I see a scroll bar on the right, the Next button is enabled and the previous button is disabled. If I click on the next button, the dialog advances the preview to the next page of the data, and I see the scroll bar move down accordingly, but the Prev button does not become enabled. I can use the scroll bar to scroll in both directions, but the 'Prev' button never becomes enabled and the Next button never disables when I reach the last page. I see a similar problem with the Zoom buttons. I can zoom in, but the zoom out button never enables so I can never zoom out anymore.
Has anyone seen this sort of behaviour before and know what causes it?
So it would seem that my problem boils down to the toolbar not getting messages to refresh itself. It should be getting a WM_IDLEUPDATECMDUI whenever the preview invalidates itself, but it is not. A sample app I found is working correctly and it does get those messages. What I believe is happening in my situation is that My code is in a DLL for an app which I do not control, and when the app catches messages, it swallows certain ones, including this one. I was able to resolve the issue with a kludge. I find the preview window and in the OnPrint virtual function I send the message to it's toolbar. This works quite well, but it is not very pretty.

How can one set the background color of a property sheet

How can I change the background color of a property sheet? I can change the color of the actual pages by handling the WM_CTLCOLOR... messages but the tabs and other parts of the property sheet seem to be beyond my reach.
Might there be something in the callback?
Here's what it looks like when I handle the WM_CTLCOLOR msgs in the page dialogs.
Tab controls are notoriously difficult to work with. You will likely have to implement an owner-drawn tab control to get the level of customization that you want.

MFC add scrollbar to CWnd member

I have a member of CWnd class name mywindow
and i want to add to it a scroll-bar.
how i can do it?
i try already to do:
mywindow.EnableScrollBarCtrl(SB_BOTH,TRUE);
it display both Horizontal and Vertical scroll-bars,
but i cannot push the buttons or move the scroll-bars.
i try also after the first command:
mywindow.EnableScrollBar(SB_BOTH,ESB_ENABLE_BOTH);
and it change nothing.
can someone could show me a simple example how to add scroll-bar to this member?
thanks a lot,
Tal
Enabling the scroll bars isn't enough. You have to react to the window messages WM_HSCROLLand WM_VSCROLL. Using the GetScrollInfo method you get the position (value) of the scroll bars and then you draw your window content according to this position.
Look up some scroll bar tutorials such as http://www.codeproject.com/KB/dialog/scrolling_support.aspx . In essence, dwo's comment above is what you need to do - handle those messages and set the virtual client area size.
There must be some 'overflow' before scroll bars became active.
Write some 'sufficiently long' data in your view and the scrollbars will become active (at least, that was my experience time ago).
Usually scroll bars get handled 'automatically' from MFC components like (for instance) text editor or form view. I.e. will became visible when needed also without explicit call EnableScrollBarCtrl ...

Positioning QPushButtons via qss in QT

I have a set of five buttons that I am trying to position in a qss file. The default position that I have set up in the ui file works for one of the layouts I need. However, I want to group the buttons differently in the other theme.
I am new to qss files and have been experimenting, but cannot figure out if some things are possible. The "left" property is defined here: http://doc.qt.io/archives/4.6/stylesheet.html#left-attr but nothing happens when I try to use it.
margin-left actually moves the button, but only relationally. So, if the buttons are positioned in the ui file with a gap of 100 between them, a margin-left for the second button in the list is offset by 100.
What am I doing wrong? Could it be some setting in the ui file that is preventing it from moving? I already "broke layout" and it doesn't seem to matter. Is there a good resource you'd suggest?
Here is a sample of my qss file. The left has no effect.
QPushButton#Button_1
{
min-width: 50;
max-width: 50;
min-height: 50;
max-height: 50;
position:absolute;
subcontrol-origin: border;
left:200;
}
EDIT:
I've figured out that I can change the position of the button by deriving a class from QPushButton and making a "GeomX" qproperty. This seems to work, but I am running into an odd issue now. When I first load my app, it draws the buttons as they are positioned on the ui file. When I use the "change theme" option that I've coded, and select the currently loaded theme, it moves the buttons as I'd expect. However, resizing the app dumps them back to the ui positions and restarting also places them back in their ui positions. Is there a setting in the ui file that I could alter to get it to stop moving them? Is there a load-order issue that I need to address? Is it possible to even address this? What is going on?
Generally speaking, style sheets in Qt are used to alter the way a widget is drawn, not where it is positioned (except to add padding/margin). As the documentation you've referenced mentions, the "left" property is specific to sub-controls (that is, components within a widget and not the widget itself).
What it sounds like you're trying to accomplish (change the layout depending on the theme) would likely require a different approach. A couple of options would be to react to when the theme changes by:
Moving around your spacers in your layout to move the buttons to the desired position
Using a stacked widget, one page in the stack for each layout you desire, and change which page in the stack you're showing depending on what theme you're using.