Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. Stylesheet css or xml widgets pyqt6 python
Qt 6.11 is out! See what's new in the release blog

Stylesheet css or xml widgets pyqt6 python

Scheduled Pinned Locked Moved Solved Qt 6
stylesheetcssxmlqtwidgetspython
5 Posts 2 Posters 3.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jbone73
    wrote on last edited by
    #1

    Hello,

    I would like to know if anyone has a link where I can find documentation on setting up a stylesheet in css or xml for the layout of widgets in PyQt6 for Python.

    I thank you all in advance for your help.

    jsulmJ 1 Reply Last reply
    0
    • J Jbone73

      Hello,

      I would like to know if anyone has a link where I can find documentation on setting up a stylesheet in css or xml for the layout of widgets in PyQt6 for Python.

      I thank you all in advance for your help.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Jbone73 said in Stylesheet css or xml widgets pyqt6 python:

      for the layout of widgets

      Layout in Qt/PyQt6 is done using https://doc.qt.io/qt-5/layout.html
      You can influence some parameters (like margins) in style sheet but not the layout itself.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      J 1 Reply Last reply
      0
      • jsulmJ jsulm

        @Jbone73 said in Stylesheet css or xml widgets pyqt6 python:

        for the layout of widgets

        Layout in Qt/PyQt6 is done using https://doc.qt.io/qt-5/layout.html
        You can influence some parameters (like margins) in style sheet but not the layout itself.

        J Offline
        J Offline
        Jbone73
        wrote on last edited by
        #3

        @jsulm Thanks ! this's good document, I have another question :

        what i would like to do is create a style for each widget i am going to use in a window. This in order to make a correct presentation of my application and to set up a style sheet is useful for the good understanding and organization of my program.

        Example :
        QTableWidget, QLineEdit, QLabel, QCombobox, etc.

        I would also like to know if it is possible to assign a different style for a widget called several times in the same window?

        Example :

        • 3 QLabels
          the 1st make it 12px 'Arial'
          the 2nd make 14px 'Open sans'
          the 3rd are 18px 'Time New Roman'

        if I do that in a css file it will apply a single style to all the labels.

        Thanking you in advance for your help

        jsulmJ 1 Reply Last reply
        0
        • J Jbone73

          @jsulm Thanks ! this's good document, I have another question :

          what i would like to do is create a style for each widget i am going to use in a window. This in order to make a correct presentation of my application and to set up a style sheet is useful for the good understanding and organization of my program.

          Example :
          QTableWidget, QLineEdit, QLabel, QCombobox, etc.

          I would also like to know if it is possible to assign a different style for a widget called several times in the same window?

          Example :

          • 3 QLabels
            the 1st make it 12px 'Arial'
            the 2nd make 14px 'Open sans'
            the 3rd are 18px 'Time New Roman'

          if I do that in a css file it will apply a single style to all the labels.

          Thanking you in advance for your help

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Jbone73 said in Stylesheet css or xml widgets pyqt6 python:

          if it is possible to assign a different style for a widget called several times in the same window?

          Yes it is.
          Take a look at https://doc.qt.io/qt-5/stylesheet-syntax.html
          You can also adress specific widgets in style sheets using their object names.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          J 1 Reply Last reply
          2
          • jsulmJ jsulm

            @Jbone73 said in Stylesheet css or xml widgets pyqt6 python:

            if it is possible to assign a different style for a widget called several times in the same window?

            Yes it is.
            Take a look at https://doc.qt.io/qt-5/stylesheet-syntax.html
            You can also adress specific widgets in style sheets using their object names.

            J Offline
            J Offline
            Jbone73
            wrote on last edited by
            #5

            @jsulm Thank you very much !

            It's exactly what I needed.

            In the top !

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved