Re: random numbers and slots
Quote:
Originally Posted by
Enoctaffie
I want to use the funtion srand(time(0)) to generate random numbers but I am getting an error message that time is not declared in this scope, please help.
Try:
Quote:
I also have two QPushButtons "OK" and "Cancel", there is no differenve between clicking on the OK and Cancel buttons. I used a slot to connect to this the code is as follows: connect(cancelButton, SIGNAL(clicked()), this, SLOT(close()));
On a generated QDialog I assume... the buttons are connected to the QDialog::accept() or QDialog::reject() slots, which close the dialog and return a different value to the QDialog::exec() call.
Re: random numbers and slots
Hi ChrisW67
thanks the first one worked but I do not understand the second solution. This is how I created the push button and added it to the layout.
QGridLayout* layout = new QGridlayout;
QPushButton* cancel = new QPushButton("Cancel);
QHBoxLayout* buttonLayout = new QHBoxLayout;
buttonLayout->addWidget(cancel);
layout->addWidget(buttonLayout);
Re: random numbers and slots
what error are you getting? btw above code you presented wont compile.