QTablewidget: how to select row with single click instead of double click?
Hello,
I have QTableWidget in my UI, but I have a problem, because I cannot select a row with single click, but only with double click (selectionBehavior is selectRows). I tried with cellClicked(int, int) signal, but with no success. How can I solve that?
Re: QTablewidget: how to select row with single click instead of double click?
Please provide a minimal compilable example reproducing the problem.
Re: QTablewidget: how to select row with single click instead of double click?
If you are talking about editing the item on single click, instead of double click, then have a look at QAbstractItemView::setEditTriggersOtherwise, the row or cell should be selectable on single click only.
Re: QTablewidget: how to select row with single click instead of double click?
Hm, I use Qt Creator to build a program. I use QTableWidget, cells are filled with QLabel (setCellWidget). Maybe I have a problem because single click is intercepted by that QLabels that reside inside table cells? How can I connect these signals, so that qtablewidget receives them?
Re: QTablewidget: how to select row with single click instead of double click?
Why are you using QLabel :eek: Is there some extra rendering with the label ?
I dont see much use of using QLabel as a cell Widget... you could always use delegates to render simple text in a different way
Re: QTablewidget: how to select row with single click instead of double click?
I use QLabel because I use some HTML formatted text and/or images inside cells, so I think that QLabels are natural choice, or am I missing something?
Re: QTablewidget: how to select row with single click instead of double click?
Yes, you are missing something. We don't use widgets inside ItemViews, at least we try not to. Your widget is not part of the model nor part of the view thus all the functionality of ItemViews will not work with it. Search the forum for an implementation of a delegate rendering a QTextDocument.