Qt – pointers – SIGNAL – SLOT

I gathered a code of an application called calendar from the base of examples of the Qt Framework. I am trying to learn from it and add there some functionality. The problem right now that I’ve got is that I want to implement two function to the two button that I created ( one for increase counting of the days and the second for decrease ).

The code that I added to the function for increasing the days is:

void MainWindow::forward(int *click_forward)
{
    click_forward++;
}

and the code added to the function for decreasing the days:

void MainWindow::backwards(int *click_backwards)
{
    click_backwards--; 
}

In the constructor I defined a variable named click which of the int
type, and I sent this variable to the both function by reference:

   forward(&click);
   backward(&click);   

In the header file, in the public slosts area these both functions are
defined as:

   void forward(int *click_forward);

   void backwards(int *click_backwards);

I also implemented two SIGNAL-SLOT connections:

   QObject::connect(nextbtn, SIGNAL(clicked()), this, SLOT(forward(int  
   &click)));

   QObject::connect(beforebtn, SIGNAL(clicked()), this, 
   SLOT(backwards(int &clickt))); 

But for some reasons when I compile the project I receive an information that:

   QObject::connect: No such slot MainWindow::forward(int &click) 

   QObject::connect: No such slot MainWindow::backwards(int &clickt)

I wanted to use pointers in these two functions, just to work on the original variable itself not on the copy.
Could I please ask you to point me out what I am doing wrong.

Thank you,


Source: linux

Leave a Reply