Questions tagged [qstylesheet]

The QStyleSheet class is a collection of styles for rich text rendering and a generator of tags.

Documentation can be found here (Qt4) and here (Qt5).

53 questions
0
votes
0 answers

Qt Scroll Area ScrollBars not applying styles

So I have 1 ScrollArea and I have set the stylesheet to be: QScrollBar { background-color: rgb(29, 29, 29); border: 1px Solid white; border-radius: 5px; margin-right: 4px; margin-top: 4px; margin-bottom: 4px;…
Tom Butcher
  • 29
  • 11
0
votes
0 answers

Why do my QListWidgetItems break to the next line before reaching the edge of the window?

I'm creating an image grid in Qt as seen in these screenshots: One row Row break The problem occurs while resizing the window. The last image breaks onto the next row before it touches the edge of the window. This is even more noticeable when the…
Chris
  • 105
  • 8
0
votes
1 answer

Qt - style characters from index x to the end

How to style characters from index x (eg. x=10) to end of text in QLineEdit? Example: Text in QLineEdit: 0123456789 And I want make characters from index 2 (that is 2) to the end should be bold. 0123456789
Guruku
  • 653
  • 1
  • 7
  • 6
0
votes
2 answers

Customizing QComboBox

I want to customize QComboBox. The behavior I'd like to see is a combo box where it's button (the down facing arrow), takes the whole area of the combo box when it's collapsed. I know that QComboBox is a QPushButton with a QListWidget (or some other…
santahopar
  • 2,933
  • 2
  • 29
  • 50
0
votes
3 answers

Qt Change stylesheet on focus in/out event

Okay I'm feeling really stupid right now... I have a QTableWidget and when it has focus I want to change the stylesheet so that it's border "highlights". I can do this simply by subclassing the widget's focusInEvent however if I call setStyleSheet()…
Spencer
  • 1,931
  • 1
  • 21
  • 44
0
votes
2 answers

Set stylesheet for private member of a QWidget

I've a class like the following one: class BigButton : public QWidget { Q_OBJECT public: BigButton(QWidget* parent = nullptr); virtual ~BigButton() = default; void setSvgImagePath(const QString& imagePath); void setLabel(const QString&…
Jepessen
  • 11,744
  • 14
  • 82
  • 149
0
votes
1 answer

QPushButton Don't Use Text Displacement on Button Checked

I'm creating my own QPushButton and styling it up. What I've noticed happening is the text slightly displacing if the button is pushed and checked (hardly surprising, as this is making it look like a button). I don't want this to happen though. I've…
Claudiu
  • 155
  • 1
  • 3
  • 14
0
votes
1 answer

hide QPushButton and QLineEdit Borders

i want to hide those borders . and make it look like this I foud that creating a nice GUI with QT is very hard, so i had the idea of designing one as a PNG backround an putting a transparent object on it,so my question is how do I hide the…
Nidal El
  • 1
  • 4
0
votes
1 answer

independently change the background image of each page of QStackedWidget

I would like to independently change the background image of each page of the stacked widget . However, when I add background-image: to the styleSheet tab on Qt creator, the result is that all the pages of the stacked widget get that background…
0
votes
1 answer

How to set up stylesheet in QT to choose random image for wiget background?

So I'm trying to choose random image from file system of my pc and make it background in wiget. So thats why I'm opening QFileDialog and using it. qDebug gives me right path to the image, but still it doesn't work. void…
J.Doe
  • 15
  • 3
0
votes
0 answers

Changing QWidget object scope changes the CSS

Consider this two parts of code NotifWidget* notifWidget_ = new NotifWidget(); notifWidget_->show(); notifWidget_->move(computePosition(notifWidget_)); notifWidget_->show(); notifWidget_->move(computePosition(notifWidget_)); In first case the…
zapredelom
  • 1,009
  • 1
  • 11
  • 28
0
votes
1 answer

Qt Stylesheet affects whole widgets

I have a problem about Qt Stylesheets and I am using Qt 5.6 on windows.(This was not exist in Qt 5.5.1) I use this code piece, this is a QLabel inside a QDialog. ui.newGroupNameLabel->setStyleSheet("QLabel { color : black; }"); I also tried giving…
Wilmort
  • 294
  • 2
  • 15
0
votes
1 answer

PyQt: How can i set stylesheet contents on scaled mode?

I had an application that contained a lot of widgets with stylesheet on them, However, I did not add any layout to interface, It neither had central widget included, But the application was running without any problems. However, whenever i tried to…
ShellRox
  • 2,532
  • 6
  • 42
  • 90
0
votes
1 answer

How to control background border size of QDialog with QStyleSheet

Using stylesheets, if I set background-color of a QDialog, I don't seem to be able to control the width of the visible colour - the gap between the content and the actual border. For example if I create a QDialog with only a QListWidget on it, in a…
mike
  • 1,192
  • 9
  • 32
0
votes
1 answer

QStyleSheet - setting border-image for button also sets background image for its tooltip

I'm having a problem with setting the border-image property of a QToolButton (later on also of a QPushButton but I assume the problem will occur there too). Each of my custom buttons (inheriting from QToolButton and QPushButton respectively) has to…
rbaleksandar
  • 8,713
  • 7
  • 76
  • 161