Teraz ta metoda powinna usuwać tylko jeden plus
#include
#include
#include
#include
#include
#include
#include
MyWindow::MyWindow (): QWidget()
{
setGeometry (300,600,300,200);
setWindowTitle ("Algorytm SJF");
pushButton_1 = new QPushButton(this);
pushButton_1->setObjectName(QString::fromUtf8("pushButton_1"));
pushButton_1->setGeometry(QRect(10, 200, 100, 27));
pushButton_1->setText("Zamknięta pula zadań");
for(int i=0;i<10;i++)
{
label1[i] = new QLabel(this);
label1[i]->setGeometry(40, (i+1)*10,175,20);
}
//label1->setGeometry(40, 40, 175, 20);
label2 = new QLabel(this);
label2->setGeometry(70,90,175,20);
connect(pushButton_1,SIGNAL (clicked()),this, SLOT(Nowe_Okno()));
}
void MyWindow::Nowe_Okno()
{
bool ok;
x = QInputDialog::getInteger(this,"Pobieranie liczby","Podaj ilość procesów (od 1-10)", 0,-100,100,1,&ok);
tab = new int[x];
for(int i=0;i
{
tab[i] = Pierwszy(i);
}
if(x!=10)
{
for(int i=x;i<10;i++)
{
label1[i]->setText("");
}
}
for(int i=0;i
{
a = i;
m_timerid = startTimer(500);
}
// delete tab;
}
int MyWindow::Pierwszy(int g)
{
bool ok;
z = QInputDialog::getInteger(this,"Pobieranie liczby","Podaj wartośc", 0,-100,100,1,&ok);
label1[g]->setText(QString(z, '+'));
return z;
}
void MyWindow::timerEvent(QTimerEvent *event)
{
QString tmp;
tmp = label1[a]->text();
tmp.chop(1);
label1[a]->setText(tmp);
if (tmp.isEmpty())
killTimer(m_timerid);
}
Tylko, że robi to znowu tylko dla ostatniego labela, a ja chciałem zrobić tak, że np. wpiszemy że będą 3 procesy, i potem wpiszę długość dla każdego procesu, to będzie usuwało plus najpierw dla pierwszego procesu, jeżeli skończy przechodzi do usuwania plusów dla drugiego i to samo dla trzeciego.