MainWindow::MainWindow()
{
desktopGeometry
= QApplication::desktop()->availableGeometry
(0);
setCentralWidget(scrollArea);
groupBox->setTitle(tr("Mobneu"));
groupBox->setLayout(gridLayout);
// scrollArea->setBackgroundRole(QPalette::Dark);
return ;
if (!doc.setContent(&file)) {
file.close();
return ;
}
file.close();
//QString NodeName = q.nodeName();
//QString NodeValue = q.nodeValue();
int count=0;
int count2=0;
array2=new QVector< QString>;
int cont2=0;
//attr[20]=new QString;
// QVector< QVector<QString> *>vvStr;
// QVector<QString> *vStr = new QVector<QString>;
// QVector<QString> *Temp = new QVector<QString>;
// QVector<QString> *Temp2 = new QVector<QString>;
array.resize(20);
for (int i = 0; i < 20; ++i)
array[i].resize(20);
// QVector<QString> *vect;
int k=0;
int i=0;
int ciccio=0;
int cont=0;
while(!n.isNull()) {
cont=0;
QDomElement e
= n.
toElement();
// try to convert the node to an element. if(!e.isNull()) {
label
[i
]=new QLabel(groupBox
);
label[i]->setText(qPrintable(e.tagName()));
set[i]->append(qPrintable(e.tagName())).toCaseFolded();
count++;
qDebug() << qPrintable(e.tagName()) ; // the node really is an element.
}
while(!p.isNull()) {
cont++;
labelData[k]->setText(qPrintable(e.tagName()));
param[k]->append(qPrintable(e.tagName()));
param2[k]->append(param[k]->toLower());
if(!e.isNull()) {
count2++;
qDebug() << qPrintable(e.tagName()) ; // the node really is an element.
}
cont2=0;
while(!q.isNull()) {
cont2++;
srcValue=qPrintable( q.attributes().namedItem( "value" ).nodeValue());
// wid->append(srcValue);
textEdit[ciccio]->setMaximumSize(150,70);
textEdit[ciccio]->append(srcValue);
attr[ciccio]->append(qString2);
if(!e.isNull()) {
array2->insert(ciccio,srcValue);
array[k][ciccio]=srcValue;
//vStr->append(srcValue);
// qDebug() << srcValue ; // the node really is an element.
// qDebug()<<vStr->at(k);
}
// qDebug() << k ;
ciccio++;
q=q.nextSibling();
}
// qDebug() << vStr->at(k);
//qDebug() << count;
p = p.nextSibling();
qDebug() << cont2;
conteggio2[k]=cont2;
k++;
}
conteggio[i]=cont;
i++;
parametr=i;
//qDebug()<< i;
n = n.nextSibling();
// count=0;
}
// qDebug()<<vStr->count();
// qDebug()<<vvStr.count();
// qDebug()<<Temp2->at(0);
//qDebug()<<Temp->at(1);
// qDebug()<<Temp2->at(1);
// QVBoxLayout *lay=new QVBoxLayout(scrollArea);
qDebug()<<conteggio2[0];
qDebug()<<conteggio2[1];
qDebug()<<conteggio2[2];
int h=0;
int f=0;
int u=0;
int o=0;
int p=0;
for (int i = 0;i <parametr; i++) {
if(o!=0){
o=o+1;
}
gridLayout->addWidget(label[i],i+h,0);
for ( int j=0 ;j <conteggio[i]; j++){
gridLayout->addWidget(labelData[h],f+1,1);
h++;
f++;
for(int s=0;s<conteggio2[p];s++){
gridLayout->addWidget(textEdit[u],o+1,s+2);
u++;
}
o++;
//u=0;
//u=u+conteggio2[j];
p++;
}
// h=0;
// h=h+conteggio[i];
f=f+1;
//gridLayout->addWidget(textEdit[i][j],j+1,2);
//lay.addWidget(ses,i,0);
}
for(int i=0;i<count;i++)
qDebug()<<set[i]->toCaseFolded();
for(int i=0;i<count2;i++)
qDebug()<<param[i]->toLower();
for(int i=0;i<3;i++){
for(int j=0;j<5;j++){
qDebug()<<array[i][j];
}
}
for(int i=0;i<2;i++)
qDebug()<<conteggio[i];
qDebug()<<conteggio2[2];
for(int i=0;i<2;i++)
qDebug()<<param2[i];
/*
nlayLabel = new QLabel(tr("NLAYER ="));
numnoLabel = new QLabel(tr("NUMNODI ="));
dlayLabel = new QLabel(tr("DISPLAYER ="));
domainLabel = new QLabel(tr("DOMAIN ="));
etaeLabel = new QLabel(tr("ETAERR ="));
etathLabel = new QLabel(tr("ETATHETA ="));
etaLabel1 = new QLabel(tr("ETA1 ="));
etaLabel2 = new QLabel(tr("ETA2 ="));
etaLabel3 = new QLabel(tr("ETA3 ="));
*/
// gridLayout->addWidget(nlayLabel,3,0);
// gridLayout->addWidget(numnoLabel,4,0);
// gridLayout->addWidget(dlayLabel,5,0);
if (desktopGeometry.height() < 400){
gridLayout->setVerticalSpacing(80);
}
else{
gridLayout->setVerticalSpacing(10); //150
}
// gridLayout->addWidget(label);
// gridLayout->addWidget(lineEdit);
// gridLayout->addWidget(button);
scrollArea->setWidget(groupBox);
scrollArea->setGeometry(20,30,700,600);
layout->addWidget(scrollArea,2,0);
// setLayout(layout);
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
//scrollArea->setWidgetResizable(true);
connect(QApplication::desktop(),
SIGNAL(workAreaResized
(int)),
this, SLOT(desktopResized(int)));
// lay->addWidget(scrollArea);
// setLayout(lay);
setStyleSheet("QAbstractScrollArea { margin: 20px; }");
createActions();
createMenus();
setWindowTitle(tr("XML file"));
resize(800, 800);
}
void MainWindow::desktopResized(int screen)
{
if (screen != 0)
return;
reactToSIP();
}
void MainWindow::reactToSIP()
{
if (desktopGeometry != availableGeometry) {
if (windowState() | Qt::WindowMaximized)
setWindowState(windowState() & ~Qt::WindowMaximized);
setGeometry(availableGeometry);
}
desktopGeometry = availableGeometry;
}
void MainWindow::open()
{
QFileDialog::getOpenFileName(this, tr
("Open xml File"),
tr("XML Files (*.xml)"));
if (fileName.isEmpty())
return;
QMessageBox::warning(this, tr
("xml"), tr
("Cannot read file %1:\n%2.") .arg(fileName)
.arg(file.errorString()));
return;
}