IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Qt Discussion :

Qt & QSS, possible de mettre des ID sur le QObject ?


Sujet :

Qt

  1. #1
    Membre actif Avatar de ttone
    Profil pro
    Inscrit en
    Janvier 2008
    Messages
    589
    Détails du profil
    Informations personnelles :
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Janvier 2008
    Messages : 589
    Points : 203
    Points
    203
    Par défaut Qt & QSS, possible de mettre des ID sur le QObject ?
    J'ai une GUI QT, je la custom un peu avec Qss, est ce qu'il est possible d'individualiser les éléments avec des ID, pour pouvoir par exemple faire des bouttons d'aspects différents... bref un équivalent des classes CSS ?

    Merci

  2. #2
    Membre expert

    Avatar de IrmatDen
    Profil pro
    Inscrit en
    Novembre 2006
    Messages
    1 727
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 1 727
    Points : 3 266
    Points
    3 266
    Par défaut
    Salut,

    Non, pas vraiment, mais tu a d'autres façon de spécifier un peu quels éléments doivent avoir un style sheet donné, je te renvois à la doc des sélecteurs.

    PS: n'oublie pas que tu peux spécifier un style sheet pour un et un seul widget en appelant setStyleSheet contenant uniquement son code. Par extension, il te suffirait de dériver une classe d'un widget particulier, d'y placer ce stylesheet et d'instancier celui-ci.

  3. #3
    Membre actif Avatar de ttone
    Profil pro
    Inscrit en
    Janvier 2008
    Messages
    589
    Détails du profil
    Informations personnelles :
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Janvier 2008
    Messages : 589
    Points : 203
    Points
    203
    Par défaut
    Je regarde ca, j'ai vu dans la doc que certains QPushButton était stylé sur leur nom :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    QPushButton::pressed#bouton_ouvrir_un_fichier{
    /*QSS*/
    }

  4. #4
    Membre expert

    Avatar de IrmatDen
    Profil pro
    Inscrit en
    Novembre 2006
    Messages
    1 727
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 1 727
    Points : 3 266
    Points
    3 266
    Par défaut
    T'as lu trop vite, j'ai ajouté un PS à mon message

  5. #5
    Membre actif Avatar de ttone
    Profil pro
    Inscrit en
    Janvier 2008
    Messages
    589
    Détails du profil
    Informations personnelles :
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Janvier 2008
    Messages : 589
    Points : 203
    Points
    203
    Par défaut
    intéressant merci... ca me fait moins peur que ce Qt-Css

  6. #6
    Membre actif Avatar de ttone
    Profil pro
    Inscrit en
    Janvier 2008
    Messages
    589
    Détails du profil
    Informations personnelles :
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Janvier 2008
    Messages : 589
    Points : 203
    Points
    203
    Par défaut
    Petit probleme récurrent avec les QFrames dans ma stylesheet.qss

    Je n'arrive pas à modifier le background, en image ou en couleur, ca n'a aucune influence

  7. #7
    Membre expert

    Avatar de IrmatDen
    Profil pro
    Inscrit en
    Novembre 2006
    Messages
    1 727
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 1 727
    Points : 3 266
    Points
    3 266
    Par défaut
    Ce code marche très bien chez moi:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    QFrame { background-color: red }

  8. #8
    Membre actif Avatar de ttone
    Profil pro
    Inscrit en
    Janvier 2008
    Messages
    589
    Détails du profil
    Informations personnelles :
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Janvier 2008
    Messages : 589
    Points : 203
    Points
    203
    Par défaut
    y a un gros soucis chez moi, ca ne marche pas du tout...

    dsl pour la longueur...
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    /*rose : #E1D1BB : 255 209 187*/
    /*vert : #90A081 : 144 160 129*/
     
    QMainWindow  {
        background-color: #90A081;
    }
     
    QMainWindow > QWidget{
        background-color: #90A081;
    }
     
     
     
     
    /* Provide a padding for the layout inside the frame. The frame
       exists only to provide a padding for the top-right image, so we
       explicitly disable the border. */
    #mainFrame {
        padding-right: 30px;
        border-style: none;
        border-image: none; /* since we set a border-image below */
    }
     
     
        QSlider::groove:horizontal {
             border: 1px solid #999999;
             height: 8px; /* the groove expands to the size of the slider by default. by giving it a height, it has a fixed size */
             background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #B1B1B1, stop:1 #c4c4c4);
             margin: 2px 0;
         }
    	  QSlider::handle:horizontal {
             background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #b4b4b4, stop:1 #8f8f8f);
             border: 1px solid #5c5c5c;
             width: 18px;
             margin: -2px 0; /* handle is placed by default on the contents rect of the groove. Expand outside the groove */
             border-radius: 3px;
         }
     
    	  QSlider::groove:vertical {
             border: 1px solid #999999;
             width: 8px; /* the groove expands to the size of the slider by default. by giving it a height, it has a fixed size */
             background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #B1B1B1, stop:1 #c4c4c4);
             margin:0 2px;
         }
    	  QSlider::handle:vertical {
             background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #b4b4b4, stop:1 #8f8f8f);
             border: 1px solid #5c5c5c;
             height: 18px;
             margin: 0 -2px; /* handle is placed by default on the contents rect of the groove. Expand outside the groove */
             border-radius: 3px;
         }
     
    	 QSlider::groove:horizontal#leftLoopSlider {
             border: 1px solid #999999;
             height: 8px; /* the groove expands to the size of the slider by default. by giving it a height, it has a fixed size */
             background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #B1B1B1, stop:1 #c4c4c4);
             margin: 2px 0;
         }
    	  QSlider::handle:horizontal#leftLoopSlider {
             background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #b4b4b4, stop:1 #8f8f8f);
             border: 1px solid #5c5c5c;
             width: 10px;
             margin: -2px 0; /* handle is placed by default on the contents rect of the groove. Expand outside the groove */
             border-radius: 3px;
         }
     
    	 QSlider::groove:horizontal#rightLoopSlider {
             border: 1px solid #999999;
             height: 8px; /* the groove expands to the size of the slider by default. by giving it a height, it has a fixed size */
             background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #B1B1B1, stop:1 #c4c4c4);
             margin: 2px 0;
         }
    	  QSlider::handle:horizontal#rightLoopSlider {
             background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #b4b4b4, stop:1 #8f8f8f);
             border: 1px solid #5c5c5c;
             width: 10px;
             margin: -2px 0; /* handle is placed by default on the contents rect of the groove. Expand outside the groove */
             border-radius: 3px;
         }
     
     
    	 /* mainFrame won't have this border-image since we have
       explicitly set it to 'none' using a more specific selector. */
     QLineEdit, QComboBox[editable="true"], QSpinBox {
        border-image: url(:/App.png);
        border-width: 15;
    	z-index:2;
    }
     
    QFrame{
    border-color:antiquewhite;    
    }
     
     
    QFrame#frame{
    	background-image: url(:/styles/images/bgQframe.png);
    }
     
    QFrame#frameIS{
    	background-color:#E1D1BB;
    }
     
    QSlider{
    	image: url(:/images/fondframe.png); 
    	border-image: url(:/images/frame.png);
    	border-width: 15;
    }
     
     
    QLabel {
        border: none;
        border-image: none;
        padding: 0;
        background: none;
    	font-color: white ;
    }
     
    /* Make text in message boxes selectable. */
    QMessageBox {
        /* LinksAccessibleByMouse | TextSelectableByMouse */
        messagebox-text-interaction-flags: 5;
    }
     
    /* Set the selection colors for all widgets. */
    QWidget {
        selection-color: black;
        selection-background-color: green;
        color: black;
    }
     
    /* Make the entire row selected in item views. */
    QAbstractItemView {
        show-decoration-selected: 1;
    }
     
    /* Nice WindowsXP-style password character for password line edits. */
    QLineEdit[echoMode="2"] {
        lineedit-password-character: 9679;
    }
     
    /* Customize tooltips. */
    QToolTip {
        background-color: rgb(200,200,255);
        border-color: darkslategray;
        border-width: 1px;
        border-style: solid;
        padding: 3px;
        font: bold;
        border-radius: 3px;
        opacity: 200;
    }
     
    /* Customize radio buttons. */
     
    QRadioButton {
        spacing: 5px;
    }
     
    QRadioButton::indicator {
        width: 13px;
        height: 13px;
    }
     
    QRadioButton::indicator::unchecked {
        image: url(:/styles/images/radiobutton_unchecked.png);
    }
     
    QRadioButton::indicator:unchecked:hover {
        image: url(:/styles/images/radiobutton_unchecked_hover.png);
    }
     
    QRadioButton::indicator:unchecked:pressed {
        image: url(:/styles/images/radiobutton_unchecked_pressed.png);
    }
     
    QRadioButton::indicator::checked {
        image: url(:/styles/images/radiobutton_checked.png);
    }
     
    QRadioButton::indicator:checked:hover {
        image: url(:/styles/images/radiobutton_checked_hover.png);
    }
     
    QRadioButton::indicator:checked:pressed {
        image: url(:/styles/images/radiobutton_checked_pressed.png);
    }
     
    /* Customize arrows. */
     
    *::down-arrow, *::menu-indicator {
        image: url(:/images/down_arrow.png);
        width: 7px;
        height: 7px;
    }
     
    *::down-arrow:disabled, *::down-arrow:off {
       image: url(:/images/down_arrow_disabled.png);
    }
     
    *::up-arrow {
        image: url(:/images/up_arrow.png);
        width: 7px;
        height: 7px;
    }
     
    *::up-arrow:disabled, *::up-arrow:off {
       image: url(:/images/up_arrow_disabled.png);
    }
     
    /* Customize push buttons and comboboxes. Our read-only combobox
       is very similar to a push button, so they share the same border image. */
     
    QPushButton {
        min-width: 2em;
    }
     
    QPushButton, QComboBox[editable="false"]{
    	background-color:red;
    }
     
    QPushButton:hover, QComboBox[editable="false"]:hover,
    QMenuBar::item:hover {
     
    }
     
    QPushButton:pressed, QMenuBar::item:on {
     
    }
     
     
    /*transport buttons :*/
     
    QPushButton#playButton {
        border-image: url(:/styles/images/playButton.png) 5;
        border-width: 5;
    	height:43px;
    	width:55px;
    }
     
    QPushButton::pressed#playButton {
        border-image: url(:/styles/images/playButton_pressed.png) 5;
        border-width: 5;
    	height:43px;
    	width:55px;
    }
    QPushButton::checked#playButton {
        border-image: url(:/styles/images/playButton_checked.png) 5;
        border-width: 5;
    	height:43px;
    	width:55px;
    }
     
     
    QPushButton#stopButton {
        border-image: url(:/styles/images/stopButton.png) 5;
        border-width: 5;
    	height:43px;
    	width:55px;
    }
     
    QPushButton::pressed#stopButton {
        border-image: url(:/styles/images/stopButton_pressed.png) 5;
        border-width: 5;
    	height:43px;
    	width:55px;
    }
    QPushButton::checked#stopButton {
        border-image: url(:/styles/images/stopButton_checked.png) 5;
        border-width: 5;
    	height:43px;
    	width:55px;
    }
     
     
    QPushButton#loopButton {
        border-image: url(:/styles/images/loopButton.png) 5;
        border-width: 5;
    	height:43px;
    	width:55px;
    }
     
    QPushButton::pressed#loopButton {
        border-image: url(:/styles/images/loopButton_pressed.png) 5;
        border-width: 5;
    	height:43px;
    	width:55px;
    }
    QPushButton::checked#loopButton {
        border-image: url(:/styles/images/loopButton_checked.png) 5;
        border-width: 5;
    	height:43px;
    	width:55px;
    }
     
    /*Switch*/
     QCheckBox {
         spacing: 5px;
     }
     
     QCheckBox::indicator {
         width: 20px;
         height: 20px;
     }
     
    QCheckBox::indicator::unchecked {
        image: url(:/styles/images/CheckBox_unchecked.png);
    }
     
    QCheckBox::indicator:unchecked:hover {
        image: url(:/styles/images/CheckBox_unchecked_hover.png);
    }
     
    QCheckBox::indicator:unchecked:pressed {
        image: url(:/styles/images/CheckBox_unchecked_pressed.png);
    }
     
    QCheckBox::indicator::checked {
        image: url(:/styles/images/CheckBox_checked.png);
    }
     
    QCheckBox::indicator:checked:hover {
        image: url(:/styles/images/CheckBox_checked_hover.png);
    }
     
    QCheckBox::indicator:checked:pressed {
        image: url(:/styles/images/CheckBox_checked_pressed.png);
    }
     
     
     
     
     
     
    /* Customize the menu bar. */
    QMenuBar {
        border-image: none;
        border-style: none;
        border-width: 1px;
        border-bottom-style: solid;
        border-bottom-color: darkslategray;
        padding: 2px;
    }
     
     QProgressBar {
         border: 2px solid gray;
         border-radius: 3px;
    	 background-color: black;
    	 text-align: center;
    	 font-color:antiquewhite;
    	 color:antiquewhite;
     }
     
     QProgressBar::chunk {
         background-color: darkred;
         width: 20px;
     }

  9. #9
    Membre expert

    Avatar de IrmatDen
    Profil pro
    Inscrit en
    Novembre 2006
    Messages
    1 727
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 1 727
    Points : 3 266
    Points
    3 266
    Par défaut
    Euh, dur à dire là, y'a trop de règles. Solution brute force: tout commenter sauf la règle générique concernant QFrame et constater que ça fonctionne. Si c'est bien le cas, tu décommentes règle par règle jusqu'à mettre la main sur le conflit. Ensuite, soit le conflit t'apparaît comme évident et tu le résoud, soit il ne l'est pas, et tu reviens poster ici la règle source du conflit

  10. #10
    Membre actif Avatar de ttone
    Profil pro
    Inscrit en
    Janvier 2008
    Messages
    589
    Détails du profil
    Informations personnelles :
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Janvier 2008
    Messages : 589
    Points : 203
    Points
    203
    Par défaut
    En gros, tu me conseil de bosser ok doc

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Est il possible de mettre des images a la place des bordures
    Par saperlipopeye dans le forum Mise en page CSS
    Réponses: 2
    Dernier message: 26/11/2009, 20h49
  2. [HashSet] C'est possible de mettre des doublons ! :-(
    Par Melchisedec dans le forum Collection et Stream
    Réponses: 1
    Dernier message: 27/07/2007, 11h15
  3. Réponses: 2
    Dernier message: 02/02/2006, 09h07
  4. Réponses: 2
    Dernier message: 18/11/2005, 21h40
  5. [MFC] mettre des icones sur un CTreeCtrl
    Par Toutouffe dans le forum MFC
    Réponses: 3
    Dernier message: 30/11/2004, 17h11

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo