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. LineEdit style sheet

LineEdit style sheet

Scheduled Pinned Locked Moved Unsolved General and Desktop
stylesheetline edit
5 Posts 4 Posters 12.6k 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.
  • G Offline
    G Offline
    gabor53
    wrote on last edited by
    #1

    Hi,
    I have the following in my code:

        ui->LineEdit_Name->setStyleSheet("QLineEdit{ "
                                            "background-color:rgb(202, 255, 227);"
                                            "border: 2px solid gray;"
                                            "border-radius: 10px;"
                                            "padding: 0 8px;"
                                            "selection-background-color: darkgray;"
                                            "font-size: 16px;}"
                                            "QLineEdit:focus { "
                                            "background-color:rgb(192, 192, 255);}"
                                            );
    

    This works from code. But is it possible to define this in the Designer?
    When I choose change style sheet and add

    background-color:rgb(202, 255, 227); 
    border: 2px solid gray; 
    border-radius: 10px; 
    padding: 0 8px; 
    selection-background-color: darkgray; 
     font-size: 16px;
      focus {  
       background-color:rgb(192, 192, 255)}
    ``
    nothing happens though the window says it is a valid style sheet.
    Thank you for your help.
    RatzzR raven-worxR 2 Replies Last reply
    0
    • G gabor53

      Hi,
      I have the following in my code:

          ui->LineEdit_Name->setStyleSheet("QLineEdit{ "
                                              "background-color:rgb(202, 255, 227);"
                                              "border: 2px solid gray;"
                                              "border-radius: 10px;"
                                              "padding: 0 8px;"
                                              "selection-background-color: darkgray;"
                                              "font-size: 16px;}"
                                              "QLineEdit:focus { "
                                              "background-color:rgb(192, 192, 255);}"
                                              );
      

      This works from code. But is it possible to define this in the Designer?
      When I choose change style sheet and add

      background-color:rgb(202, 255, 227); 
      border: 2px solid gray; 
      border-radius: 10px; 
      padding: 0 8px; 
      selection-background-color: darkgray; 
       font-size: 16px;
        focus {  
         background-color:rgb(192, 192, 255)}
      ``
      nothing happens though the window says it is a valid style sheet.
      Thank you for your help.
      RatzzR Offline
      RatzzR Offline
      Ratzz
      wrote on last edited by Ratzz
      #2

      @gabor53
      try separating each line with \n .

      --Alles ist gut.

      1 Reply Last reply
      0
      • G gabor53

        Hi,
        I have the following in my code:

            ui->LineEdit_Name->setStyleSheet("QLineEdit{ "
                                                "background-color:rgb(202, 255, 227);"
                                                "border: 2px solid gray;"
                                                "border-radius: 10px;"
                                                "padding: 0 8px;"
                                                "selection-background-color: darkgray;"
                                                "font-size: 16px;}"
                                                "QLineEdit:focus { "
                                                "background-color:rgb(192, 192, 255);}"
                                                );
        

        This works from code. But is it possible to define this in the Designer?
        When I choose change style sheet and add

        background-color:rgb(202, 255, 227); 
        border: 2px solid gray; 
        border-radius: 10px; 
        padding: 0 8px; 
        selection-background-color: darkgray; 
         font-size: 16px;
          focus {  
           background-color:rgb(192, 192, 255)}
        ``
        nothing happens though the window says it is a valid style sheet.
        Thank you for your help.
        raven-worxR Offline
        raven-worxR Offline
        raven-worx
        Moderators
        wrote on last edited by
        #3

        @gabor53
        why don't you set the exact same stylesheet in the designer too?!

        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
        If you have a question please use the forum so others can benefit from the solution in the future

        1 Reply Last reply
        0
        • G Offline
          G Offline
          gabor53
          wrote on last edited by
          #4

          I tried but with "" it says the style is invalid.

          1 Reply Last reply
          0
          • S Offline
            S Offline
            Swapnil_Shelke
            wrote on last edited by
            #5

            QLineEdit{ background-color:rgb(202, 255, 227);
            border: 2px solid gray;
            border-radius: 10px;
            padding: 0 8px;
            selection-background-color: darkgray;
            font-size: 16px;}
            QLineEdit:focus { background-color:rgb(192, 192, 255);}

            Try to add this to your lineedit in the Designer.

            1 Reply Last reply
            1

            • Login

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