QTextBrowser and html <input> tag
Hi, simple question. Is there some way to display for example html <input type="text"> inside QTextBrowser and retrieve text from it? I can't afford to use QWebView because my whole app is designed for QTextBrowser and also mainly because i can't have dependency on qwebkit. If not, is there some workaround solving this problem?
Thanks
Re: QTextBrowser and html <input> tag
Re: QTextBrowser and html <input> tag
Re: QTextBrowser and html <input> tag
At least if it is somehow possible or if I have to find another solution?
Re: QTextBrowser and html <input> tag
Ok, one last try... Is there anyone who can give me at least somehow useful information? I'd be very grateful. Thanks
Re: QTextBrowser and html <input> tag
You can implement your own QTextObject and place it in the document where you need it. See the Text Object example for more info.
Re: QTextBrowser and html <input> tag
Thanks for your tip. It seem like this might work. Still Im little confused about how to do it. Lets say I have simple page test.htm:
Code:
<html>
<body>
<table>
<tr>
<td>Some text: </td>
<td><input type="text"></input></td>
</tr>
</table>
</body>
</html>
and I display all html pages from my resources using:
Code:
QString page
= this
->readHtml
("test");
infoHtml.setText(page);
Where readHtml is my method used for loading specific pages from resource file based on it's name specified as parameter. In this example (as I said), input tag is not working. Can you please give me some more hints how to trnasform this using QTextObject?
Re: QTextBrowser and html <input> tag
You need to do it in a way similar to the insertTextObject() method in the example. Qt's rich text parser will not do that automatically for you. I think it'd be easiest if you changed your <input> tag to something the parser will not strip out (e.g. "::input::"), then once QTextBrowser is done doing its job, find all occurences of that marker and replace them with proper text objects using QTextCursor API. Note that the hard part in solving your problem is getting the events delivered to proper objects so that the form becomes editable.
Re: QTextBrowser and html <input> tag
Ok, thanks for your tips. Since this looks rather complicated and I need this only inside very little part of my application (so I dont want to spend much time with such a little part), I think I will solve this problem using something like QGridLayout with QLabels and QTextEdits isnide. Thanks anyways. :)