Home > Mobile >  Qt association between provinces and cities in the model/view implementation problems?
Qt association between provinces and cities in the model/view implementation problems?

Time:09-23

Has recently been groped in QT application in python, encounter a problem is how to match them with the provinces and cities in the Tableview, according to



The first column shows the province



Corresponding to the second column shows the provinces city (Shanxi Province show only city, Shanxi Province, shaanxi shows that shaanxi province city only)

In the use of custom agent, setItemDelegateForColumn (int column, QAbstractItemDelegate * delegate), unable to achieve the above functions,
Test database can't satisfy the function of the above,
Whether the model - the view to be unable to achieve the above functions, there is no interaction between data items in the model,
Bosses give some ideas genuflect is begged

CodePudding user response:

To combine the delegate to use, please see my blog at https://mp.csdn.net/postedit/79053684

CodePudding user response:

this problem solved, the delegate I've done, before and after the key point is the item link,
Solve the general train of thought is
(1) the first thing you need to know the current value of the index, the selectionModel ways for
And know the current index (2) can be controlled by the position of the item before the current position of the value of the content, can be realized through a slot function,
  •  Tags:  
  • Qt
  • Related