Results 1 to 6 of 6

Thread: [noob] How can I have a widget event call a function?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2008
    Posts
    5
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: [noob] How can I have a widget event call a function?

    OK, interesting...

    I connect my button's "clicked()" signal to its own "click()" slot, and I have myButton::click() change the colour? Or do I have to make a custom slot (and to do that do I need to make a custom "myQButton" class)?


    Basically, can I have my button change colour by editing only main.cpp and mainWidow.cpp?
    Last edited by Envergure; 25th November 2008 at 16:07.

  2. #2
    Join Date
    Jul 2006
    Location
    Atlanta, GA
    Posts
    86
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    26
    Thanked 6 Times in 6 Posts

    Default Re: [noob] How can I have a widget event call a function?

    http://doc.trolltech.com/4.4/index.html is your best friend. I use it on a daily basis.
    fnmblot
    --------------------------------------
    Gee Ricky, I'm sorry your mom blew up.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: [noob] How can I have a widget event call a function?

    You need to create your own custom slot somewhere (like in mainWindow.cpp) and connect the signal to it. Inside the slot you need to perform the changes you want.

Similar Threads

  1. QPSQL problem
    By LoneWolf in forum Installation and Deployment
    Replies: 60
    Last Post: 4th November 2009, 14:22
  2. QPSQL driver in windows
    By brevleq in forum Installation and Deployment
    Replies: 31
    Last Post: 14th December 2007, 12:57
  3. how to add static library into qmake
    By Namrata in forum Qt Tools
    Replies: 1
    Last Post: 20th November 2007, 17:33
  4. KDE/QWT doubt on debian sarge
    By hildebrand in forum KDE Forum
    Replies: 13
    Last Post: 25th April 2007, 06:13
  5. use qpsql
    By raphaelf in forum Installation and Deployment
    Replies: 34
    Last Post: 22nd August 2006, 12: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.