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
Title: Scrolling test
::-webkit-scrollbar {
	background:rgb(255,255,255);
	width:64px;
	height:46px;
	margin:59px 0px 59px 0px;
}
/*This disables the user selection*/
body {
	-webkit-user-select:none;
        -webkit-user-drag:none;	
}
::-webkit-scrollbar-thumb {
	border-style: outset;
	border-width: 7px;
	border-color: rgb(126,165,183);
	height:46px;
	background-color:rgb(97,125,139);
}

::-webkit-scrollbar-button:vertical:increment {
	border-style: outset;
	border-width: 7px;
	border-color: rgb(126,165,183);
	height:46px;
	background-color:rgb(97,125,139);
	background-image: url(/usr/share/images/arrow-down.png);
	background-repeat: no-repeat, repeat-x;
	background-position: 8px 0px, 0 0;
}
::-webkit-scrollbar-button:vertical:increment:active {
	border-style: inset;
	border-width: 7px;
	border-color: rgb(126,165,183);
	height:46px;
	background-color:rgb(97,125,139);
	background-image: url(/usr/share/images/arrow-down.png);
	background-repeat: no-repeat, repeat-x;
	background-position: 8px 0px, 0 0;
}
 
::-webkit-scrollbar-button:vertical:decrement {
	border-style: outset;
	border-width: 7px;
	border-color: rgb(126,165,183);
	height:46px;
	background-color:rgb(97,125,139);
	background-image: url(/usr/share/images/up_arrow.png);
	background-repeat: no-repeat, repeat-x;
	background-position: 8px 0px, 0 0;
}

::-webkit-scrollbar-button:vertical:decrement:active {
	border-style: inset;
	border-width: 7px;
	border-color: rgb(126,165,183);
	height:46px;
	background-color:rgb(97,125,139);
	background-image: url(/usr/share/images/up_arrow.png);
	background-repeat: no-repeat, repeat-x;
	background-position: 8px 0px, 0 0;
}

/* Horizontal scroll bar style*/
::-webkit-scrollbar-button:horizontal:increment {
        border-style: outset;
        border-width: 7px;
        border-color: rgb(126,165,183);
        height:60px;
        width:64px;
        background-color:rgb(97,125,139);
        background-image: url(/usr/share/images/rightArrow.png);
        background-repeat: no-repeat, repeat-x;
        background-position: 8px 0px, 0 0;
}
::-webkit-scrollbar-button:horizontal:increment:active {
        border-style: inset;
        border-width: 7px;
        border-color: rgb(126,165,183);
        height:60px;
        width:64px;
        background-color:rgb(97,125,139);
        background-image: url(/usr/share/images/rightArrow.png);
        background-repeat: no-repeat, repeat-x;
        background-position: 8px 0px, 0 0;
}

::-webkit-scrollbar-button:horizontal:decrement {
        border-style: outset;
        border-width: 7px;
        border-color: rgb(126,165,183);
        height:60px;
        width:64px;
        background-color:rgb(97,125,139);
        background-image: url(/usr/share/images/leftArrow.png);
        background-repeat: no-repeat, repeat-x;
        background-position: 8px 0px, 0 0;
}

::-webkit-scrollbar-button:horizontal:decrement:active {
        border-style: inset;
        border-width: 7px;
        border-color: rgb(126,165,183);
        height:60px;
        width:64px;
        background-color:rgb(97,125,139);
        background-image: url(/usr/share/images/leftArrow.png);
        background-repeat: no-repeat, repeat-x;
        background-position: 8px 0px, 0 0;
}

_______________________________________________
webkit-qt mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-qt

Reply via email to