Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Slot Declaration rare problem to resolve[SOLVED]
Forum Updated to NodeBB v4.3 + New Features

Slot Declaration rare problem to resolve[SOLVED]

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 5.0k 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.
  • S Offline
    S Offline
    swhweng
    wrote on last edited by
    #1

    Hi.

    I am finishing to code custom MainWindow class:

    mainwindow.h file:

    @#ifndef MAINWINDOW_H
    #define MAINWINDOW_H
    #include <QMainWindow>
    #include <QFileDialog>
    #include "qwt_plot_canvas.h"
    #include "lib/wfdb.h"
    #include "lib/ecgmap.h"
    #include "curvedata.h"
    #include "qwt_plot_grid.h"
    //temporary
    #include <QDebug>

    namespace Ui {
    class MainWindow;
    }

    class MainWindow : public QMainWindow
    {
    Q_OBJECT
    public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();
    private:
    void init_plot();
    void process();
    public slots:
    void LoadData();
    private:
    Ui::MainWindow *ui;
    CurveData *cvData_in;
    CurveData *cvData_out;
    QwtPlotCurve *qwtpltcrv_in;
    QwtPlotCurve *qwtpltcrv_out;
    int lp[LP_SIZE];
    char *db_name;
    };

    #endif // MAINWINDOW_H@

    the slot LoadData is definde in mainwindow.cpp file as:

    void MainWindow::LoadData()
    {
    ...
    }

    as well as another functions:

    but when compiling as usual using
    Qt 4.8.0 for Desktop - MinGW ( Qt SDK ), Mingw as GCC for windows targets

    Compile output contains next notification about slot declaration:

    In file included from main.cpp:2:
    mainwindow.h:26: error: expected ':' before 'slots'
    mainwindow.h:27: error: expected primary-expression before 'void'
    mainwindow.h:27: error: ISO C++ forbids declaration of 'slots' with no type
    mainwindow.h:27: error: expected ';' before 'void'

    Would somebody help me / point out why such problem?
    How to resolve and to get succesfull compilation?

    Thnaks in advance,
    Paul

    1 Reply Last reply
    0
    • D Offline
      D Offline
      DerManu
      wrote on last edited by
      #2

      What happens when you don't use the public slots notation, but Q_SLOTS?
      does qmake run successfully?

      1 Reply Last reply
      0
      • S Offline
        S Offline
        swhweng
        wrote on last edited by
        #3

        bq. What happens when you don’t use the public slots notation, but Q_SLOTS?
        does qmake run successfully?

        --Thank you.The code after replacing public slots notation to Q_SLOTS compiled and run successfully.That is because of includes of QWT in the project I guess with high likelihood and having a reason.
        Solved.

        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