I have written C++ code for video display and want to set contextmenu on the video screen as in vlc player occurs. But What happens when I right click on the border of the screen the popup window appears not on the central widget. What is desired that if its clicked anywhere
the popup should be displayed, but it's not happening.
Please help me..
Thanx in advance
It looks like you have a video player embedded into a widget (main frame, most probably) and that you bound the right click to the main widget.
If you video player has already a behaviour defined for right click, the event wont be transfer to the parent (the main widget) and thus, the behaviour you describe will appear. Without code or more details, it's hard to give a better feedback, but I'd start looking in that direction.
Related
I have a QT application with a TreeView in which items can be dragged into and around the TreeView. The Scroll wheel is able to scroll up and down the view when collapsed sufficiently to show the scroll bar in all cases except for when dragging in an item from the desktop.
Could anyone point me in the right directon? Or inform me on what questions I should be asking?
is the problem maybe related to the application not beeing in focus anymore? Keypresses (also mousewheel scroll) is usually send to the application which is activ/in focus.
I have done an private project which would react to keypresses on OS (windows) level to be able to control it while the user would play a computer game.
I don't have enough reputation to make a comment. Hope this might help you.
I'm writing a Qt application which uses mpv for playing different videos.
QWidget is used to show video content. I also have custom dock with controls for switching video channels, changing position, etc.
I want to have dock appearing after a click on the screen and disappearing on timer event. It all works fine, except from the fact, that QWidget used for mpv is not receiving QMouseEvent. On the contrast same event works fine for main window. Basically dock appears only if you click on visible part of main window and not on mpv Qwidget.
I assume it is because mpv has internal support for keybindings. I've tried to disable them by setting "input-default-bindings" to "no", but it didn't help.
mpv_set_option_string(mpv, "input-default-bindings", "no");
Can anybody help with that?
Does anybody know how to configure keybindings for mpv (I can't find any example in documentation)?
Maybe there is a workaround for it?
Thanks a lot.
You can use a transparent widget in front of video area to receive and redirect QMouseEvent to your custom dock. Though this is not a beautiful solution... How to create such widget is described here.
I am new to cocos2d-x and I am developing a game in x-code using cocos2d-x2.0.4. In my game I created a button using CCcontrolbutton. Now I want to drag my button to one place to another. I tried with all the CCControlEvents but it doesn't work. Now I want to know, is it possible to drag and drop a button using CCControlbutton. I pasted my code which I have used to create the button.
button1 = CCControlButton::create(CCScale9Sprite::create("7.png"));
button1->setAdjustBackgroundImage(false);
button1->setPosition( ccp(winwsize/6, winhsize/7) );
button1->addTargetWithActionForControlEvents(this, cccontrol_selector(plus::add),CCControlEventTouchDragOutside);
button1->addTargetWithActionForControlEvents(this, cccontrol_selector(plus::add),CCControlEventTouchDragInside);
this->addChild(button1, 4);
In add() I have given the code to enter next scene. But now it is entering while clicking the button. But i want while drag it to one position to another. If it is possible to drag a button using CCControlbutton then please give me some sample codes. Thanks.
The events CCControlEventTouchDragInside and CCControlEventTouchDragOutside are happening when the user's touch (his fingertip) is entering or leaving your button while already or still touching the touchscreen (or while the mouse button is still pressed while the mouse pointer moves).
You would need to observe the dragging process yourself. Starting with a click on your button, change the button's position while the user is dragging (to visualize the dragging process), and then call plus::add() when the dragging ends in your target area.
I'm making my first game in Irrlicht (C++), an RTS with mouse control
and when you select a tile (by clicking on it) it lights up and some gui button appear on the screen (not in a gui window mind you, I like it this way):
http://i1139.photobucket.com/albums/n549/Adam_Halley-Prinable/Untitled2.png
However, since i switched to mouse control, the buttons wont register my mouse clicks. The click goes straight through the button and selects the tile behind instead:
http://i1139.photobucket.com/albums/n549/Adam_Halley-Prinable/Untitled3.png
Is there a way I can say "Buttons get top priority for clicks"?
I'm using MyEventReceiver, which i've messed around with to accept mouse clicks and that.
Thanks a bunch :D
If anyone else has the same problem, ill tell you how I solved it :)
Go through the MyEventReceiver.h and get rid of all the "return true;"'s in the mouse section.
Don't ask me why, but it works, and appears to have no side effects. Make sure you leave the "return false;" at the end of the section there.
Your event receiver fires before the GUI gets access to the event, if you want to pass it to the GUI then you can do this by manually posting it to the GUIEnvironment in your event receiver.
if (guienv->postEventFromUser(event))
return true; // abort because the gui wanted it
// .. pick nodes
// possibly post event to scene manager
return true; // remember to return true so gui/smgr don't get the event again
I am creating a widget on click the button. The widget is appearing at center of the screen. I want to show that widget at a proper predefined position of the screen. And when ever I open that widget it should show at that point only. How to do this not able to understand.
Use QWidget::move() function before you show it.