Ok... sweet, i managed to read what i want from the xml.. now, the problem is assigning the data obtain to QObjects/Widgets
#include "lolapp.h"
#include "ui_lolapp.h"
#include "xmlstuff.h"
#include <QtXml>
//General Variables ***********************************************************************************
static void readXml();
bool inDetails,inSkills,inPassive,inQ,inW,inE,inR,inHealth,inMana,inEnergy,inPhys,inMag,inDef,inExtra;
//******************************************************************************************************
ui(new Ui::LOLApp)
{
ui->setupUi(this);
//initialize booleans for xml reading//
inDetails=inSkills=inPassive=inQ=inW=inE=inR=inHealth=inMana=inEnergy=inPhys=inMag=inDef=inExtra=false;
//***********************************
readXml();
}
LOLApp::~LOLApp()
{
delete ui;
}
//FUNCTION DECLARATION
static void readXml() {
QFile myFile
(":/xml/champs/ashe_prototype.xml");
QXmlStreamReader stream( &myFile );
myFile.
open(QFile::ReadOnly);
if (myFile.isOpen()) {
//MESSAGE BOXES**********************************************
mbx.setText(" It is Open XD");
mbx.exec();
//WHILE LOOPS***********************************************
while (!stream.atEnd()){
stream.readNext();
if (stream.isStartElement()) {
if (stream.name()=="Details") {
if (stream.name()=="Name"){
//should add a code to add it to the costume label Champ_Name_Label.
//now here, i am supposed to link the name "Akali" to Champ_Name_Label
//which is located in the form (ui) of this cpp... eg; this is called lolapp.ui
//i tried LOLApp-> LOLApp:: LOLApp. nothing seems to work, i tried it alot...
//i just need to know how to put akali, string, into Champ_Name_Label. thanks
}
}
}
}
} else {
mbx.setText(" It is NOT Open");
mbx.exec();
}
}
#include "lolapp.h"
#include "ui_lolapp.h"
#include "xmlstuff.h"
#include <QtXml>
//General Variables ***********************************************************************************
static void readXml();
bool inDetails,inSkills,inPassive,inQ,inW,inE,inR,inHealth,inMana,inEnergy,inPhys,inMag,inDef,inExtra;
//******************************************************************************************************
LOLApp::LOLApp(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::LOLApp)
{
ui->setupUi(this);
//initialize booleans for xml reading//
inDetails=inSkills=inPassive=inQ=inW=inE=inR=inHealth=inMana=inEnergy=inPhys=inMag=inDef=inExtra=false;
//***********************************
readXml();
}
LOLApp::~LOLApp()
{
delete ui;
}
//FUNCTION DECLARATION
static void readXml() {
QMessageBox mbx;
QFile myFile(":/xml/champs/ashe_prototype.xml");
QXmlStreamReader stream( &myFile );
myFile.open(QFile::ReadOnly);
if (myFile.isOpen()) {
//MESSAGE BOXES**********************************************
mbx.setText(" It is Open XD");
mbx.setStandardButtons(QMessageBox::Abort | QMessageBox::Ok);
mbx.exec();
//WHILE LOOPS***********************************************
while (!stream.atEnd()){
stream.readNext();
if (stream.isStartElement()) {
if (stream.name()=="Details") {
if (stream.name()=="Name"){
//should add a code to add it to the costume label Champ_Name_Label.
//now here, i am supposed to link the name "Akali" to Champ_Name_Label
//which is located in the form (ui) of this cpp... eg; this is called lolapp.ui
//i tried LOLApp-> LOLApp:: LOLApp. nothing seems to work, i tried it alot...
//i just need to know how to put akali, string, into Champ_Name_Label. thanks
}
}
}
}
} else {
mbx.setText(" It is NOT Open");
mbx.exec();
}
}
To copy to clipboard, switch view to plain text mode
Added after 4 minutes:
Ok... sweet, i managed to read what i want from the xml.. now, the problem is assigning the data obtain to QObjects/Widgets
#include "lolapp.h"
#include "ui_lolapp.h"
#include "xmlstuff.h"
#include <QtXml>
//General Variables ***********************************************************************************
static void readXml();
bool inDetails,inSkills,inPassive,inQ,inW,inE,inR,inHealth,inMana,inEnergy,inPhys,inMag,inDef,inExtra;
//******************************************************************************************************
ui(new Ui::LOLApp)
{
ui->setupUi(this);
//initialize booleans for xml reading//
inDetails=inSkills=inPassive=inQ=inW=inE=inR=inHealth=inMana=inEnergy=inPhys=inMag=inDef=inExtra=false;
//***********************************
readXml();
}
LOLApp::~LOLApp()
{
delete ui;
}
//FUNCTION DECLARATION
static void readXml() {
QFile myFile
(":/xml/champs/ashe_prototype.xml");
QXmlStreamReader stream( &myFile );
myFile.
open(QFile::ReadOnly);
if (myFile.isOpen()) {
//MESSAGE BOXES**********************************************
mbx.setText(" It is Open XD");
mbx.exec();
//WHILE LOOPS***********************************************
while (!stream.atEnd()){
stream.readNext();
if (stream.isStartElement()) {
if (stream.name()=="Details") {
if (stream.name()=="Name"){
//should add a code to add it to the costume label Champ_Name_Label.
//now here, i am supposed to link the name "Akali" to Champ_Name_Label
//which is located in the form (ui) of this cpp... eg; this is called lolapp.ui
//i tried LOLApp-> LOLApp:: LOLApp. nothing seems to work, i tried it alot...
//i just need to know how to put akali, string, into Champ_Name_Label. thanks
}
}
}
}
} else {
mbx.setText(" It is NOT Open");
mbx.exec();
}
}
#include "lolapp.h"
#include "ui_lolapp.h"
#include "xmlstuff.h"
#include <QtXml>
//General Variables ***********************************************************************************
static void readXml();
bool inDetails,inSkills,inPassive,inQ,inW,inE,inR,inHealth,inMana,inEnergy,inPhys,inMag,inDef,inExtra;
//******************************************************************************************************
LOLApp::LOLApp(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::LOLApp)
{
ui->setupUi(this);
//initialize booleans for xml reading//
inDetails=inSkills=inPassive=inQ=inW=inE=inR=inHealth=inMana=inEnergy=inPhys=inMag=inDef=inExtra=false;
//***********************************
readXml();
}
LOLApp::~LOLApp()
{
delete ui;
}
//FUNCTION DECLARATION
static void readXml() {
QMessageBox mbx;
QFile myFile(":/xml/champs/ashe_prototype.xml");
QXmlStreamReader stream( &myFile );
myFile.open(QFile::ReadOnly);
if (myFile.isOpen()) {
//MESSAGE BOXES**********************************************
mbx.setText(" It is Open XD");
mbx.setStandardButtons(QMessageBox::Abort | QMessageBox::Ok);
mbx.exec();
//WHILE LOOPS***********************************************
while (!stream.atEnd()){
stream.readNext();
if (stream.isStartElement()) {
if (stream.name()=="Details") {
if (stream.name()=="Name"){
//should add a code to add it to the costume label Champ_Name_Label.
//now here, i am supposed to link the name "Akali" to Champ_Name_Label
//which is located in the form (ui) of this cpp... eg; this is called lolapp.ui
//i tried LOLApp-> LOLApp:: LOLApp. nothing seems to work, i tried it alot...
//i just need to know how to put akali, string, into Champ_Name_Label. thanks
}
}
}
}
} else {
mbx.setText(" It is NOT Open");
mbx.exec();
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks