Results 1 to 6 of 6

Thread: Playbutton functionality

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default 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...

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: controlling a visual widget from a button

    Quote Originally Posted by uchennaanyanwu View Post
    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.

  3. #3

    Default 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 ??

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Playbutton functionality

    Quote Originally Posted by uchennaanyanwu View Post
    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?

Similar Threads

  1. Replies: 3
    Last Post: 1st April 2011, 04:58
  2. portable getopt() functionality
    By KShots in forum Qt Programming
    Replies: 7
    Last Post: 14th March 2011, 18:19
  3. Functionality Of Qsciptengine file
    By Gaurav K SIngh in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 3rd July 2007, 10:50
  4. spy++ like functionality with Qt / X11
    By bpetty in forum Newbie
    Replies: 3
    Last Post: 24th April 2007, 22:10
  5. Replies: 13
    Last Post: 15th December 2006, 11:52

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.