Home > Mobile >  QTableWidget built-in custom controls in the location problem
QTableWidget built-in custom controls in the location problem

Time:09-18

Soon I contact QT libraries, encounter the following problems in the practice,
As shown, the third column in the QTableWidget embedded is custom object (the combination of the three buttons, delete, up, down), through the three buttons to achieve the corresponding function, but can't locate the point in using line button,
Found on the Internet is shown in figure 2, the method of sender () object location of emission signal, and then through the button. The pos (), and the self. The indexAt () to locate the line, but actually found when using the button. The pos () returns the position is relative to its parent control TableBtnGroup control, so these buttons to locate through indexAt line, if the common QPushButton does not exist the problem,
I want to know that I still have what method can locate the button's line number?

CodePudding user response:

MapToParent can don't know,,
Or directly to reload button (or put a button that controls) to write a line number in the button id, signal all received the same slot function outside, judging by the id which line detection is?

CodePudding user response:

refer to the original poster I know it's your reply:
I contact soon QT libraries, encounter the following problems in the practice,
As shown, the third column in the QTableWidget embedded is custom object (the combination of the three buttons, delete, up, down), through the three buttons to achieve the corresponding function, but can't locate the point in using line button,
Found on the Internet is shown in figure 2, the method of sender () object location of emission signal, and then through the button. The pos (), and the self. The indexAt () to locate the line, but actually found when using the button. The pos () returns the position is relative to its parent control TableBtnGroup control, so these buttons to locate through indexAt line, if the common QPushButton does not exist the problem,
I want to know that I still have what method can locate the button's line number?

Has been solved,
In the create button combination control at the same time give each button to add an attribute father, namely the combination control id or handle, when using sender () button at the button's father call to locate properties also is equivalent to obtain the combination control, this time with a self. IndexAt (button. Father. Pos ()). The row position () to the number of rows in the launch button,

CodePudding user response:

The building Lord specific how to write? Is using setProperty? SetProperty (" father ", point)?

CodePudding user response:

I am also in my QtableWidget just contact QT5 embedded a QWidget, QWidget horizontal layout of the above three QPushButton so that each column have three QPushButton, but now I'm dealing with the signal, always make uncertain,

CodePudding user response:

I want to ask how much button after the difference between the respective position, thank you

CodePudding user response:

When can override the view agent, click editEvent events
  •  Tags:  
  • Qt
  • Related