class GraphInfoPage: public QWizardPage
{
Q_OBJECT
public:
GraphInfoPage();
private:
int num;
};
class VerticesInfoPage: public QWizardPage
{
Q_OBJECT
public:
VerticesInfoPage
(QWidget *parent
= 0);
private:
int num;
const char *str;
char ch[2];
protected:
void initializePage();
public slots:
void handleInt(int i){num=i;}
};
//dynamic.cpp
GraphInfoPage::GraphInfoPage()
{
VerticesInfoPage vertex;
setTitle(tr("<i><font color=blue>Enter Graph Details</font></i>"));
VerticesLabel
= new QLabel(tr
("<b><font color=green>Vertices:</font></b> "));
EdgesLabel
= new QLabel(tr
("<b><font color=green>Edges:</font></b> "));
verticesSpinbox->setRange(0,100);
connect(verticesSpinbox,SIGNAL(valueChanged(int)),&vertex,SLOT(handleInt(int)));
edgesSpinbox->setRange(0,100);
registerField("vertices*",verticesSpinbox);
registerField("edges*",edgesSpinbox);
layout->addWidget(VerticesLabel,0,0);
layout->addWidget(verticesSpinbox,0,1);
layout->addWidget(EdgesLabel,2,0);
layout->addWidget(edgesSpinbox,2,1);
setLayout(layout);
}
VerticesInfoPage
::VerticesInfoPage(QWidget *parent
):QWizardPage
(parent
){
setTitle(tr("<i>Enter vertices: </i>"));
setLayout(layout);
int k=0,j=0;
LineEit->setReadOnly(true);
Spinbox->setValue(num);
layout->addWidget(Spinbox);
//for creating text boxes
for(int i=0;i<num;i++)
{
LineEdit[i]->setMaximumWidth(35);
LineEdit[i]->setMaxLength(3);
layout->addWidget(LineEdit[i],++j,k);
if(j==4){j=0;k++;}
}
}
class GraphInfoPage: public QWizardPage
{
Q_OBJECT
public:
GraphInfoPage();
private:
int num;
QLabel *VerticesLabel;
QLabel *EdgesLabel;
QSpinBox *edgesSpinbox;
QSpinBox *verticesSpinbox;
QGridLayout *layout;
};
class VerticesInfoPage: public QWizardPage
{
Q_OBJECT
public:
VerticesInfoPage(QWidget *parent = 0);
private:
QLineEdit *LineEdit[100];
QLineEdit *LineEit;
int num;
const char *str;
char ch[2];
QGridLayout *layout;
protected:
void initializePage();
public slots:
void handleInt(int i){num=i;}
};
//dynamic.cpp
GraphInfoPage::GraphInfoPage()
{
VerticesInfoPage vertex;
setTitle(tr("<i><font color=blue>Enter Graph Details</font></i>"));
VerticesLabel = new QLabel(tr("<b><font color=green>Vertices:</font></b> "));
layout = new QGridLayout;
EdgesLabel = new QLabel(tr("<b><font color=green>Edges:</font></b> "));
verticesSpinbox=new QSpinBox();
verticesSpinbox->setRange(0,100);
connect(verticesSpinbox,SIGNAL(valueChanged(int)),&vertex,SLOT(handleInt(int)));
edgesSpinbox=new QSpinBox();
edgesSpinbox->setRange(0,100);
registerField("vertices*",verticesSpinbox);
registerField("edges*",edgesSpinbox);
layout->addWidget(VerticesLabel,0,0);
layout->addWidget(verticesSpinbox,0,1);
layout->addWidget(EdgesLabel,2,0);
layout->addWidget(edgesSpinbox,2,1);
setLayout(layout);
}
VerticesInfoPage::VerticesInfoPage(QWidget *parent):QWizardPage(parent)
{
setTitle(tr("<i>Enter vertices: </i>"));
layout = new QGridLayout;
setLayout(layout);
int k=0,j=0;
LineEit=new QLineEdit;
LineEit->setReadOnly(true);
QSpinBox *Spinbox=new QSpinBox();
Spinbox->setValue(num);
layout->addWidget(Spinbox);
//for creating text boxes
for(int i=0;i<num;i++)
{
LineEdit[i]=new QLineEdit;
LineEdit[i]->setMaximumWidth(35);
LineEdit[i]->setMaxLength(3);
layout->addWidget(LineEdit[i],++j,k);
if(j==4){j=0;k++;}
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks