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. how to change the background color of QLineEdit
Forum Updated to NodeBB v4.3 + New Features

how to change the background color of QLineEdit

Scheduled Pinned Locked Moved Solved General and Desktop
18 Posts 4 Posters 19.0k Views 2 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.
  • Q Offline
    Q Offline
    Qt Enthusiast
    wrote on 12 Jun 2017, 10:38 last edited by
    #9

    But I am not able to use copy and paste with

    https://forum.qt.io/topic/80070/how-to-change-the-mouse-cursor-that-shows-qlable-is-selectable/11

    1 Reply Last reply
    0
    • Q Qt Enthusiast
      12 Jun 2017, 09:40

      but I am seeing boundary which I do not want I want QLineEdit should be part background widger

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 12 Jun 2017, 10:43 last edited by
      #10

      @Qt-Enthusiast Did you check the link @J-Hilk provided? It show how to change border of QLineEdit.

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

      1 Reply Last reply
      0
      • Q Offline
        Q Offline
        Qt Enthusiast
        wrote on 12 Jun 2017, 10:45 last edited by
        #11

        I will try

        1 Reply Last reply
        0
        • E Eddy
          12 Jun 2017, 10:31

          @Qt-Enthusiast
          As I see the context of what you want to do I would advise to use a QLabel instead of the QLineEdit. You never want to use it as an input field are you?

          If you use QLabel you already have the background color without the border

          E Offline
          E Offline
          Eddy
          wrote on 12 Jun 2017, 11:19 last edited by
          #12

          @Eddy said in how to change the background color of QLineEdit:

          As I see the context of what you want to do I would advise to use a QLabel instead of the QLineEdit. You never want to use it as an input field are you?

          @Qt-Enthusiast Could you please answer the question?

          Qt Certified Specialist
          www.edalsolutions.be

          1 Reply Last reply
          0
          • E Eddy
            12 Jun 2017, 10:31

            @Qt-Enthusiast
            As I see the context of what you want to do I would advise to use a QLabel instead of the QLineEdit. You never want to use it as an input field are you?

            If you use QLabel you already have the background color without the border

            Q Offline
            Q Offline
            Qt Enthusiast
            wrote on 12 Jun 2017, 11:34 last edited by
            #13

            @Eddy But I am not able to use copy and paste with

            https://forum.qt.io/topic/80070/how-to-change-the-mouse-cursor-that-shows-qlable-is-selectable/11

            reply

            E 1 Reply Last reply 12 Jun 2017, 12:02
            0
            • Q Qt Enthusiast
              12 Jun 2017, 11:34

              @Eddy But I am not able to use copy and paste with

              https://forum.qt.io/topic/80070/how-to-change-the-mouse-cursor-that-shows-qlable-is-selectable/11

              reply

              E Offline
              E Offline
              Eddy
              wrote on 12 Jun 2017, 12:02 last edited by
              #14

              @Qt-Enthusiast

              OK, you don't want QLabel because you need copy paste funcitonality. Now I understand.

              You can use the following stylesheet on your lineedit :

              ui->lineEdit->setStyleSheet("background: transparent;  border: 0px ;");
              

              Qt Certified Specialist
              www.edalsolutions.be

              Q 1 Reply Last reply 12 Jun 2017, 12:09
              0
              • Q Offline
                Q Offline
                Qt Enthusiast
                wrote on 12 Jun 2017, 12:07 last edited by
                #15

                ui->lineEdit->setStyleSheet("background: transparent; border: 0px ;"); is giving me white color for background , how to set Color with RGB QColor(236,236,236) in below line

                ui->lineEdit->setStyleSheet("background: transparent; border: 0px ;");

                1 Reply Last reply
                0
                • E Offline
                  E Offline
                  Eddy
                  wrote on 12 Jun 2017, 12:09 last edited by
                  #16

                  ui->lineEdit->setStyleSheet("background-color: rgb(236, 236, 236); border: 0px ;");

                  Qt Certified Specialist
                  www.edalsolutions.be

                  1 Reply Last reply
                  0
                  • E Eddy
                    12 Jun 2017, 12:02

                    @Qt-Enthusiast

                    OK, you don't want QLabel because you need copy paste funcitonality. Now I understand.

                    You can use the following stylesheet on your lineedit :

                    ui->lineEdit->setStyleSheet("background: transparent;  border: 0px ;");
                    
                    Q Offline
                    Q Offline
                    Qt Enthusiast
                    wrote on 12 Jun 2017, 12:09 last edited by Eddy 6 Dec 2017, 12:17
                    #17
                    This post is deleted!
                    1 Reply Last reply
                    0
                    • E Offline
                      E Offline
                      Eddy
                      wrote on 12 Jun 2017, 13:32 last edited by Eddy 6 Dec 2017, 13:40
                      #18

                      @Qt-Enthusiast
                      Glad you could make it work. Can you please mark this topic as solved and start a new one since this is a totally different question.
                      Please provide us with the needed code of what you have already and explain as good as possible what you want to do.

                      Edit : made a new topic for your question : copy from qlineedit using pop up menu

                      Qt Certified Specialist
                      www.edalsolutions.be

                      1 Reply Last reply
                      0

                      18/18

                      12 Jun 2017, 13:32

                      • Login

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