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. QCustomPlot plot clicked problem
Forum Updated to NodeBB v4.3 + New Features

QCustomPlot plot clicked problem

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 3 Posters 2.2k Views 2 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
    michalt38
    wrote on 2 Nov 2016, 12:44 last edited by michalt38 11 Feb 2016, 12:46
    #1

    I want to receive an information that plot was clicked using QCustomPlot. I tried this:

    connect(ui->customPlot,  
      SIGNAL(plottableClicked(QCPAbstractPlottable*,int,QMouseEvent*)), this, 
      SLOT(plotClicked(QCPAbstractPlottable*,int,QMouseEvent*)));
    

    but it did not work. The problem is that when I click on a plot, the slot is not executing.

    K 1 Reply Last reply 2 Nov 2016, 13:20
    0
    • M michalt38
      2 Nov 2016, 12:44

      I want to receive an information that plot was clicked using QCustomPlot. I tried this:

      connect(ui->customPlot,  
        SIGNAL(plottableClicked(QCPAbstractPlottable*,int,QMouseEvent*)), this, 
        SLOT(plotClicked(QCPAbstractPlottable*,int,QMouseEvent*)));
      

      but it did not work. The problem is that when I click on a plot, the slot is not executing.

      K Offline
      K Offline
      koahnig
      wrote on 2 Nov 2016, 13:20 last edited by
      #2

      @michalt38

      Assuming the signal and slot is all working, it is probably a typing error in your connect statement. You can check the return value of connect. It will tell, if there is a problem with the connection. Also you should see an error message on the terminal output (or the application output window, when started in creator).
      You could use also functor-based connect. This would show you already during compile time typing issues.

      Furthermore, QCustumPlot is a library based on Qt and you need to contact the publisher of the library for details there.

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

      1 Reply Last reply
      2
      • M Offline
        M Offline
        mrjj
        Lifetime Qt Champion
        wrote on 2 Nov 2016, 13:24 last edited by mrjj 11 Feb 2016, 13:25
        #3

        You should try qDebug() "con1:"<< connect(ui->customPlot, xxx)
        and see if it says true.
        The syntax seems valid
        http://www.qcustomplot.com/documentation/classQCustomPlot.html

        Also check that whatever class, the "this" is , has Q_OBJECT macro. in the .h file.

        1 Reply Last reply
        1
        • M Offline
          M Offline
          michalt38
          wrote on 2 Nov 2016, 13:34 last edited by
          #4

          connect returns true. This class has Q_OBJECT macro in the .h file.

          M 1 Reply Last reply 2 Nov 2016, 13:40
          0
          • M michalt38
            2 Nov 2016, 13:34

            connect returns true. This class has Q_OBJECT macro in the .h file.

            M Offline
            M Offline
            mrjj
            Lifetime Qt Champion
            wrote on 2 Nov 2016, 13:40 last edited by
            #5

            @michalt38
            Ok, maybe it just dont emit the signal.
            You could try
            http://www.qcustomplot.com/index.php/demos/interactionexample
            and see if their
            connect(ui->customPlot, SIGNAL(plottableClick(QCPAbstractPlottable*,int,QMouseEvent*)), this, SLOT(graphClicked(QCPAbstractPlottable*,int)));
            fires.

            1 Reply Last reply
            0
            • M Offline
              M Offline
              michalt38
              wrote on 2 Nov 2016, 13:56 last edited by
              #6

              No, it doesn't.

              M 1 Reply Last reply 2 Nov 2016, 13:59
              0
              • M michalt38
                2 Nov 2016, 13:56

                No, it doesn't.

                M Offline
                M Offline
                mrjj
                Lifetime Qt Champion
                wrote on 2 Nov 2016, 13:59 last edited by
                #7

                @michalt38
                Well maybe there is something with our installation of it. Normally the samples works.

                Have you tried their forum ? ( if any)

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  michalt38
                  wrote on 2 Nov 2016, 14:10 last edited by michalt38 11 Feb 2016, 14:10
                  #8

                  I found another way: I used signal mousePressed and ckeck if the plot is select by selected() function.

                  1 Reply Last reply
                  1

                  1/8

                  2 Nov 2016, 12:44

                  • Login

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