Results 1 to 2 of 2

Thread: Constructor Error, please assist

  1. #1
    Join Date
    Jul 2012
    Posts
    201
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Constructor Error, please assist

    Hi everyone, I keep on getting the error below when I try to modify the default constructor for a dialogue box. Here is the constructor
    Qt Code:
    1. explicit NewAccount(QWidget *parent = 0);
    To copy to clipboard, switch view to plain text mode 
    I want to add a QSqlDatabase object in the constructor so that it looks like this
    Qt Code:
    1. explicit NewAccount(QWidget *parent = 0, QSqlDatabase db);
    To copy to clipboard, switch view to plain text mode 
    but I keep on getting this error. Am I doing something wrong?
    13_03_2014.jpg

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Constructor Error, please assist

    This is pretty basic C++ : default arguments. Your compiler pointed out the error - define a default value just for second parameter or both. Or change the order of constructor parameters.

Similar Threads

  1. Replies: 1
    Last Post: 30th December 2013, 14:53
  2. Replies: 4
    Last Post: 9th September 2009, 09:02
  3. error with constructor or OnInit
    By chochatown in forum Qt Programming
    Replies: 3
    Last Post: 30th May 2009, 22:15
  4. Visual Assist X [1649] & QT 4.4.3
    By trulysachin in forum Qt Programming
    Replies: 2
    Last Post: 19th November 2008, 08:17
  5. Visual Assist X and Qt
    By ShaChris23 in forum Qt Programming
    Replies: 5
    Last Post: 5th May 2007, 04:54

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.