I
I
Ilya Kovalevsky2012-11-04 19:51:47
css
Ilya Kovalevsky, 2012-11-04 19:51:47

Is there QSS support for custom widgets?

Darova, Qt-community habr!
I have a question here. There is also a CSS modification in Qt - Qt Style Sheets. But is it possible to use it for "your" custom widgets.
I would like to be able to work with a table like this:

MyWidget {
    myproperty: 1;
}

MyWidget::state {
   myproperty: 0;
}

Is there any API to work with them?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
silvansky, 2012-11-06
@namespace

Own properties - no problem! You declare foo
with Q_PROPERTY , then in your styles you write:

MyWidget
{
    qproperty-foo: red;
}

See examples here:
.qss
CustomLabel.h
But you can't make your own pseudo-elements, as I understand it.

I
Inquisitor, 2012-11-04
@Inquisitor

QWidget#DockPaletteWidgetBox,
QWidget#documentNavigator,
QWidget#UBLibPathViewer,
QWidget#UBLibNavigatorWidget,
QWidget#UBLibItemProperties,
QWidget#UBDownloadWidget,
QWidget#UBTeacherGuideWidget
{
background: #EEEEEE;
border-radius: 10px
border: 2px solid #999999;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question