basicobjectcontroller.cpp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726
  1. 
  2. #include "objectcontroller.h"
  3. #include "qtvariantproperty.h"
  4. #include "qtgroupboxpropertybrowser.h"
  5. #include "qttreepropertybrowser.h"
  6. #include "qtpropertybrowser.h"
  7. #include "variantfactory.h"
  8. #include "variantmanager.h"
  9. QMap<QString, QString> propertyNamesMap;
  10. BasicObjectController::BasicObjectController()
  11. {
  12. propertyNamesMap.insert("tip", "文本");
  13. propertyNamesMap.insert("title", "标题");
  14. propertyNamesMap.insert("dataLink", "链接");
  15. propertyNamesMap.insert("textColor", "文本色");
  16. propertyNamesMap.insert("bgColor", "背景色");
  17. propertyNamesMap.insert("Red", "红");
  18. propertyNamesMap.insert("Green", "绿");
  19. propertyNamesMap.insert("Blue", "蓝");
  20. propertyNamesMap.insert("Alpha", "明度");
  21. propertyNamesMap.insert("font", "字体");
  22. propertyNamesMap.insert("enable", "启用");
  23. propertyNamesMap.insert("rowCount", "行数");
  24. propertyNamesMap.insert("colCount", "列数");
  25. }
  26. int BasicObjectController::enumToInt(const QMetaEnum &metaEnum, int enumValue) const
  27. {
  28. QMap<int, int> valueMap; // dont show multiple enum values which have the same values
  29. int pos = 0;
  30. for (int i = 0; i < metaEnum.keyCount(); i++) {
  31. int value = metaEnum.value(i);
  32. if (!valueMap.contains(value)) {
  33. if (value == enumValue) {
  34. return pos;
  35. }
  36. valueMap[value] = pos++;
  37. }
  38. }
  39. return -1;
  40. }
  41. int BasicObjectController::intToEnum(const QMetaEnum &metaEnum, int intValue) const
  42. {
  43. QMap<int, bool> valueMap; // dont show multiple enum values which have the same values
  44. QList<int> values;
  45. for (int i = 0; i < metaEnum.keyCount(); i++) {
  46. int value = metaEnum.value(i);
  47. if (!valueMap.contains(value)) {
  48. valueMap[value] = true;
  49. values.append(value);
  50. }
  51. }
  52. if (intValue >= values.count()) {
  53. return -1;
  54. }
  55. return values.at(intValue);
  56. }
  57. bool BasicObjectController::isSubValue(int value, int subValue) const
  58. {
  59. if (value == subValue) {
  60. return true;
  61. }
  62. int i = 0;
  63. while (subValue) {
  64. if (!(value & (1 << i))) {
  65. if (subValue & 1) {
  66. return false;
  67. }
  68. }
  69. i++;
  70. subValue = subValue >> 1;
  71. }
  72. return true;
  73. }
  74. bool BasicObjectController::isPowerOf2(int value) const
  75. {
  76. while (value) {
  77. if (value & 1) {
  78. return value == 1;
  79. }
  80. value = value >> 1;
  81. }
  82. return false;
  83. }
  84. int BasicObjectController::flagToInt(const QMetaEnum &metaEnum, int flagValue) const
  85. {
  86. if (!flagValue) {
  87. return 0;
  88. }
  89. int intValue = 0;
  90. QMap<int, int> valueMap; // dont show multiple enum values which have the same values
  91. int pos = 0;
  92. for (int i = 0; i < metaEnum.keyCount(); i++) {
  93. int value = metaEnum.value(i);
  94. if (!valueMap.contains(value) && isPowerOf2(value)) {
  95. if (isSubValue(flagValue, value)) {
  96. intValue |= (1 << pos);
  97. }
  98. valueMap[value] = pos++;
  99. }
  100. }
  101. return intValue;
  102. }
  103. int BasicObjectController::intToFlag(const QMetaEnum &metaEnum, int intValue) const
  104. {
  105. QMap<int, bool> valueMap; // dont show multiple enum values which have the same values
  106. QList<int> values;
  107. for (int i = 0; i < metaEnum.keyCount(); i++) {
  108. int value = metaEnum.value(i);
  109. if (!valueMap.contains(value) && isPowerOf2(value)) {
  110. valueMap[value] = true;
  111. values.append(value);
  112. }
  113. }
  114. int flagValue = 0;
  115. int temp = intValue;
  116. int i = 0;
  117. while (temp) {
  118. if (i >= values.count()) {
  119. return -1;
  120. }
  121. if (temp & 1) {
  122. flagValue |= values.at(i);
  123. }
  124. i++;
  125. temp = temp >> 1;
  126. }
  127. return flagValue;
  128. }
  129. void BasicObjectController::expandAll()
  130. {
  131. //打开所有节点
  132. QtTreePropertyBrowser *browser = (QtTreePropertyBrowser *)m_browser;
  133. browser->expandAll();
  134. }
  135. void BasicObjectController::collapseAll()
  136. {
  137. //折叠所有节点
  138. QtTreePropertyBrowser *browser = (QtTreePropertyBrowser *)m_browser;
  139. browser->collapseAll();
  140. //展开父节点
  141. QList<QtBrowserItem *> items = browser->topLevelItems();
  142. for (QtBrowserItem *item : items)
  143. {
  144. browser->setExpanded(item, true);
  145. }
  146. }
  147. /// <summary>
  148. /// 设置控件属性
  149. /// </summary>
  150. /// <param name="metaObject"></param>
  151. void BasicObjectController::setBasicControlProperties(const QMetaObject* metaObject)
  152. {
  153. if (!metaObject)
  154. {
  155. return;
  156. }
  157. // 取出属于本控件的控件属性组
  158. QtProperty* classProperty = m_classToProperty.value(metaObject);
  159. // 重新创建新的属性表
  160. if (!classProperty)
  161. {
  162. // 首先添加基础属性
  163. addBasicProperties(metaObject, classProperty);
  164. // // 如果是复杂类型,还需要添加扩展属性
  165. // QString strClassName = metaObject->className();
  166. // if (strClassName == CLASS_NAME_TABLECONTROL)
  167. // {
  168. //// 添加扩展属性
  169. //addExtendProperties(classProperty);
  170. // }
  171. }
  172. // 如果之前已经创建过本类型控件的属性表,那么直接从数据结构中更新即可
  173. else
  174. {
  175. // 首先更新基础属性
  176. updateBasicProperties(metaObject);
  177. // // 如果是复杂类型,还需要更新扩展属性
  178. //QString strClassName = metaObject->className();
  179. //if (strClassName == CLASS_NAME_TABLECONTROL)
  180. //{
  181. // // 添加扩展属性
  182. // updateExtendProperties(metaObject);
  183. //}
  184. }
  185. // 保存根节点
  186. m_topLevelProperties.append(classProperty);
  187. // 界面中添加此根节点
  188. m_browser->addProperty(classProperty);
  189. // 展开属性表
  190. this->expandAll();
  191. }
  192. /// <summary>
  193. /// 建立控件的基础属性表
  194. /// </summary>
  195. /// <param name="metaObject"></param>
  196. /// <param name="classProperty"></param>
  197. void BasicObjectController::addBasicProperties(const QMetaObject *metaObject, QtProperty*& classProperty)
  198. {
  199. // 获取类名,根据类型名建立属性表根节点
  200. QString className = QLatin1String(metaObject->className());
  201. // 创建根节点
  202. classProperty = m_manager->addProperty(QtVariantPropertyManager::groupTypeId(), className);
  203. // 保存根节点和控件对象的对应关系
  204. m_classToProperty[metaObject] = classProperty;
  205. //m_propertyToClass[classProperty] = metaObject;
  206. int nPropertyCount = metaObject->propertyCount();
  207. int nPropertyOffset = metaObject->propertyOffset();
  208. // 遍历所有的固定属性执行添加
  209. for (int idx = nPropertyOffset; idx < nPropertyCount; idx++)
  210. {
  211. // 取出对应的固定属性
  212. QMetaProperty metaProperty = metaObject->property(idx);
  213. // 取出属性的Type值
  214. int type = metaProperty.userType();
  215. // 准备添加子属性节点(注意要保存带值的子属性,需要用QtVariantProperty类型)
  216. QtVariantProperty* subProperty = 0;
  217. // 英文属性名称
  218. QString propertyName = metaProperty.name();
  219. // 中文属性名称
  220. propertyName = propertyNamesMap.value(propertyName);
  221. // 确保是所支持的类型
  222. if (m_manager->isPropertyTypeSupported(type))
  223. {
  224. // 添加属性
  225. subProperty = m_manager->addProperty(type, propertyName);
  226. // 设置值
  227. subProperty->setValue(metaProperty.read(m_object));
  228. }
  229. // 设置无效属性
  230. else
  231. {
  232. subProperty = m_readOnlyManager->addProperty(QVariant::String, propertyName);
  233. subProperty->setValue(QLatin1String("< Unknown Type >"));
  234. subProperty->setEnabled(false);
  235. }
  236. // 根节点下添加此子节点
  237. classProperty->addSubProperty(subProperty);
  238. // 保存此子属性和索引值的对应关系
  239. m_propertyToIndex[subProperty] = idx;
  240. // 保存根节点下所有子节点和子属性的对应关系
  241. m_classToIndexToProperty[metaObject][idx] = subProperty;
  242. }
  243. }
  244. /// <summary>
  245. /// 设置复杂控件属性
  246. /// </summary>
  247. void BasicObjectController::setComplexControlProperties()
  248. {
  249. if (!m_object)
  250. {
  251. return;
  252. }
  253. // 取出属于本控件的控件属性组
  254. QtProperty* objectProperty = m_objectToProperty.value(m_object);
  255. // 重新创建新的属性表
  256. if (!objectProperty)
  257. {
  258. // 首先添加基础属性
  259. //addBasicProperties(metaObject, classProperty);
  260. // // 如果是复杂类型,还需要添加扩展属性
  261. // QString strClassName = metaObject->className();
  262. // if (strClassName == CLASS_NAME_TABLECONTROL)
  263. // {
  264. //// 添加扩展属性
  265. //addExtendProperties(classProperty);
  266. // }
  267. }
  268. // 如果之前已经创建过本类型控件的属性表,那么直接从数据结构中更新即可
  269. else
  270. {
  271. // 首先更新基础属性
  272. //updateBasicProperties(metaObject);
  273. // // 如果是复杂类型,还需要更新扩展属性
  274. //QString strClassName = metaObject->className();
  275. //if (strClassName == CLASS_NAME_TABLECONTROL)
  276. //{
  277. // // 添加扩展属性
  278. // updateExtendProperties(metaObject);
  279. //}
  280. }
  281. // 保存根节点
  282. m_topLevelProperties.append(objectProperty);
  283. // 界面中添加此根节点
  284. m_browser->addProperty(objectProperty);
  285. // 展开属性表
  286. this->expandAll();
  287. }
  288. /// <summary>
  289. /// 增加新的扩展属性表(仅复杂控件才有)
  290. /// </summary>
  291. /// <param name="metaObject"></param>
  292. /// <param name="classProperty"></param>
  293. void BasicObjectController::addExtendProperties(QtProperty*& classProperty)
  294. {
  295. // 获取Table控件指针
  296. VTableControl* pTable = qobject_cast<VTableControl*>(m_object);
  297. // 取出对应的扩展属性
  298. const CONTROL_PROPERTY_EX& props = pTable->getPropertyEx();
  299. // 取出每一项Item
  300. const QVector<PROPERTY_EX_SUBGROUP>& propsItems = props.m_subGroups;
  301. // 扩展属性的数量
  302. int nExCount = propsItems.size();
  303. if (nExCount <= 0)
  304. {
  305. return;
  306. }
  307. qDebug() << "ObjectControllerPrivate::addExtendProperties - Count:" << nExCount;
  308. // 建立扩展属性根节点
  309. m_exPropertiesRoot = m_manager->addProperty(QtVariantPropertyManager::groupTypeId(), props.m_strTitle);
  310. // 添加列索引属性
  311. QtVariantProperty* item = m_manager->addProperty(VariantManager::tagDataLinkTypeId(), props.m_linkIndexName);
  312. // 数据链接值
  313. item->setValue("");
  314. // 保存子项和名字的对应关系
  315. m_propertyToName.insert(item, props.m_linkIndexName);
  316. // 添加此子分组
  317. m_exPropertiesRoot->addSubProperty(item);
  318. // 2021-12-24 保存本属性对应关系,用于后续查找和更新
  319. m_objectToNameToProperty[m_object][props.m_linkIndexName] = item;
  320. // 循环将所有子项添加到属性表中
  321. for (int i = 0; i < nExCount; i++)
  322. {
  323. this->addPropertiesSubGroup(propsItems[i]);
  324. }
  325. // 在本属性组中添加本属性根节点
  326. classProperty->addSubProperty(m_exPropertiesRoot);
  327. }
  328. /// <summary>
  329. /// 更新基础属性表
  330. /// </summary>
  331. /// <param name="metaObject"></param>
  332. /// <param name="recursive"></param>
  333. void BasicObjectController::updateBasicProperties(const QMetaObject* metaObject)
  334. {
  335. if (!metaObject)
  336. {
  337. return;
  338. }
  339. // // 是否递归(未使用)
  340. //if (recursive)
  341. //{
  342. // updateBasicProperties(metaObject->superClass(), recursive);
  343. //}
  344. // // 从数据结构中取出本组属性表节点
  345. //QtProperty* classProperty = m_classToProperty.value(metaObject);
  346. //if (!classProperty)
  347. //{
  348. // return;
  349. //}
  350. // 遍历所有的属性更新数值
  351. for (int idx = metaObject->propertyOffset(); idx < metaObject->propertyCount(); idx++)
  352. {
  353. QMetaProperty metaProperty = metaObject->property(idx);
  354. if (metaProperty.isReadable())
  355. {
  356. // 从数据结构中找到对应的子属性
  357. if (m_classToIndexToProperty.contains(metaObject)
  358. && m_classToIndexToProperty[metaObject].contains(idx))
  359. {
  360. QtVariantProperty* subProperty = m_classToIndexToProperty[metaObject][idx];
  361. // 设置属性值
  362. QVariant propertyValue = metaProperty.read(m_object);
  363. //QString valueString = propertyValue.toString();
  364. //QString propertyName = subProperty->propertyName();
  365. //if (valueString.isEmpty())
  366. //{
  367. // subProperty->setValue("");
  368. //}
  369. //else
  370. //{
  371. subProperty->setValue(propertyValue);
  372. //}
  373. }
  374. }
  375. }
  376. }
  377. /// <summary>
  378. /// 更新扩展属性表
  379. /// </summary>
  380. void BasicObjectController::updateExtendProperties(const QMetaObject* metaObject)
  381. {
  382. // 获取Table控件指针
  383. VTableControl* pTable = qobject_cast<VTableControl*>(m_object);
  384. // 取出对应的扩展属性
  385. const CONTROL_PROPERTY_EX& props = pTable->getPropertyEx();
  386. // 取出每一项Item
  387. const QVector<PROPERTY_EX_SUBGROUP>& propsItems = props.m_subGroups;
  388. // 扩展属性的数量
  389. int nExCount = propsItems.size();
  390. if (nExCount <= 0)
  391. {
  392. return;
  393. }
  394. qDebug() << "ObjectControllerPrivate::updateExtendProperties - Count:" << nExCount;
  395. // Memo:由于前面setControlProperties()的判断是根据metaObject按照控件种类判断的
  396. // 所以此处虽然执行了update,但是只能说明本大类的控件要做更新,但是有可能本类的这个object
  397. // 属性表都没有建立,所以需要重新建立一下属性表
  398. if (!m_objectToNameToProperty[m_object].contains(props.m_linkIndexName))
  399. {
  400. QtProperty* classProperty = m_classToProperty.value(metaObject);
  401. // this->addExtendProperties(classProperty);
  402. }
  403. else
  404. {
  405. // 遍历所有的扩展属性,全部更新一遍
  406. // 更新列索引
  407. QtVariantProperty* subProperty = m_objectToNameToProperty[m_object][props.m_linkIndexName];
  408. subProperty->setValue(props.m_linkIndex.toString());
  409. // 更新每一个子属性值
  410. }
  411. }
  412. /// <summary>
  413. /// 向界面属性表中增加属性内容
  414. /// </summary>
  415. /// <param name="prop"></param>
  416. void BasicObjectController::addPropertiesSubGroup(const PROPERTY_EX_SUBGROUP& prop)
  417. {
  418. // 创建子分组
  419. QtProperty* subGroup = m_manager->addProperty(
  420. QtVariantPropertyManager::groupTypeId(),
  421. prop.m_strName
  422. );
  423. // 添加子项
  424. // 子项名
  425. QtVariantProperty* item = m_manager->addProperty(QVariant::String, prop.m_strValueName);
  426. // 子项值
  427. item->setValue(prop.m_strValue);
  428. // 添加子项
  429. subGroup->addSubProperty(item);
  430. // 保存子项和名字的对应关系
  431. m_propertyToName.insert(item, prop.m_strValueName);
  432. // 2021-12-24 保存本属性对应关系,用于后续查找和更新
  433. m_objectToNameToProperty[m_object][prop.m_strValueName] = item;
  434. // 数据链接项名
  435. item = m_manager->addProperty(VariantManager::tagDataLinkTypeId(), prop.m_dataLinkName);
  436. // 数据链接值
  437. item->setValue("");
  438. // 添加数据链接
  439. subGroup->addSubProperty(item);
  440. // 保存子项和名字的对应关系
  441. m_propertyToName.insert(item, prop.m_dataLinkName);
  442. // 2021-12-24 保存本属性对应关系,用于后续查找和更新
  443. m_objectToNameToProperty[m_object][prop.m_dataLinkName] = item;
  444. // 添加此子分组
  445. m_exPropertiesRoot->addSubProperty(subGroup);
  446. // 保存这个SubGroup的信息(用于删除使用)
  447. m_subGroups.push_back(subGroup);
  448. }
  449. void BasicObjectController::saveExpandedState()
  450. {
  451. }
  452. void BasicObjectController::restoreExpandedState()
  453. {
  454. }
  455. /// <summary>
  456. /// 属性表数据变动槽函数
  457. /// </summary>
  458. void BasicObjectController::slotValueChanged(QtProperty *property, const QVariant &value)
  459. {
  460. qDebug() << "ObjectControllerPrivate::slotValueChanged - Property: " << property->propertyName() << " - Value: " << value.toString();
  461. // 基础属性
  462. if (m_propertyToIndex.contains(property))
  463. {
  464. this->changeBasicProperties(property, value);
  465. }
  466. // 动态属性
  467. else
  468. {
  469. QString className = m_object->metaObject()->className();
  470. // 如果是Table控件相关属性变更
  471. if (className == CLASS_NAME_TABLECONTROL)
  472. {
  473. // 动态属性
  474. this->changeExtendProperties(property, value);
  475. }
  476. }
  477. //if (!m_propertyToIndex.contains(property)) {
  478. // return;
  479. //}
  480. //int idx = m_propertyToIndex.value(property);
  481. //const QMetaObject *metaObject = m_object->metaObject();
  482. //QMetaProperty metaProperty = metaObject->property(idx);
  483. //if (metaProperty.isEnumType()) {
  484. // if (metaProperty.isFlagType()) {
  485. // metaProperty.write(m_object, intToFlag(metaProperty.enumerator(), value.toInt()));
  486. // } else {
  487. // metaProperty.write(m_object, intToEnum(metaProperty.enumerator(), value.toInt()));
  488. // }
  489. //} else {
  490. // metaProperty.write(m_object, value);
  491. //}
  492. //updateClassProperties(metaObject, true);
  493. }
  494. /// <summary>
  495. /// 更新基础属性
  496. /// </summary>
  497. /// <param name="property"></param>
  498. /// <param name="value"></param>
  499. void BasicObjectController::changeBasicProperties(QtProperty* property, const QVariant& value)
  500. {
  501. int idx = m_propertyToIndex.value(property);
  502. const QMetaObject *metaObject = m_object->metaObject();
  503. QMetaProperty metaProperty = metaObject->property(idx);
  504. metaProperty.write(m_object, value);
  505. updateBasicProperties(metaObject);
  506. // 额外处理:如果刷新的是colCount,还需要动态调整一下Table的表格
  507. QString propertyName = metaProperty.name();
  508. QString className = metaObject->className();
  509. if (className == CLASS_NAME_TABLECONTROL
  510. && propertyName == COL_COUNT_NAME)
  511. {
  512. // updateTablePropertyCount(value.toInt());
  513. // 获取Table控件指针
  514. VTableControl* pTable = qobject_cast<VTableControl*>(m_object);
  515. // 计算新的列数
  516. int newCount = value.toInt();
  517. int nFixCount = newCount - pTable->getPropertyExSubGroupCount();
  518. if (nFixCount > 0)
  519. {
  520. this->appendTableProperty(pTable, nFixCount);
  521. }
  522. else if( nFixCount < 0)
  523. {
  524. this->removeTableProperty(pTable, nFixCount);
  525. }
  526. }
  527. }
  528. /// <summary>
  529. /// 更新扩展属性
  530. /// </summary>
  531. /// <param name="property"></param>
  532. /// <param name="value"></param>
  533. void BasicObjectController::changeExtendProperties(QtProperty* property, const QVariant& value)
  534. {
  535. // 找到属性对应的属性名字
  536. if (m_propertyToName.contains(property))
  537. {
  538. // 获取Table指针
  539. VTableControl* pTable = qobject_cast<VTableControl*>(m_object);
  540. // 获取改变的属性Name
  541. QString strValueTitle = m_propertyToName[property];
  542. // 如果改变了列标题
  543. if (strValueTitle.indexOf(PROPERTY_EX_VALUE_NAME) != -1)
  544. {
  545. // 获取修改属性的列索引
  546. int nColIndex = strValueTitle.remove(PROPERTY_EX_VALUE_NAME).toInt() - 1;
  547. // 修改对应Table的数据结构内容
  548. pTable->updateColTitle(value.toString(), nColIndex);
  549. }
  550. // 如果改变了数据链接
  551. else if (strValueTitle.indexOf(PROPERTY_EX_LINK_NAME) != -1)
  552. {
  553. }
  554. }
  555. }
  556. /// <summary>
  557. /// 增加新的属性项
  558. /// </summary>
  559. /// <param name="pTable"></param>
  560. /// <param name="newCount"></param>
  561. void BasicObjectController::appendTableProperty(VTableControl* pTable, const int fixCount)
  562. {
  563. // 首先控件中增加新的数据结构信息
  564. pTable->updateExPropertyCount(fixCount);
  565. // 获取最新的属性数据
  566. const QVector<PROPERTY_EX_SUBGROUP>& propsItems = pTable->getPropertyEx().m_subGroups;
  567. // 同步进行界面信息变更
  568. int nStart = pTable->getPropertyExSubGroupCount() - fixCount;
  569. int nEnd = nStart + fixCount;
  570. for (int i = nStart; i < nEnd; i++)
  571. {
  572. this->addPropertiesSubGroup(propsItems[i]);
  573. }
  574. }
  575. /// <summary>
  576. /// 减少新的属性项
  577. /// </summary>
  578. /// <param name="pTable"></param>
  579. /// <param name="newCount"></param>
  580. void BasicObjectController::removeTableProperty(VTableControl* pTable, const int fixCount)
  581. {
  582. // 首先控件中减少数据结构信息
  583. pTable->updateExPropertyCount(fixCount);
  584. // 同步进行界面信息变更
  585. int nDelCount = -fixCount;
  586. // 从后往前依次删除掉属性
  587. for (int i = 0; i < nDelCount; i++)
  588. {
  589. QtProperty* pDelSubGroup = m_subGroups.back();
  590. // m_browser->removeProperty(pDelProperty);
  591. // 删除子属性
  592. m_exPropertiesRoot->removeSubProperty(pDelSubGroup);
  593. m_subGroups.pop_back();
  594. }
  595. }