Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. PySide2 and string based style for quick testing...
QtWS25 Last Chance

PySide2 and string based style for quick testing...

Scheduled Pinned Locked Moved Solved General and Desktop
qstylesheetpyside2
6 Posts 4 Posters 578 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.
  • D Offline
    D Offline
    Dariusz
    wrote on 10 Oct 2019, 05:42 last edited by
    #1

    Hey

    How can I properly do this ? :

        style = """
        {
            background-color : rgba(64,64,64,255);
        };
        
        QLabel { 
            color: rgb(50, 50, 50); 
            font-size: 11px; 
            background-color: rgba(188, 188, 188, 50); 
            border: 1px solid rgba(188, 188, 188, 250); 
        } ;
        
        QSpinBox 
        { 
            color: rgb(50, 50, 50); 
            font-size: 11px; 
            background-color: rgba(255, 188, 20, 50); 
        };
        """
    
        model = QGraphicsScene()
    
        view = QGraphicsView()
        view.setStyleSheet(style)
    

    It seems to not work as is

    TIA

    J 1 Reply Last reply 10 Oct 2019, 07:10
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 10 Oct 2019, 06:47 last edited by
      #2

      Hi
      Not even when " is on same line/ no newline?

      s = """ this is a very
              long string if I had the
              energy to type more and more ..."""
      
      or
       s = ("this is a very"
            "long string too"
            "for sure ..."
           )
      
      
      1 Reply Last reply
      0
      • D Dariusz
        10 Oct 2019, 05:42

        Hey

        How can I properly do this ? :

            style = """
            {
                background-color : rgba(64,64,64,255);
            };
            
            QLabel { 
                color: rgb(50, 50, 50); 
                font-size: 11px; 
                background-color: rgba(188, 188, 188, 50); 
                border: 1px solid rgba(188, 188, 188, 250); 
            } ;
            
            QSpinBox 
            { 
                color: rgb(50, 50, 50); 
                font-size: 11px; 
                background-color: rgba(255, 188, 20, 50); 
            };
            """
        
            model = QGraphicsScene()
        
            view = QGraphicsView()
            view.setStyleSheet(style)
        

        It seems to not work as is

        TIA

        J Offline
        J Offline
        JonB
        wrote on 10 Oct 2019, 07:10 last edited by
        #3

        @Dariusz
        I cannot spot anything wrong in your multi-line string. However, what are the } ;s? I don't recall there being any semi-colons after the close curly braces, these are not programming statements. Are they interfering with the behaviour?

        D 1 Reply Last reply 11 Oct 2019, 05:21
        1
        • J JonB
          10 Oct 2019, 07:10

          @Dariusz
          I cannot spot anything wrong in your multi-line string. However, what are the } ;s? I don't recall there being any semi-colons after the close curly braces, these are not programming statements. Are they interfering with the behaviour?

          D Offline
          D Offline
          Dariusz
          wrote on 11 Oct 2019, 05:21 last edited by
          #4

          @JonB Old habbits of C++ coding I think.

          I removed them, tried different options. My style still don't change :- (

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 11 Oct 2019, 19:20 last edited by
            #5

            Hi,

            What exactly doesn't work ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            1
            • D Offline
              D Offline
              Dariusz
              wrote on 15 Oct 2019, 18:44 last edited by
              #6

              I had to replace this :

               style = """
                  {
                      background-color : rgba(64,64,64,255);
                  };
              

              With either:

               style = """
                  *{
                      background-color : rgba(64,64,64,255);
                  };
              

              Or

               style = """
                  QWidget {
                      background-color : rgba(64,64,64,255);
                  };
              

              And then it works :- )

              1 Reply Last reply
              1

              6/6

              15 Oct 2019, 18:44

              • Login

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