Results 1 to 13 of 13

Thread: How to escape from image background?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2012
    Posts
    66
    Thanks
    21
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Question How to escape from image background?

    I created image background by border_image to make it zoom-able but whenever I create lineEdit,, Menu, or other things, the background still exist in those tool. How can I make other too empty of background that I have created? Capture.jpg

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to escape from image background?

    How exactly did you apply the background?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Sep 2012
    Posts
    66
    Thanks
    21
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: How to escape from image background?

    Thanks, but now I found the solution and now a new trouble is I have a label that containing image and whenever I re-size the form I want the background and the label re-size together. Could you give me advises?

    I apply it
    Qt Code:
    1. this->setStyleSheet("border-image: url(:/testLoadImage/C:/Users/kimkeang/Pictures/bc-black-ui.png)");
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to escape from image background?

    Quote Originally Posted by chong_kimkeang View Post
    Thanks, but now I found the solution and now a new trouble is I have a label that containing image and whenever I re-size the form I want the background and the label re-size together. Could you give me advises?
    Is the label in a layout?

    I apply it
    Qt Code:
    1. this->setStyleSheet("border-image: url(:/testLoadImage/C:/Users/kimkeang/Pictures/bc-black-ui.png)");
    To copy to clipboard, switch view to plain text mode 
    That's wrong because it also applies to child widgets. You need a selector (e.g. by id or by class) that will only pick the widget you want.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Sep 2012
    Posts
    66
    Thanks
    21
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: How to escape from image background?

    My code is:

    Qt Code:
    1. #include "testloadimage.h"
    2.  
    3. testLoadImage::testLoadImage(QWidget *parent, Qt::WFlags flags)
    4. : QDialog(parent, flags)
    5. {
    6. ui.setupUi(this);
    7. QPixmap bac_image(":/testLoadImage/C:/Users/kimkeang/Pictures/bc-black-ui.png");
    8. this->setStyleSheet("border-image: url(:/testLoadImage/C:/Users/kimkeang/Pictures/bc-black-ui.png)");
    9. QPixmap pix(":/C:/Users/kimkeang/Pictures/blank-canvas.png");
    10.  
    11. ui.label->setPixmap(pix);
    12.  
    13.  
    14. ui.label->setGeometry(QRect(180,100,pix.width(),pix.height()));
    15. ui.label->adjustSize();
    16. resize(bac_image.width(), bac_image.height());
    17. }
    To copy to clipboard, switch view to plain text mode 

    whenever I re-size the form, I need the background and the label re-size too.


    Can you tell me more specific?
    Last edited by chong_kimkeang; 10th October 2012 at 09:05.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to escape from image background?

    This doesn't state whether you are using layouts or not. Looking at line #14 of your snippet, I'm assuming that not. So go back to Designer and apply a layout to your form.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Sep 2012
    Posts
    66
    Thanks
    21
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: How to escape from image background?

    use QFormLayout, QGridLayout or which layout? and If I use layout, I can re-size the label but the label will be swipe-able(to left or to right) because I will make it swipe-able. Which solution should I use?

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to escape from image background?

    Quote Originally Posted by chong_kimkeang View Post
    use QFormLayout, QGridLayout or which layout?
    Whichever you want and whichever suits your purpose, I don't care.
    and If I use layout, I can re-size the label but the label will swipe-able(to left or to right).
    Good for you.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  9. #9
    Join Date
    Sep 2012
    Posts
    66
    Thanks
    21
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: How to escape from image background?

    Can I swipe the label if I use layout?

  10. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to escape from image background?

    Quote Originally Posted by chong_kimkeang View Post
    Can I swipe the label if I use layout?
    Not directly.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  11. #11
    Join Date
    Sep 2012
    Posts
    66
    Thanks
    21
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: How to escape from image background?

    Not directly? what is not direct? only this two worlds I can do nothing. Can you kindly tell me or give me ways?

Similar Threads

  1. Replies: 3
    Last Post: 3rd August 2012, 10:35
  2. Replies: 0
    Last Post: 5th April 2011, 13:36
  3. Image as a background
    By Tomasz in forum Newbie
    Replies: 5
    Last Post: 6th December 2010, 14:37
  4. Replies: 1
    Last Post: 25th June 2010, 18:31
  5. [QT4.1.1 XP] background image
    By incapacitant in forum Newbie
    Replies: 3
    Last Post: 1st March 2006, 13:02

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.