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. Customization of push button
Forum Updated to NodeBB v4.3 + New Features

Customization of push button

Scheduled Pinned Locked Moved Solved General and Desktop
28 Posts 5 Posters 13.6k Views 3 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.HilkJ J.Hilk

    @David406

    QPushButton{border: none;}
    
    M Offline
    M Offline
    mostefa
    wrote on last edited by
    #21

    @J.Hilk said in Customization of push button:

    @David406

    QPushButton{border: none;}
    

    AFAIK border: none; will not change anything

    D J.HilkJ 2 Replies Last reply
    0
    • M mostefa

      @J.Hilk said in Customization of push button:

      @David406

      QPushButton{border: none;}
      

      AFAIK border: none; will not change anything

      D Offline
      D Offline
      David406
      wrote on last edited by David406
      #22

      @mostefa
      Yes, border: none; is the default setting.
      And I want to be able to move those buttons around, so I did not use layout to add these buttons.

      1 Reply Last reply
      0
      • M mostefa

        @J.Hilk said in Customization of push button:

        @David406

        QPushButton{border: none;}
        

        AFAIK border: none; will not change anything

        J.HilkJ Offline
        J.HilkJ Offline
        J.Hilk
        Moderators
        wrote on last edited by
        #23

        @mostefa

        Just checked it, it does exactly what the OP want to, it removes the border/bulge of the default QPushButton


        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


        Q: What's that?
        A: It's blue light.
        Q: What does it do?
        A: It turns blue.

        D 1 Reply Last reply
        1
        • J.HilkJ J.Hilk

          @mostefa

          Just checked it, it does exactly what the OP want to, it removes the border/bulge of the default QPushButton

          D Offline
          D Offline
          David406
          wrote on last edited by
          #24

          @J.Hilk
          Yes, I checked it too. This really helped.
          border-style:none; is default, not border:none;
          Thank you all !!!

          1 Reply Last reply
          0
          • D Offline
            D Offline
            David406
            wrote on last edited by David406
            #25

            Hi all, I have one more question. How can I let the buttons pushed down when mouse hovers on it, like below:

            alt text

            The arrow button is pushed down when my mouse hovers on it.
            Could you please give some hints on what method to use? There's no hover or enter event for a button.

            Aside: When border is set to none, there would never appear a border even when I pused on it, which is not what I meant to do. Confused!

            J.HilkJ 1 Reply Last reply
            0
            • D David406

              Hi all, I have one more question. How can I let the buttons pushed down when mouse hovers on it, like below:

              alt text

              The arrow button is pushed down when my mouse hovers on it.
              Could you please give some hints on what method to use? There's no hover or enter event for a button.

              Aside: When border is set to none, there would never appear a border even when I pused on it, which is not what I meant to do. Confused!

              J.HilkJ Offline
              J.HilkJ Offline
              J.Hilk
              Moderators
              wrote on last edited by
              #26

              @David406

              QStyleSheet is also here your friend. For example:

              QPushButton:hover{background-color:red;}
              

              Here a link to some examples


              Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


              Q: What's that?
              A: It's blue light.
              Q: What does it do?
              A: It turns blue.

              D 1 Reply Last reply
              3
              • J.HilkJ J.Hilk

                @David406

                QStyleSheet is also here your friend. For example:

                QPushButton:hover{background-color:red;}
                

                Here a link to some examples

                D Offline
                D Offline
                David406
                wrote on last edited by
                #27

                @J.Hilk
                Oh, yes! Please forgive me, I'm quite new about the usage of stylesheet! So I need to set different stylesheet for normal, hover and pushed status.

                J.HilkJ 1 Reply Last reply
                0
                • D David406

                  @J.Hilk
                  Oh, yes! Please forgive me, I'm quite new about the usage of stylesheet! So I need to set different stylesheet for normal, hover and pushed status.

                  J.HilkJ Offline
                  J.HilkJ Offline
                  J.Hilk
                  Moderators
                  wrote on last edited by
                  #28

                  @David406

                  that would be correct:

                  a small example:

                  ui->myButton->setStyleSheet(
                  //Default Button
                  "QPushButton{border:none; color: black; background-color:transparent;}"
                  //When mose over
                  "QPushButton:hover{border: 1px solid grey; color: red; background-color:white;}"
                  //When checked
                  "QPushButton:checked{border: 1px solid black; color: white; background-color:red;}"
                  );
                  

                  Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                  Q: What's that?
                  A: It's blue light.
                  Q: What does it do?
                  A: It turns blue.

                  1 Reply Last reply
                  2

                  • Login

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