Thanks for your tips, Tony. I'm going to try them. The model will be storing QStrings but I still need to figure out which class to use: a table widget or a table view, or maybe even a list widget (view).
On Sat, Oct 12, 2013 at 12:48 PM, Tony Rietwyk <t...@rightsoft.com.au>wrote: > Hi Alexei, **** > > ** ** > > Interesting question. How does your model get the display text? I assume > your model (or the QTableWidget model) is storing a QString. In the cell > click handler you can theoretically: **** > > ** ** > > - push the display text into a QTextEdit (hidden for release builds)**** > > - format it with the same font, margins, etc, as the cell**** > > - set the max width to the cell width**** > > - use cursorForPosition to get a QTextCursor for the mouse offset within > in the cell**** > > - select the current word using select(QTextCursor::WordUnderCursor)**** > > - use selectedText to get the word. **** > > ** ** > > The hard part is mimicking the formatting of the cell, and forcing the > text edit to do its layout changes. **** > > ** ** > > Hope that helps, **** > > ** ** > > Tony.**** > > ** ** > > ** ** > > *From:* interest-bounces+tony=rightsoft.com...@qt-project.org [mailto: > interest-bounces+tony=rightsoft.com...@qt-project.org] *On Behalf Of *Alexei > Vinidiktov > *Sent:* Saturday, 12 October 2013 3:44 PM > *To:* interest@qt-project.org > *Subject:* Re: [Interest] How to get word that was clicked on in a table > view or table widget?**** > > ** ** > > I forgot to mention that the table view or table widget is not editable.** > ** > > ** ** > > On Sat, Oct 12, 2013 at 11:21 AM, Alexei Vinidiktov < > alexei.vinidik...@gmail.com> wrote:**** > > Hello,**** > > ** ** > > I need to get the word that was clicked on in a table widget or table view > cell.**** > > ** ** > > Is it possible? If so, how would I do that?**** > > ** ** > > Thanks. > **** > > ** ** > > -- > Alexei Vinidiktov **** > > > > **** > > ** ** > > -- > Alexei Vinidiktov **** > > _______________________________________________ > Interest mailing list > Interest@qt-project.org > http://lists.qt-project.org/mailman/listinfo/interest > > -- Alexei Vinidiktov
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest