I want to change to color in which text is highlighted when the findText() method is used. This color has nothing to do with user selected text. I have tried CSS as well as setting a QPalette. All occurences are always highlighted in yellow.
I've been searching for this as well, and it seems like it's hardcoded deep inside WebKit:
Color RenderTheme::platformInactiveTextSearchHighlightColor() const
{
return Color(255, 255, 0); // Yellow.
}
I really have the same problem. But the good news: Setting the style sheet helps at least to change the fg/bk color.
m_browser->setStyleSheet("QWebView {
selection-background-color: blue; selection-color: white; }");
But this is not the whole truth because it only changes the fg/bk color of the currently found text. No idea how to change the fg/bk color of all occurences.
Axel
Related
I need to change the title of all the navigationlinks to a different color other than blue, like a custom green. Don't know where to begin.
Example
Use accent color like the following
NavigationView {
// content here
}.accentColor(Color.green)
Does anybody know how to change the size of the fonts appearing in tags of the tag-it plug in? I went over the stylesheet but it does not seam obvious to me how to do it.
It is in the color specifc css file, tagit-stylish-yellow.css for example.
Look for
ul.tagit { cursor: text; font-size: 14px; color: #333; }
and change the font-size.
I found this by going to the demo site in Chrome, start the inspector by pressing F12, selecting the tag and looking at the css directives that affect it.
I'm trying to make a simple design to select a color and I'm using a QToolButton to open a QColorDialog.
My problem is that I would like the QToolButton to be of the selected color but I've only suceeded to set the background color, which is not what I want.
Here is a picture:
My code:
QColor color = QColorDialog::getColor(m_couleur);
if (color.isValid()) m_couleur=color;
m_labelCouleur->setPalette(QPalette(m_couleur));
m_labelCouleur->setAutoFillBackground(true);
m_buttonCouleur->setPalette(QPalette(m_couleur));
m_buttonCouleur->setAutoFillBackground(true);
Basically I would like the QToolButton to look something like this:
edit: Can anyone explain to me why the website won't let me add "Hi everybody" at the beginning?
QColor color = QColorDialog::getColor(m_couleur);
QPixmap px(20, 20);
px.fill(color);
m_buttonCouleur->setIcon(px);
No CSS involved in this case is (for me ofcourse) big pro
Use the setStylesheet function in order to change the background color of your button
m_buttonCouleur->setStyleSheet(QString("QToolButton{ background: %1; }").arg(m_couleur.name()));
I've done exactly that by using a QPushButton and setting its style sheet to the result from the color picker. I guess a tool button should probably be the same.
button->setStyleSheet(QString("background-color: %1; "
"border: 1px; "
"border-color: black; "
"border-style: outset;").arg(color.name()));
I have a question regarding the QGroupBox stylesheet. I want a custom stylesheet for QGroupBox that looks similar to the image below:
Can you please tell me how to look "Device Info" Style with white background?
Use setStyleSheet function to set any style for any state programmatically.
For your case, first obtain the QGroupBox object and let us assume "pGroupBox".
As you need title's back ground color to be white, you can set it as shown below.
pGroupBox->setStyleSheet("::title{background-color:white}");
Almost you can style anything check below link:
(you can set based on different psuedo states for different sub controls.)
http://doc.qt.io/qt-5.8/stylesheet-examples.html
You need to change style for QGroupBox::title subcontrol. http://developer.qt.nokia.com/doc/qt-4.7/stylesheet-examples.html#id-e7d01e98-168f-4c8a-ac7f-77233a406ba4
You can change the color here
QGroupBox {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0 #E0E0E0, stop: 1 #FFFFFF);
border: 2px solid gray;
border-radius: 5px;
margin-top: 1ex; /* leave space at the top for the title */
}
specify the color whatever you want at the place of red.
Look at the Qt Style Sheets Examples.
I am trying to modify the QTableView to always show all editors. I am ok with the workaround to call openPersistentEditor() on all cells.
However I'd like the content of the cells to not be selected and no text cursor for empty fields.
This is what I get:
And this is what I'd like to have:
I tried using clearSelection() and clearFocus() but that does not do the trick. If I click on each cell I get the desired result and I could do the same thing programmatically, but I'd to know if there's a more direct way.
I had this exact same issue. I ended up just adjusting the selection color and selection background color on the QLineEdits. You can do it on all QLineEdits or just on a custom QLineEdit by giving each editor an object name and referencing that in the stylesheet.
/* applies to all QLineEdits in the application */
QLineEdit {
selection-background-color: white;
selection-color: black
}
/* applies to all QLineEdits with the object name "custom" in the application */
QLineEdit#custom {
selection-background-color: white;
selection-color: black
}