Results 1 to 3 of 3

Thread: Simple Plot example and using signal gives an error

  1. #1
    Join Date
    Sep 2015
    Posts
    2
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Android

    Default Simple Plot example and using signal gives an error

    Hello everybody,

    Recently, I started to program with Qt and yesterday with Qwt.
    My aim was to start with an example simpleplot and add some code to understand how Qwt works.
    Qwt is a nice and powerfull library which I would like to use for my small projects.

    First exercice was to draw a plot after pushing a button by using slot and signals.
    Unfortunately when I added a new class and compile I received 'slot' does not name a type as an error.

    In my previous Qt programming, I used the slot and signals systems without having this problem.

    Does anybody have an idea what I am doing wrong?
    I kindly appreciate any hints which will bring me to solve this small problem.

    Here the .h code:

    Qt Code:
    1. #ifndef ROOTWINDOW_H
    2. #define ROOTWINDOW_H
    3.  
    4. #include <QMainWindow>
    5. #include <QObject>
    6. #include <QWidget>
    7.  
    8. class RootWindow : public QWidget
    9. {
    10. Q_OBJECT
    11.  
    12. public:
    13. explicit RootWindow(QWidget *parent = 0);
    14.  
    15. private:
    16. int myvalue;
    17.  
    18. public slots:
    19. void Slot_PopUp();
    20.  
    21. };
    22.  
    23. #endif // ROOTWINDOW_H
    To copy to clipboard, switch view to plain text mode 

    and the .cpp
    Qt Code:
    1. #include "rootwindow.h"
    2.  
    3. RootWindow::RootWindow(QWidget *parent) : QWidget(parent)
    4. {
    5.  
    6. }
    7.  
    8. void RootWindow::Slot_PopUp()
    9. {
    10.  
    11. }
    To copy to clipboard, switch view to plain text mode 

    simpleplot.cpp hasn't changed except the rootmenu include.

    Thanks in advance for your Help,
    Damien

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,253
    Thanked 860 Times in 809 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Simple Plot example and using signal gives an error

    This is because of "CONFIG += no_keywords". See at the end of http://doc.qt.io/qt-4.8/signalsandslots.html.
    Usually this flag is not set in the application project file, but I guess you were working in the Qwt build environment.

    Uwe

  3. #3
    Join Date
    Sep 2015
    Posts
    2
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Android

    Default Re: Simple Plot example and using signal gives an error

    Hello Uwe,

    thanks for your help, it was exactly the problem.
    For the moment I just want to get used to Qwt by playing around with simpleplot.
    After this phase, I will integrate this library to my project.
    I already started but it doesn't work so far, I will open another thread for that but there is no rush.

    Thanks again and I am back to the race.
    Damien

Similar Threads

  1. A simple Plot doesn't work in Qt5
    By 8Observer8 in forum Qwt
    Replies: 3
    Last Post: 16th January 2014, 07:45
  2. Replies: 8
    Last Post: 4th May 2011, 00:47
  3. Simple Plot after Inputing some Data
    By thebrute in forum Qwt
    Replies: 0
    Last Post: 18th August 2010, 15:29
  4. Replies: 0
    Last Post: 18th March 2010, 15:35
  5. Replies: 2
    Last Post: 5th September 2009, 12:23

Tags for this Thread

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.