Solved how to read the text of pushbutton in XML Qt
-
@sankarapandiyan Can you post the WHOLE code of that method?
What is before{ QDomDocument document;
?
Do you have a loop there? -
@jsulm no no there is no loop
-
@sankarapandiyan Actually there is:
for (int var = 0; var < ui->mwtabwidget->count(); ++var) { qDebug() << ui->mwtabwidget->tabText(var); QString text = ui->mwtabwidget->tabText(var); QDomElement elemTab = document.createElement("Scanmode") ; elemTab.setAttribute("tab"+QString::number(var+1), text); QDomElement root = document.createElement("pushbuttn_text");
-
@jsulm but that is for reading the tabwidget of tabs only i think !!!!!!
-
@sankarapandiyan
You have missed aappendChild
to the main root element. -
@Ratzz oh really where ?!! i dnt know
-
This post is deleted! -
@sankarapandiyan said in how to read the text of pushbutton in XML Qt:
oh really where ?!! i dnt know
Can you write the exact output you want .
Write tag wise in words.
may be image also helps. -
@Ratzz
<3D wide/>
<Scanmode Tab1="Default"/>
<Scanmode tab2="Macula"/>
<Scanmode tab2="Glucoma"/>this is the output
2 nd 3rd and 4th line is the tab widet of tabs ,i am using the loop there to get the tab widget of tabs(text) -
@sankarapandiyan said in how to read the text of pushbutton in XML Qt:
this is the output
Then where should the push button needs to be placed??
what is thess
tag for? -
-
finally got the output by this code ,
QDomDocument document;// Making the root element
QDomElement root = document.createElement("OCT_TOUCH");// Adding the root element to the docuemnt document.appendChild(root); for (int var = 0; var < ui->mwtabwidget->count(); ++var) { qDebug() << ui->mwtabwidget->tabText(var); QString text = ui->mwtabwidget->tabText(var); QDomElement elemTab = document.createElement("Scanmode") ;// + QString::number(var)); elemTab.setAttribute("tab"+QString::number(var+1), text); root.appendChild(elemTab); } QList<QPushButton*> blist = ui->frame_2->findChildren<QPushButton*>(); for (int cc = 0; cc < blist.count(); ++cc) { QString text = blist[cc]->text(); QDomElement elemTab1 = document.createElement(/*"button"*/text) ; root.appendChild(elemTab1);
thanks all especially @mrjj @Ratzz @jsulm
this is the output @Ratzz
<OCT_TOUCH>
<Scanmode tab1="DEFAULT"/>
<Scanmode tab2="MACULA"/>
<Scanmode tab3="GLAUCOMA"/>
<3D_DISC/>
<FUNDUS_PHOTO/>
<WIDE_3D/>
<5LINE_CROSS/>
</OCT_TOUCH> -
@sankarapandiyan said in how to read the text of pushbutton in XML Qt:
finally got the output by this code
Can you show the output xml file with all the tabs included.
Edit: Only 1 tab has pushbuttons? -
@Ratzz https://www.dropbox.com/s/a8e02txdeeii3hi/filenamemw.xml?dl=0
this is the output -
@sankarapandiyan said in how to read the text of pushbutton in XML Qt:
https://www.dropbox.com/s/a8e02txdeeii3hi/filenamemw.xml?dl=0
Is it code of yours or screenshot? In office its blocked for me so I cannot open.
-
@sankarapandiyan said in how to read the text of pushbutton in XML Qt:
finally got the output by this code ,
Your code reads button of only one frame of the first tab widget.
So there are no buttons on other tab or you forgot to read? -
@Ratzz yeah i know very well..frst i think i have to read one frame now..
And i have completed .so its easy to read the second frame too