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

QCustomPlot plot clicked problem

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 3 Posters 2.1k Views
  • 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.
  • michalt38M Offline
    michalt38M Offline
    michalt38
    wrote on last edited by michalt38
    #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
    0
    • michalt38M michalt38

      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 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
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by mrjj
        #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
        • michalt38M Offline
          michalt38M Offline
          michalt38
          wrote on last edited by
          #4

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

          mrjjM 1 Reply Last reply
          0
          • michalt38M michalt38

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

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on 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
            • michalt38M Offline
              michalt38M Offline
              michalt38
              wrote on last edited by
              #6

              No, it doesn't.

              mrjjM 1 Reply Last reply
              0
              • michalt38M michalt38

                No, it doesn't.

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on 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
                • michalt38M Offline
                  michalt38M Offline
                  michalt38
                  wrote on last edited by michalt38
                  #8

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

                  1 Reply Last reply
                  1

                  • Login

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