Results 1 to 8 of 8

Thread: Create a new button

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2006
    Posts
    57
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    12

    Question Re: Create a new button

    Well i implement the abstracts metods and now gcc don't say
    "cannot allocate and object of type 'ColorButton' in the line 5
    because the following virtual functions are abstracts"

    but say :

    In copy constructor `ColorButton::ColorButton(const ColorButton&)':
    D:/Qt/4.1.2/include/QtGui/../../src/gui/widgets/qabstractbutton.h:139:
    error: `QAbstractButton::QAbstractButton(const QAbstractButton&)' is private
    error: within this context
    In member function `ColorButton& ColorButton:perator=(const ColorButton&)':
    D:/Qt/4.1.2/include/QtGui/../../src/gui/widgets/qabstractbutton.h:139:
    error: `QAbstractButton& QAbstractButton:perator=(const QAbstractButton&)' is private
    error: within this context

    in the line

    Button[i] = ColorButton(this,x+(i*21),y+(j*21),21,21);

    don´t work if i put Button[i] = new ColorButton(this,x+(i*21),y+(j*21),21,21);

    Help me please

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts

    Default Re: Create a new button

    Chicken Blood Machine and jacek already gave you the solution.

    You cannot copy widgets, so you cannot store them into QVector as objects. Store pointers instead.
    You have to change the type of the vector from QVector<ColorButton> to QVector<ColorButton*>.
    J-P Nurmi

Similar Threads

  1. How to create an Insert/Submit button for a form.
    By fnmblot in forum Qt Programming
    Replies: 5
    Last Post: 4th August 2006, 17:18
  2. Round Button
    By Seema Rao in forum Qt Programming
    Replies: 1
    Last Post: 25th April 2006, 12:32
  3. Push Button problem!!
    By Seema Rao in forum Qt Programming
    Replies: 1
    Last Post: 22nd April 2006, 17:31
  4. Push button double click
    By curtisw in forum Qt Programming
    Replies: 3
    Last Post: 15th February 2006, 17:40
  5. QLabel on a Button
    By cwalsh in forum Newbie
    Replies: 4
    Last Post: 12th January 2006, 17:06

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.