Results 1 to 7 of 7

Thread: Inheritance problem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    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: Inheritance problem

    It should be "SIGNAL(currentIndexChanged())" and "SLOT(typeChanged())". Notice upper case.
    J-P Nurmi

  2. #2
    Join Date
    Aug 2007
    Posts
    64
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanked 1 Time in 1 Post

    Default Re: Inheritance problem

    Good!

    I've forgot it!
    It's building right now, but when I run the program I have this output at shell:

    hudson@brevleq:~/.projetos/CLP$ CLP
    Object::connect: No such signal ComboView::QComboBox::currentIndexChanged()
    Object::connect: No such signal ComboView::QComboBox::currentIndexChanged()
    Object::connect: No such signal ComboView::QComboBox::currentIndexChanged()
    Object::connect: No such signal ComboView::QComboBox::currentIndexChanged()
    Object::connect: No such signal ComboView::QComboBox::currentIndexChanged()
    Object::connect: No such signal ComboView::QComboBox::currentIndexChanged()
    Object::connect: No such signal ComboView::QComboBox::currentIndexChanged()
    Object::connect: No such signal ComboView::QComboBox::currentIndexChanged()
    Object::connect: No such signal ComboView::QComboBox::currentIndexChanged()
    Object::connect: No such signal ComboView::QComboBox::currentIndexChanged()
    hudson@brevleq:~/.projetos/CLP$
    I wanna use QComboBox Signal, can I?? How?? Should I reimplement currentIndexChanged()??

  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: Inheritance problem

    Please post your updated connect() statement. It probably contains SIGNAL(QComboBox::currentIndexChanged()) instead of SIGNAL(currentIndexChanged()).

  4. #4
    Join Date
    Aug 2007
    Posts
    64
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanked 1 Time in 1 Post

    Default Re: Inheritance problem

    Qt Code:
    1. #include "ComboView.h"
    2.  
    3. ComboView::ComboView(QWidget *parent):QComboBox(parent){
    4. addItem("Constante",PortaEntrada::CONSTANT);
    5. addItem("Triangular",PortaEntrada::TRIANGULAR);
    6. addItem("Quadratica",PortaEntrada::QUADRATIC);
    7. connect(this,SIGNAL(currentIndexChanged(&int)),this,SLOT(typeChanged()));
    8. }
    9.  
    10. void ComboView::typeChanged(void){
    11. controller->setProperty(currentIndex());
    12. }
    To copy to clipboard, switch view to plain text mode 


    Object::connect: No such signal ComboView::currentIndexChanged(&int)
    Object::connect: No such signal ComboView::currentIndexChanged(&int)
    Object::connect: No such signal ComboView::currentIndexChanged(&int)
    Object::connect: No such signal ComboView::currentIndexChanged(&int)
    Object::connect: No such signal ComboView::currentIndexChanged(&int)
    Object::connect: No such signal ComboView::currentIndexChanged(&int)
    Object::connect: No such signal ComboView::currentIndexChanged(&int)
    Object::connect: No such signal ComboView::currentIndexChanged(&int)
    Object::connect: No such signal ComboView::currentIndexChanged(&int)
    Object::connect: No such signal ComboView::currentIndexChanged(&int)

  5. #5
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 334 Times in 317 Posts

    Default Re: Inheritance problem

    connect(this,SIGNAL(currentIndexChanged(&int)),thi s,SLOT(typeChanged()));

    should be

    connect(this,SIGNAL(currentIndexChanged(int)),this,SLOT(typeChanged()));

  6. #6
    Join Date
    Dec 2008
    Location
    chinese
    Posts
    47
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    3

    Default Re: Inheritance problem

    Quote Originally Posted by brevleq View Post
    Qt Code:
    1. #include "ComboView.h"
    2.  
    3. ComboView::ComboView(QWidget *parent):QComboBox(parent){
    4. addItem("Constante",PortaEntrada::CONSTANT);
    5. addItem("Triangular",PortaEntrada::TRIANGULAR);
    6. addItem("Quadratica",PortaEntrada::QUADRATIC);
    7. connect(this,SIGNAL(currentIndexChanged(&int)),this,SLOT(typeChanged()));
    8. }
    9.  
    10. void ComboView::typeChanged(void){
    11. controller->setProperty(currentIndex());
    12. }
    To copy to clipboard, switch view to plain text mode 
    parent class have no currentIndexChanged signal, i think

Similar Threads

  1. problem in widget inheritance
    By wagmare in forum Qt Programming
    Replies: 2
    Last Post: 10th December 2008, 07:35
  2. Possibly an inheritance problem with QObject?
    By chadkeck in forum Qt Programming
    Replies: 8
    Last Post: 5th November 2008, 01:26
  3. Weird problem: multithread QT app kills my linux
    By Ishark in forum Qt Programming
    Replies: 2
    Last Post: 8th August 2008, 09:12
  4. Steps in solving a programming problem?
    By triperzonak in forum General Programming
    Replies: 8
    Last Post: 5th August 2008, 08:47
  5. How much inheritance do you use?
    By Michiel in forum General Programming
    Replies: 8
    Last Post: 1st August 2006, 22:29

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.