Results 1 to 2 of 2

Thread: connection from button to slot with parameter of type QSqlDatabase*

  1. #1
    Join Date
    Mar 2010
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default connection from button to slot with parameter of type QSqlDatabase*

    Hi,

    i want to connect a QPushButton to a slot create(QSqlDatabase *database), but i get the following:
    Qt Code:
    1. QObject::connect: Incompatible sender/receiver arguments
    2. QPushButton::clicked() --> CreateCupDialog::create(QSqlDatabase*)
    To copy to clipboard, switch view to plain text mode 
    Do i have to change my slot to create() because the button cant send a QSqlDatabase* type? how do i get my pointer passed to the functions executed in create()?

    thanks for your help.

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: connection from button to slot with parameter of type QSqlDatabase*

    Where is the QSqlDatabase pointer that needs to be passed to create?
    You could have a slot which takes no parameters, connect it to the button, and there call CreateCupDialog::create(QSqlDatabase*).
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. Slot - Signal with parameter
    By Lodhart in forum Newbie
    Replies: 8
    Last Post: 10th April 2013, 11:08
  2. Replies: 2
    Last Post: 6th July 2009, 13:53
  3. Problem with connect() (enum-type as parameter)
    By alu23 in forum Qt Programming
    Replies: 3
    Last Post: 9th May 2008, 08:46
  4. How to add a parameter to a slot
    By Potch in forum Newbie
    Replies: 4
    Last Post: 6th May 2008, 00:09
  5. Replies: 3
    Last Post: 22nd June 2006, 17:27

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.