Results 1 to 3 of 3

Thread: Error in signals (expected primary-expression before ...)

  1. #1
    Join Date
    Dec 2012
    Posts
    13
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Error in signals (expected primary-expression before ...)

    Recieve error in signal, why?
    ComicView.h
    Qt Code:
    1. class ComicView : public QObject
    2. {
    3. Q_OBJECT
    4. public:
    5. explicit ComicView(QObject *parent = 0);
    6.  
    7. signals:
    8. ......
    9. void signal_fill_modellist(QStringList list);
    To copy to clipboard, switch view to plain text mode 

    ComicView.cpp
    Qt Code:
    1. void ComicView::fillmodel(QStringList pageslist)
    2. {
    3. QStringList list = pageslist;
    4. emit signal_fill_modellist(QStringList list); //error: expected primary-expression before 'list'
    5. }
    To copy to clipboard, switch view to plain text mode 

    MainWindow.h
    Qt Code:
    1. class MainWindow : public QMainWindow
    2. {
    3. Q_OBJECT
    4.  
    5. public:
    6. explicit MainWindow(QWidget *parent = 0);
    7. ~MainWindow();
    8. ........
    9. public slots:
    10. void listpages(QStringList list);
    11. private:
    12. Ui::MainWindow *ui;
    13. ComicView *comicview;
    14.  
    15. };
    To copy to clipboard, switch view to plain text mode 

    MainWindow.cpp
    Qt Code:
    1. MainWindow::MainWindow(QWidget *parent) :
    2. QMainWindow(parent),
    3. ui(new Ui::MainWindow)
    4. {
    5. ui->setupUi(this);
    6. ui->listView->setModel(model);
    7. ui->listView->setEditTriggers(QAbstractItemView::AnyKeyPressed | QAbstractItemView::DoubleClicked);
    8.  
    9. model = new QStringListModel(this);
    10.  
    11. comicview = new ComicView;
    12.  
    13. connect(comicview,SIGNAL(signal_fill_modellist(QStringList)),this,SLOT(listpages(QStringList)));
    14. }
    15.  
    16. void MainWindow::listpages(QStringList list) {
    17. model->setStringList(list);
    18. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Error in signals (expected primary-expression before ...)

    Qt Code:
    1. void ComicView::fillmodel(QStringList pageslist)
    2. {
    3. QStringList list = pageslist;
    4. //emit signal_fill_modellist(QStringList list); //error: expected primary-expression before 'list'
    5. emit signal_fill_modellist(list);
    6. }
    To copy to clipboard, switch view to plain text mode 
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  3. #3
    Join Date
    Dec 2012
    Posts
    13
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: Error in signals (expected primary-expression before ...)

    -____- thx
    Last edited by noborder; 16th January 2013 at 10:46.

Similar Threads

  1. Replies: 0
    Last Post: 9th August 2011, 10:15
  2. Replies: 5
    Last Post: 21st May 2011, 01:06
  3. Replies: 4
    Last Post: 3rd January 2011, 01:16
  4. error:expected class name before {
    By levorn10 in forum Qt Programming
    Replies: 2
    Last Post: 30th November 2010, 19:10
  5. error: invalid use of void expression
    By ChineseGeek in forum Qt Programming
    Replies: 17
    Last Post: 3rd October 2009, 08:59

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.