Re: Playbutton functionality
Take a look at QTimer class.
controlling a visual widget from a button
I have a program that I am developing. I do not understand how I can take control of the display widget that is controlled by a class that has event handlers. I know for sure that this class is controlling the visual widget; however, I cannot gain control of it the way I want to. I also have created a QPlayback class that has several buttons. I'd like one of those buttons to control the visual widget through some sort of signal and slot process; however, there is no slot in the class that controls the visual widget. I know that this class controls the visual widget because I debugged the code and found that whenever I pressandrelease on the display widget then the debugger ends up in a function (repaint(PaintEvent* ) in class (MapVisual, which is not a QMapVisual and not derived from QWidget). All that I want to do is simply press this button from one widget and repaint the map on the other widget and it is becoming a nightmare. I reasoned if I send a click signal from the qplayback to a slot on the qplay back and within this slot function, call the repaint function in the class that control the widget, I can repaint the screen whenever I want to. This doesn't seem to work because I have to declare an event in the slot function and sent it as a parameter to the recieving function, but that doesn't work because the QPaintEvent declaration is NULL! How do I got about fixing my issue ?? I can explain further if you guys need me to...
Re: controlling a visual widget from a button
Quote:
Originally Posted by
uchennaanyanwu
All that I want to do is simply press this button from one widget and repaint the map on the other widget and it is becoming a nightmare.
Then all you need is to connect button's clicked() signal to the update() slot of that other widget. Provided that you haven't blocked the event loop, Qt should handle the rest.
Re: Playbutton functionality
thanks for the reply....It isn't declared as a slot. Moreover, the class called MapVisual isn't derived from a QWidget at all, instead it is from Visualizer, which is not a QWidget? It has paintEvent(QPaintEvent *e), dragEnter(QDragEvent *e), and etc. Any ideas ??
Re: Playbutton functionality
Quote:
Originally Posted by
uchennaanyanwu
Moreover, the class called MapVisual isn't derived from a QWidget at all, instead it is from Visualizer, which is not a QWidget?
These aren't Qt classes. Do you use any 3rd party libraries?