Yes the value is in the 2nd column. The description is in the 1st column. And the Problem is that i only get the desc in the XML-File because it´s a QString .
I call the Function with this code
writeXml("D:/file.txt",parentTreeWidget);
writeXml("D:/file.txt",parentTreeWidget);
To copy to clipboard, switch view to plain text mode
I get this Output: (attribute=description and the cell will be a id of a TableWidget-Cell).
<?xml version="1.0" encoding="UTF-8"?>
<cell>
<attribute ="">
<attribute ="Path">
<value> </value>
</attribute>
<attribute ="Find Images">
<value> </value>
</attribute>
<attribute ="Duration">
<value> </value>
</attribute>
<attribute ="Visibility">
<value> </value>
</attribute>
<attribute ="strech Images">
<value> </value>
</attribute>
</attribute>
</cell>
It ignores the Top-Level <attribute=""> also. (because it´s a QLineEdit)
when the user input is this:
Unbenannt.PNG
I create the treewidget-entries with this custom method:
{
nameLineEdit->setStyleSheet("QLineEdit { qproperty-frame: false }");
nameLineEdit->setText(headerItemString);
nameLineEdit->setFont(font);
parentTreeWidget->setItemWidget(HeaderItem,0,nameLineEdit);
HeaderItem->setFirstColumnSpanned(true);
for(int i=0;i<arrayLenght;i++)
{
treeItem->setText(0,itemNameString.at(i));
treeItem->setText(1," ");
parentTreeWidget->setItemWidget(treeItem,1,widgets[i]);
}
}
void ImageModul::addTreeEntry(QString headerItemString,QStringList itemNameString,QWidget *widgets[],int arrayLenght)
{
QFont font("Helvetica ", 10, QFont::Bold);
QLineEdit *nameLineEdit = new QLineEdit();
nameLineEdit->setStyleSheet("QLineEdit { qproperty-frame: false }");
nameLineEdit->setText(headerItemString);
nameLineEdit->setFont(font);
QTreeWidgetItem *HeaderItem = new QTreeWidgetItem(parentTreeWidget);
parentTreeWidget->setItemWidget(HeaderItem,0,nameLineEdit);
HeaderItem->setFirstColumnSpanned(true);
for(int i=0;i<arrayLenght;i++)
{
QTreeWidgetItem *treeItem = new QTreeWidgetItem(HeaderItem);
treeItem->setText(0,itemNameString.at(i));
treeItem->setText(1," ");
parentTreeWidget->setItemWidget(treeItem,1,widgets[i]);
}
}
To copy to clipboard, switch view to plain text mode
And in the contructor
ImageModul
::ImageModul(BaseWidget
*parent,
QTreeWidget *p
) : BaseWidget(parent)
{
parentTreeWidget=p;
rows<<"Path"<<"Find Images"<<"Duration"<<"Visibility"
<<"strech Images";
QWidget *w
[5]= {imagePath,imageDirectory,imageTime,imageVisible,imageStrech
};
addTreeEntry("Images",rows,w,5);
ImageModul::ImageModul(BaseWidget *parent,QTreeWidget *p) :
BaseWidget(parent)
{
parentTreeWidget=p;
QStringList rows;
imageName=new QLineEdit();
imagePath=new QLineEdit();
imageTime=new QSpinBox();
imageVisible=new QCheckBox();
imageStrech=new QCheckBox();
imageDirectory=new QPushButton("search...");
rows<<"Path"<<"Find Images"<<"Duration"<<"Visibility"
<<"strech Images";
QWidget *w[5]= {imagePath,imageDirectory,imageTime,imageVisible,imageStrech};
addTreeEntry("Images",rows,w,5);
To copy to clipboard, switch view to plain text mode
Bookmarks