Rich Text in QTableWidgetItem
I want to be able to use Rich Text in the QTableWidgetItems, but that's not allowed. I'm thinking I am going to have to use a delegate, but I'm not sure on all the steps I'd have to take to just put a QLabel (my guess on what I'd do) into a subclass of QTableWidgetItem. If anyone has some examples or a good explanation of what I need to do, that would be great.
Re: Rich Text in QTableWidgetItem
Please search the forum. The issue has been brought up many times.
Re: Rich Text in QTableWidgetItem
Where? I've been searching, but I've never seen anyone have a problem with rich text, so it certainly isn't that part of my issue that's been dealt with.
Now when I look up about QTableWidgetItem (subclass or delegate), there are not examples that work, and often solution has nothing to do with subclassing or making a delegate for the QTableWidgetItem. I admit, I'm new to these forums so they might be buried somewhere or I might not be searching in the correct way.
Where do I go to figure out this issue?
Re: Rich Text in QTableWidgetItem
Re: Rich Text in QTableWidgetItem
Thanks for the links.
http://www.qtcentre.org/forum/f-qt-p...view-8371.html
This one helped me the most. Had full example code as well as had everything working by the end of the thread.
Re: Rich Text in QTableWidgetItem
I've used the example from the other thread. I can get the html to display, but I still cannot get it so you can actually interact with the html (as in anchor links). I've even switched out the QTextDocument for a QLabel, but that doesn't seem to be working.
When the paint event happens, does it create the QTextDocument (or in my case a QLabel), ask it to paint itself, then delete it? Is that why I cannot continue to interacting with my QLabel and have it act as a link?
Re: Rich Text in QTableWidgetItem
Re: Rich Text in QTableWidgetItem
Yes. I did set it to open external link. I'm thinking I'm just being dumb right now and I'm not sure where. Do I need to have the delegate hold an instance of a QLabel, or is it ok that I create a QLabel during the paint event and that once the paint is over it doesn't exist anymore?
Re: Rich Text in QTableWidgetItem
The delegate doesn't hold anything. You can either use a real label (which will slown down your application significantly if you want to do that for every widget) or handle all the events you want manually from within the delegate's editor events handler.
Re: Rich Text in QTableWidgetItem
So
- Go back to QTextDocument as QLabel is slow
- Using the same delegate as before, handle a user click just as I'm now handling the paint events
Thanks