Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C - C++ Learning > QT4 (Linux) sig...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 4283 of 4370
Post > Topic >>

QT4 (Linux) signal/slot question

by Vito <vito.ergens@[EMAIL PROTECTED] > Sep 24, 2008 at 09:25 AM

Hello, I'm not sure this question belongs in this ng, sorry if it doesn't.

I like to learn a bit of C++ with QT4, not using the designer but writing 
all code myself. But I came to a problem I can't solve, in fact I have no 
idea whatsoever. I made a 'connect' with SIGNAL and SLOT, but it fails to 
work.

Here's a bit of code:
************************* code ************
#include <QtGui>
#include "qnews.h"

MyWidget::MyWidget(QWidget *parent)
     : QWidget(parent)
 {
        setFixedSize(600, 300);
	setWindowTitle("Vito's QNews");

	QPushButton *postButton = new QPushButton(tr("Post"), this); 
     	postButton->setGeometry(10, 260, 75, 30);
	
	//not relevant code removed here ...
	
	// here's the signal/slot command 
	connect(postButton, SIGNAL(clicked()), this, SLOT(checkFile()));

 }

// here's the function that must be executed - showing a msgBox
void MyWidget::checkFile()
{
	QMessageBox msgBox;
 	msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
 	switch (msgBox.exec()) {
 	case QMessageBox::Yes:
     	// yes was clicked
     	break;
 	case QMessageBox::No:
     	// no was clicked
     	break;
 	default:
     	// should never be reached
     	break;
	}
 }
********* end code **************

But when I click the postButton, nothing happens ....
What's wrong in this code? All info very welcome.

BTW: I'm not English, sometimes understanding English docs is not easy 
for me. But I do my best :-)

Vito
 




 3 Posts in Topic:
QT4 (Linux) signal/slot question
Vito <vito.ergens@[EMA  2008-09-24 09:25:43 
Re: QT4 (Linux) signal/slot question
ConnorMcLaud@[EMAIL PROTE  2008-09-24 04:13:12 
Re: QT4 (Linux) signal/slot question
Vito <vito.ergens@[EMA  2008-09-24 12:07:11 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Nov 21 12:17:06 CST 2008.