PDA

View Full Version : trouble with signals and slots



therealjag
23rd February 2006, 22:01
hey there, i have created a push button inside a tab called demandsTab() and i have connected the button to a method. the method and the connection is shown below:

QPushButton *shortestPathButton = new QPushButton(tr("Shortest Path"));
connect(shortestPathButton, SIGNAL(clicked()), this, SLOT(PermissionsTab::outputTable()));

the slot function that i created is shown below:

void PermissionsTab::outputTable()
{

int result = 5;
display->setText(QString::number(result));
}

i basically just want the display to output the number 5 in the permissions tab when i press the button from the demands tab, but it isnt working....any idea's??? Jag

Codepoet
23rd February 2006, 22:11
Try omitting PermissionsTab:

connect(shortestPathButton, SIGNAL(clicked()), this, SLOT(outputTable()));
If that does not help build in debug mode and run your app so that you can see the standard (error) output - if your IDE does not support it - from the commandline. Qt will then warn about non-existing signals and slots.

jacek
23rd February 2006, 22:19
If that does not help build in debug mode and run your app so that you can see the standard (error) output - if your IDE does not support it - from the commandline.
To see those messages on windows console, you will have to add "CONFIG += console" to your .pro file.

therealjag
23rd February 2006, 22:34
i tried adding CONFIG += console to my .pro file but it isnt working, i dont understand why and its really annoying.

jacek
23rd February 2006, 22:52
i tried adding CONFIG += console to my .pro file but it isnt working, i dont understand why and its really annoying.
Do you have Qt libraries compiled in debug mode? Did you compile your program in debug mode?