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 setting the background-image
Forum Updated to NodeBB v4.3 + New Features

How to setting the background-image

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.1k Views 1 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.
  • H Offline
    H Offline
    hk520590
    wrote on last edited by
    #1

    transition band how to achieve !thank you everyone!
    !http://www.qtcn.org/bbs/attachment/Mon_1308/26_124672_738763b96fb3541.jpg(myEffect)!
    !http://www.qtcn.org/bbs/attachment/Mon_1308/26_124672_0dfa083c0239ddf.jpg(the want to effect)!

    1 Reply Last reply
    0
    • JeroentjehomeJ Offline
      JeroentjehomeJ Offline
      Jeroentjehome
      wrote on last edited by
      #2

      Hi,
      What code do you use? What settings?
      The mistake often made is that people use the
      background image in the stylesheet, but you should use the border-image option. Then the image will be resized with the widget size.
      @
      // Setup the border-image as the selected image
      QString strStyle("");

              strStyle.clear();
              strStyle.append("QFrame{border-image: url(");
              strStyle.append(strPicture);   // = ":/BackGroundPictures/BackGroundPictures/M01DrukSensor.PNG"
              strStyle.append(");");
              strStyle.append("}");
      
              pFrame->setStyleSheet(strStyle);
      

      @

      Greetz, Jeroen

      1 Reply Last reply
      0
      • H Offline
        H Offline
        hk520590
        wrote on last edited by
        #3

        thank you, but your way is not my want to effect!
        my view is the image no resize!use other color fill the widget!
        how to use the "paintevent" to achieve this effect!
        I want to second effect!
        [quote author="Jeroentje@home" date="1376649188"]Hi,
        What code do you use? What settings?
        The mistake often made is that people use the
        background image in the stylesheet, but you should use the border-image option. Then the image will be resized with the widget size.
        @
        // Setup the border-image as the selected image
        QString strStyle("");

                strStyle.clear();
                strStyle.append("QFrame{border-image: url(");
                strStyle.append(strPicture);   // = ":/BackGroundPictures/BackGroundPictures/M01DrukSensor.PNG"
                strStyle.append(");");
                strStyle.append("}");
        
                pFrame->setStyleSheet(strStyle);
        

        @[/quote]

        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