[webkit-qt] setUserStyleSheetUrl is not working in QtWebkit 5.212 Alpha4

Ramakanth Kesireddy rama.kesi at gmail.com
Mon Aug 17 02:41:44 PDT 2020


Still Unable to load css set using setuserstylesheet with qrc on
target..Target using linuxFB with DRM LCD driver..Is there any rendering
issue on our target with QtWebkit as other QT examples are working fine or
any known issue with QtWebkit 5.212 Alpha4?

Best Regards,
Ramakanth

On Tue, 11 Aug, 2020, 14:30 Ramakanth Kesireddy, <rama.kesi at gmail.com>
wrote:

> Hi Konstantin,
>
> Is there any known issue with setuserstylesheet not working in Qt 5.212 or
> am missing something to get it work either through local file url or qrc?
> qrc seems to work but background-image:url is not set.
>
> Appreciate for your help in this regard.
>
> Thanks and Regards,
> Ramakanth
>
> On Fri, 7 Aug, 2020, 20:20 Ramakanth Kesireddy, <rama.kesi at gmail.com>
> wrote:
>
>> Any feedback on the background-image:url not being displayed though the
>> image in the same directory?
>>
>> On Thu, 6 Aug, 2020, 21:56 Ramakanth Kesireddy, <rama.kesi at gmail.com>
>> wrote:
>>
>>> Hello Konstantin,
>>>
>>> Tried to use setUserStyleSheetUrl from qrc instead of setting
>>> setUserStyleSheetUrl( QUrl::fromLocalFile) as mentioned in the below code
>>> snippet.
>>>
>>> The stylesheet is applied but local image using
>>> background-image:url(arrow_right.png) in the .css is not set .
>>>
>>> html,css and image are in the same directory.
>>>
>>> Appreciate your help to fix the background-image not being set.
>>>
>>> Best Regards,
>>>
>>> Ramakanth
>>> On Wed, Aug 5, 2020 at 10:54 PM Ramakanth Kesireddy <rama.kesi at gmail.com>
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> When we ported from old Qt webkit(corresponding to Qt 4.8) to Qt Webkit
>>>> 5.212 alpha4 based Qt 5.6.3, the stylesheet is not applied using
>>>> setUserStyleSheetUrl ().
>>>>
>>>> Here is the sample code snippet:
>>>>
>>>> ui->webView->setContextMenuPolicy( Qt::NoContextMenu );
>>>>
>>>> ui->webView->settings()->setUserStyleSheetUrl( QUrl::fromLocalFile(
>>>> QString::fromStdString( "user.css" ) ) );
>>>>
>>>>  ui->webView->settings()->setDefaultTextEncoding( "utf-8" );
>>>>
>>>> ui->webView->setFocusPolicy(Qt::NoFocus);
>>>>
>>>>  QFile file ("scrolltest_page.html");
>>>>
>>>>  if (file.exists())
>>>>
>>>>     {
>>>>
>>>>         file.open(QIODevice::ReadOnly);
>>>>
>>>>         QByteArray htmlArr = file.readAll();
>>>>
>>>>         QString htmlStr = QString::fromUtf8(htmlArr);
>>>>
>>>>         ui->webView->setHtml(htmlStr);
>>>>
>>>>         file.close();
>>>>     }
>>>>
>>>> Sample user.css and scrolltest_page.html are attached herewith.
>>>> As the stylesheet is not applied, the buttons with background color and
>>>> style set using css is not working.
>>>>
>>>> Please let me know if there is any known issue or any issue with
>>>> attached user.css with respect to Qtwebkit 5.212 alpha4.
>>>> Also can we add the images to qrc and refer the same in user.css?
>>>>
>>>> The same css works in old Qt webkit along with setUserStyleSheet.
>>>>
>>>> Appreciate for your quick response in this regard.
>>>>
>>>> Best Regards,
>>>> Ramakanth
>>>>
>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-qt/attachments/20200817/c070b430/attachment.htm>


More information about the webkit-qt mailing list