Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Error :: extra qualification
Qt 6.11 is out! See what's new in the release blog

Error :: extra qualification

Scheduled Pinned Locked Moved Installation and Deployment
5 Posts 3 Posters 11.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    manish411
    wrote on last edited by
    #1

    I am doing the example on dialogs from C++ gui programming with QT 4

    I have finddialog.h
    as
    [code]
    #ifndef FINDDIALOG_H
    #define FINDDIALOG_H
    #include <QDialog>
    class QCheckBox;
    class QLabel;
    class QLineEdit;
    class QPushButton;

    class FindDialog : public QDialog
    {
    Q_OBJECT

    public :
    FindDialog(QWidget *parent = 0);

    signals:
    void findNext(const QString &str,Qt::CaseSensitivity cs);
    void findPrevious(const QString &str,Qt::CaseSensitivity cs);

    private slots:
    void findClicked();
    void enableFindButton(const QString &text);
    private:
    QLabel *label;
    QLineEdit *lineEdit;
    QCheckBox *caseCheckBox;
    QCheckBox *backwardCheckBox;
    QPushButton *findButton;
    QPushButton *closeButton;
    #endif
    [/code]

    finddialog.cpp
    [code]
    #include <QtGui>
    #include "finddialog.h"
    FindDialog::FindDialog(QWidget *parent) : QDialog(parent)
    {
    label = new QLabel(tr("Find &what:"));
    lineEdit = new QLineEdit;
    label->setBuddy(lineEdit);

     caseCheckBox = new QCheckBox(tr("Match &case"));
     backwardCheckBox = new QCheckBox(tr("Search &backward"));
     
     findButton = new QPushButton(tr("&Find"));
     findButton->setDefault(true);
     findButton->setEnabled(false);
     closeButton = new QPushButton(tr("Close"));
    
    connect(lineEdit,SIGNAL(textChanged(const QString &)),this,SLOT(enableFindButton(const QString &)));
    connect(findButton,SIGNAL(clicked()),this,SLOT(findClicked()));
    connect(closeButton,SIGNAL(clicked()),this,SLOT(close()));
    
    QHBoxLayout *topLeftLayout = new QHBoxLayout;
    

    topLeftLayout->addWidget(label);
    topLeftLayout->addWidget(lineEdit);

    QVBoxLayout *leftLayout = new QVBoxLayout;
    leftLayout->addLayout(topLeftLayout);
    leftLayout->addWidget(findButton);
    leftLayout->addWidget(backwardCheckBox);

    QVBoxLayout *rightLayout = new QVBoxLayout;
    rightLayout->addLayout(leftLayout);
    rightLayout->addLayout(rightLayout);
    rightLayout->addStretch();

    QHBoxLayout *mainLayout = new QHBoxLayout;
    mainLayout->addLayout(leftLayout);
    mainLayout->addLayout(rightLayout);
    setLayout(mainLayout);

    setWindowTitle(tr("Find"));
    setFixedHeight(sizeHint().height());
    }

    void FindDialog :: findClicked()
    {
    QString text = lineEdit->text();
    Qt:: CaseSensitivity cs = caseCheckBox->isChecked() ? Qt::CaseSensitive
    : Qt::CaseInsensitive;
    if(backwardCheckBox->isChecked()) {
    emit findPrevious(text,cs);
    }
    else{
    emit findNext(text,cs);
    }
    }
    void FindDialog :: enableFindButton(const QString &text)
    {
    findButton->setEnabled(!text.isEmpty());

    }
    }
    [/code]

    main.cpp
    [code]
    #include <QApplication>
    #include "finddialog.h>
    int main(int argc,char *argv[])
    {
    QApplication app(argc,argv);
    FindDialog *dialog = new FindDialog;
    dialog->show();
    return app.exec();
    }
    [/code]

    [code]
    utkarsh@utkarsh-laptop:~/programming/qt/dialog$ ls
    dialog.pro finddialog.cpp finddialog.h main.cpp Makefile
    utkarsh@utkarsh-laptop:~/programming/qt/dialog$ make
    g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -o finddialog.o finddialog.cpp
    finddialog.cpp:3: error: extra qualification ‘FindDialog::’ on member ‘FindDialog’
    finddialog.cpp:3: error: ‘FindDialog::FindDialog(QWidget*)’ cannot be overloaded
    finddialog.h:14: error: with ‘FindDialog::FindDialog(QWidget*)’
    finddialog.cpp:44: error: extra qualification ‘FindDialog::’ on member ‘findClicked’
    finddialog.cpp:44: error: ‘void FindDialog::findClicked()’ cannot be overloaded
    finddialog.h:21: error: with ‘void FindDialog::findClicked()’
    finddialog.cpp:56: error: extra qualification ‘FindDialog::’ on member ‘enableFindButton’
    finddialog.cpp:56: error: ‘void FindDialog::enableFindButton(const QString&)’ cannot be overloaded
    finddialog.h:22: error: with ‘void FindDialog::enableFindButton(const QString&)’
    finddialog.cpp:60: error: expected unqualified-id at end of input
    make: *** [finddialog.o] Error 1
    utkarsh@utkarsh-laptop:~/programming/qt/dialog$ nano finddialog.cpp
    utkarsh@utkarsh-laptop:~/programming/qt/dialog$
    [/code]

    1 Reply Last reply
    0
    • EddyE Offline
      EddyE Offline
      Eddy
      wrote on last edited by
      #2

      @void FindDialog :: findClicked()@

      Should be

      @
      void FindDialog::findClicked()@

      Without the spaces

      Do the same for the other error.

      The compiler is complaining because the definition in the header seems repeated in the cpp file.

      Qt Certified Specialist
      www.edalsolutions.be

      1 Reply Last reply
      0
      • M Offline
        M Offline
        manish411
        wrote on last edited by
        #3

        Still getting the error!!
        [code]
        utkarsh@utkarsh-laptop:~/programming/qt/dialog$ make
        g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -o finddialog.o finddialog.cpp
        finddialog.cpp:3: error: extra qualification ‘FindDialog::’ on member ‘FindDialog’
        finddialog.cpp:3: error: ‘FindDialog::FindDialog(QWidget*)’ cannot be overloaded
        finddialog.h:14: error: with ‘FindDialog::FindDialog(QWidget*)’
        finddialog.cpp:44: error: extra qualification ‘FindDialog::’ on member ‘findClicked’
        finddialog.cpp:44: error: ‘void FindDialog::findClicked()’ cannot be overloaded
        finddialog.h:21: error: with ‘void FindDialog::findClicked()’
        finddialog.cpp:56: error: extra qualification ‘FindDialog::’ on member ‘enableFindButton’
        finddialog.cpp:56: error: ‘void FindDialog::enableFindButton(const QString&)’ cannot be overloaded
        finddialog.h:22: error: with ‘void FindDialog::enableFindButton(const QString&)’
        finddialog.cpp:60: error: expected unqualified-id at end of input
        make: *** [finddialog.o] Error 1
        [/code]

        1 Reply Last reply
        0
        • EddyE Offline
          EddyE Offline
          Eddy
          wrote on last edited by
          #4

          My previous answer was just a guess without trying it out.

          Now I've tried it and i'm not getting those errors.

          how did you put your code here? Are you sure it's the same as in your project?

          what OS and Qt version are you using?

          Qt Certified Specialist
          www.edalsolutions.be

          1 Reply Last reply
          0
          • K Offline
            K Offline
            koahnig
            wrote on last edited by
            #5

            You do not have matching curled braces in FindDialog.cpp. At the end you have doubled closing braces.
            Either it is only a problem of posting or it will certainly spoil your compilation.

            Vote the answer(s) that helped you to solve your issue(s)

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved