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. QPushButton design (style sheet)
Forum Updated to NodeBB v4.3 + New Features

QPushButton design (style sheet)

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 359 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.
  • K Offline
    K Offline
    Kycho
    wrote on last edited by Kycho
    #1

    Hello, everyone.
    I want to assign the image and background color to the button at the same time.

    The form I want is shown below.
    0_1545812133834_qtbutton.png

    The red square has a background color and "Text" at the top. The white square is an image.

    This was all I could do.

    QPushButton *button = new QPushbutton
    button-> setStyleSheet ("border-image: url (test.jpg);");
    

    I do not know how to do it.

    Thank you for your advice.

    RatzzR 1 Reply Last reply
    0
    • K Kycho

      Hello, everyone.
      I want to assign the image and background color to the button at the same time.

      The form I want is shown below.
      0_1545812133834_qtbutton.png

      The red square has a background color and "Text" at the top. The white square is an image.

      This was all I could do.

      QPushButton *button = new QPushbutton
      button-> setStyleSheet ("border-image: url (test.jpg);");
      

      I do not know how to do it.

      Thank you for your advice.

      RatzzR Offline
      RatzzR Offline
      Ratzz
      wrote on last edited by
      #2

      @Kycho

      Its better to use QToolButton as suggested here .

      --Alles ist gut.

      1 Reply Last reply
      4
      • K Offline
        K Offline
        Kycho
        wrote on last edited by
        #3

        Thank you.
        It has helped a lot.

        1 Reply Last reply
        0

        • Login

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