ini:添加配置文件模板
This commit is contained in:
parent
faa64d7ba2
commit
44f1f74c56
@ -5,6 +5,8 @@ MainWidget::MainWidget(QWidget* parent) : QWidget(parent), ui(new Ui::MainWidget
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
setWindowTitle(u8"OneLevelXmlOpr v0.9");
|
||||||
|
|
||||||
width_.push_back(280);
|
width_.push_back(280);
|
||||||
for (int i = 0; i < 30; ++i) {
|
for (int i = 0; i < 30; ++i) {
|
||||||
width_.push_back(160);
|
width_.push_back(160);
|
||||||
@ -62,6 +64,11 @@ void MainWidget::push_content(const std::vector<tinyxml2::XMLElement*>& eles)
|
|||||||
for (auto i = 0; i < keys_.size(); ++i) {
|
for (auto i = 0; i < keys_.size(); ++i) {
|
||||||
const char* data = ele->Attribute(keys_[i].c_str());
|
const char* data = ele->Attribute(keys_[i].c_str());
|
||||||
QTableWidgetItem* wgItem = new QTableWidgetItem();
|
QTableWidgetItem* wgItem = new QTableWidgetItem();
|
||||||
|
|
||||||
|
if (i == 0) {
|
||||||
|
wgItem->setFlags(wgItem->flags() & ~Qt::ItemIsEditable);
|
||||||
|
}
|
||||||
|
|
||||||
wgItem->setText(QString(data));
|
wgItem->setText(QString(data));
|
||||||
tab_widget_->setItem(row_cnt, i, wgItem);
|
tab_widget_->setItem(row_cnt, i, wgItem);
|
||||||
}
|
}
|
||||||
@ -75,14 +82,19 @@ void MainWidget::read()
|
|||||||
}
|
}
|
||||||
OprBase base = ini_.get_config();
|
OprBase base = ini_.get_config();
|
||||||
if (!xml_.open(base.xml_path)) {
|
if (!xml_.open(base.xml_path)) {
|
||||||
|
QString status = u8"Open【" + QString::fromStdString(base.xml_path.c_str()) + u8"】Failed.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
xml_.set_baseinfo(base);
|
xml_.set_baseinfo(base);
|
||||||
if (!xml_.parse_xml(vec_)) {
|
if (!xml_.parse_xml(vec_)) {
|
||||||
|
QString status = u8"parse_xml【" + QString::fromStdString(base.xml_path.c_str()) + u8"】Failed.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
generate_table_widget();
|
generate_table_widget();
|
||||||
push_content(vec_);
|
push_content(vec_);
|
||||||
|
|
||||||
|
QString status = u8"Open And Parse【" + QString::fromLocal8Bit(base.xml_path.c_str()) + u8"】Success.";
|
||||||
|
ui->edStatus->setText(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWidget::search()
|
void MainWidget::search()
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1507</width>
|
<width>1181</width>
|
||||||
<height>908</height>
|
<height>980</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -26,19 +26,6 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="edStatus"/>
|
<widget class="QLineEdit" name="edStatus"/>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer_2">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
1
config/readme.txt
Normal file
1
config/readme.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
配置名字为xmlopr.ini,内容如果含中文,需要GBK或者ANSI编码。
|
5
config/xmlopr-example.ini
Normal file
5
config/xmlopr-example.ini
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[Basic]
|
||||||
|
oper_node=IODEF/ITEMS/
|
||||||
|
the_node=ITEM
|
||||||
|
purpose=name,cat,pr,pw
|
||||||
|
xml_path=D:\中文文件夹 测试\conf-io.xml
|
Loading…
x
Reference in New Issue
Block a user