QT, advance GUI, fancy context menu - c++

i am working on a Qt project and i want to make a fancy context pie right click.... menu.
like the one in the image
bellow
I am using QGraphicsItem, QGraphicsScene, QGraphicsView, and setting the background transparent by
setAttribute(Qt::WA_TranslucentBackground);
setStyleSheet("background: transparent ;border: none;");
what i want to achieve is when user hove over the circle and it is a sub-menu then a pie menu will appears but,
The problem is:
sadly mouse events will not emit unless its touching a solid pixel from my QGraphicsView, so when mouse cursor hove over a sub-menu the red pie will appear BUT as soon as i move to click on a sector from the pie it will disappear because i am no longer hovering over the orange circle.
any another good idea or solution so i can get mouse events over my transparent area (i will calculate the distance from the orange circle and if the mouse IN RANGE the pie will stay shown)
thanks.

I think you can do this :
Hover the orange one and the sub menu appear.
Keep the sub menu appear until your mouse hover nothing or hover another circle menu. When you move your mouse to sub menu -> it means you hover thing, so the sub menu will still there. If your sub menus are all same, so when you hover another circle, just move sub menu position and maybe set some property.
Make sure that your orange circle and the sub menu is overlap, so moving mouse from orange to sub menu will not trigger "hover nothing"

Related

How to enable the touch screen maintenance through code?

I am interested in it because I need to drag the ScrolledWindow not with a scroll bar but with a mouse - press the mouse button and drag the window content (Dragging the area inside the ScrolledWindow). As I figured out it is possible with the help of enabling the check box (touch screen simulation) in the inspector, but the problem is that I need to enable this check box every time I run the application.

wxWidgets cursor over panel border

I've got a variety of wxPanels contained in a main wxPanel which is in turn contained in a wxFrame.
I'm trying to set a custom cursor over all the children by calling SetCursor on the wxFrame that contains everything and it mostly works except when the mouse is over the children's border.
When the mouse is over a border, it reverts to the arrow.
Each border is set to wxBORDER_RAISED.
How do I make sure that my cursor is the same over a panel's borders as it is over the panel itself?
Here's how I set the cursor:
In my wxFrame
wxCursor wMyCursor(wCursorFilename, wxBITMAP_TYPE_CUR);
SetCursor(wMyCursor);
//tried this as well
wMainPanel->SetCursor(wMyCursor);
An other way of putting it might be "how do I set a custom cursor when the mouse is over a panel's border"?
cheers

Implement owner draw menu bar MFC

I want to create an owner draw menu bar (by menu bar I mean a bar that has the same width as the application window, not just to fit the menus) like the one in the image below
(Notice the menu item on the right and the background color for the bar that takes the full width of the window)
I only want the buttons to be customized (the size and the rectangle with a border on hover, and another effect when they're active), the menu popup itself has to be the Windows' default menu.
What have I done so far?
I managed to create the owner draw menu, but I have the following problems:
the menu bar rectangle is only as wide as the widths of the items summed up (I need it to take full window width)
all the menu items are styled uniformly (I only want the top buttons to be styled like that)
How can I get the desired look for my menu?

Layout with invisible button steals click events from underlying button in Qt5 form (QtCreator)

I have designed a form in QtCreator for Qt5 where I have a row of buttons without layout (Blueberry+, Peach, Lemon, Mango and Water in screenshot below) with a grid layout on top.
The grid layout has one button (Register Now), one label(HELLO JOHN) and two horizontal spacers inside:
In the code, the label and button in the layout are set to visible=false.
When I start the program and show the screen I only see the underlying row of buttons, but I can't click them. The layout seems to somehow steal the focus. I can verify this by moving the layout in the editor to see the boundary for where my clicks work following it.
Other than this there isn't much going on in the gui, so I am kind of stumped as to why a QGridLayout steals my clicks.
Any tips on how I can avoid this?
You should hide the QGridLayout itself and not the button and label.
You are done here if the button and label hides and shows togather.
if not. along with showing and hidding the grid. show and hide the label and button.
Does that seems to solve the problem?

Mouse programming

https://stackoverflow.com/questions/9466359/graphics-editor-in-c
I've developed a simple graphics editor in c++.It requires me to drag the mouse to draw a shape .After drawing the shape I want to fill it by picking a color but since dragging the mouse amounts to a large number of clicks because of which the entire screen gets filled with a default color even before i've drawn the shape. delay() doesn't work either.
the mouse click event in turbo c++ has two part. one where you press the button and two when you release the button. you need to drag so you should use the clrscr() function in the loop which goes on iterating until the mouse button is pressed down along with the code for the shape you want to draw. that way your screen keeps getting updated when you are dragging the mouse. and the loop ends when you release the button.
for filling the shape using the flood fill function should suffice
Perhaps one of the following links is what you're looking for:
http://www.codeproject.com/Articles/11313/Mouse-Programming-in-C-C
http://www.cprogrammingreference.com/Tutorials/Advance_Tutorials/mouseprogramming.php
http://www.brackeen.com/vga/mouse.html