Results 1 to 7 of 7

Thread: Regarding qlineargradient

  1. #1
    Join Date
    Sep 2007
    Posts
    83
    Thanks
    6
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Regarding qlineargradient

    Hi,
    Qt Code:
    1. background: qlineargradient(x1:0, y1:0, x2:1, y2:1,
    2. stop:0 white, stop: 0.4 gray, stop:1 green)
    To copy to clipboard, switch view to plain text mode 
    Using the above syntax i can able to change the my widget(push button) background color from top-left corner to bottom-right corner.
    But my requirement is i have to fix push button top layer(i.e x1:0, y1:0, x2:0, y2:1) with one color and bottom layer( i.e x1:1, y1:0, x2:1, y2:1)with different color.How can i achieve this? Is it possible or not?

    thank you.

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

    Default Re: Regarding qlineargradient

    Could you provide an image of what 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.


  3. #3
    Join Date
    Sep 2007
    Posts
    83
    Thanks
    6
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Regarding qlineargradient

    Hi wysota,
    For look and feel customization i am using style sheet concept in QT.my requirement is as i mentioned in my previous post,as per your requirement i attached image of my requirement in with file name "Button.png".Button.png

    few more questions i need to ask u.How i can change the normal push button shape.me requirement shapes are attached with the file names of "Le1.png" & "Le2.png".
    Le1.png

    Le2.png

    I have to add search icon to the combo box in the right corner besides the drop down icon.when i was using below code in "change style sheet" my search icon is overlapping with drop down icon.i am not able to align icon properly.actual my requirement image is attached with the file name"search_line.png"
    Search_Line.png
    Qt Code:
    1. background: url(F:/QT/4.4.3/1239617088_bullet_arrow_up.png);
    2. background-position: bottom right;
    3. background-repeat: no-repeat;
    To copy to clipboard, switch view to plain text mode 

    NOTE:
    1)please open .png files using "Microsoft office picture manager" for better look and feel appearance.
    2)for all above look and feel consideration purpose i used QT designer's widget "change style sheet" property in my project.

    thanks in advance.

  4. #4
    Join Date
    Sep 2007
    Posts
    83
    Thanks
    6
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Regarding qlineargradient

    Please consider this attachment for above post
    "search line.png"

    thank u.
    Attached Images Attached Images

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

    Default Re: Regarding qlineargradient

    I still don't understand the problem with the button You mean you want a button with a sharp border between two colours (which doesn't look like the one you posted) or a smooth transition between two gradients going in different directions throughout the whole button? If the latter, then this is not a linear gradient anymore. You can either try a conical gradient or just subsitute the gradient with an image which is also the answer to your second question. Transparent parts of the button have to be transparent in the image and/or you need to provide a mask for the button using QWidget::setMask().
    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.


  6. #6
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Regarding qlineargradient

    Another option might be you design your buttons in a graphical application and then set it to your buttons. See "QPushButton and images" in the "Qt Style Sheets Examples".

  7. The following user says thank you to Lykurg for this useful post:

    jjbabu (15th April 2009)

  8. #7
    Join Date
    Sep 2007
    Posts
    83
    Thanks
    6
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Regarding qlineargradient

    I did it man!!!!!!!!!!thank u.
    wysota,that button coloring also solved
    inspite of putting below code
    Qt Code:
    1. background-color: qlineargradient(x1:0, y1:0, x2:[B]0[/B], y2:1,
    2. stop:0 white, stop: 0.5 #daf4f0, stop:1 #daf4f0);
    To copy to clipboard, switch view to plain text mode 
    I modified like this
    Qt Code:
    1. background-color: qlineargradient(x1:0, y1:0, x2:[B]1[/B], y2:1,
    2. stop:0 white, stop: 0.5 #daf4f0, stop:1 #daf4f0);
    To copy to clipboard, switch view to plain text mode 
    using this linearly 50%top layer one color and remaining 50% different color.


    what about that combo box search icon alignment.please provide solution for that?
    thanks a lot....

Similar Threads

  1. Replies: 2
    Last Post: 23rd June 2008, 01:26
  2. Related QLinearGradient
    By ashishsaryar in forum Qt Programming
    Replies: 5
    Last Post: 26th May 2008, 10:09
  3. QLinearGradient question
    By ^NyAw^ in forum Qt Programming
    Replies: 3
    Last Post: 7th March 2008, 16:52

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.