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
QtWS25 Last Chance

Stylesheet css or xml widgets pyqt6 python

Scheduled Pinned Locked Moved Solved Qt 6
stylesheetcssxmlqtwidgetspython
5 Posts 2 Posters 2.3k Views
  • 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 3 Feb 2022, 09:21 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.

    J 1 Reply Last reply 3 Feb 2022, 09:31
    0
    • J Jbone73
      3 Feb 2022, 09:21

      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.

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 3 Feb 2022, 09:31 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 3 Feb 2022, 09:45
      0
      • J jsulm
        3 Feb 2022, 09:31

        @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 3 Feb 2022, 09:45 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

        J 1 Reply Last reply 3 Feb 2022, 09:52
        0
        • J Jbone73
          3 Feb 2022, 09:45

          @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

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 3 Feb 2022, 09:52 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 3 Feb 2022, 10:43
          2
          • J jsulm
            3 Feb 2022, 09:52

            @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 3 Feb 2022, 10:43 last edited by
            #5

            @jsulm Thank you very much !

            It's exactly what I needed.

            In the top !

            1 Reply Last reply
            0

            1/5

            3 Feb 2022, 09:21

            • Login

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