2

I would like to enable mouse-selection of the text of several QLabels arranged in a grid layout in a Qt GUI. A QLabel has textInteractionFlags like TextSelectableByMouse which enables this behaviour for one object, but a selection across several QLabel widgets does not seem to work.

Is there a way around this that does not require a lot of mouse "tracking" or reimplementing a layout?

handle
  • 5,859
  • 3
  • 54
  • 82

1 Answers1

1

I fear there's no simple method to get what you want. The first problem would be what you'd expect to find in the paste buffer after selecting some rectangular section of your table. How should the label texts be delimited, should they be organized by row or colum?

You may say that you want them row-wise, columns separated by blanks and rows ending with a \n, but that doesn't need to be what the next person needs.

You may want to spend some time considering QTableView or QTableWidget.

Batox
  • 574
  • 1
  • 4
  • 16