Results 1 to 9 of 9

Thread: variable

  1. #1
    Join Date
    Jul 2009
    Posts
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default variable

    hello,

    I have designed an int variable which has a value.
    The button where this variable is going to see is transparent, so when I run the application it doesn't apreciate.

    I have tryed with setPalette, QPen, QColor... but as I thought it doesn't work,due to a variable doesn't have this property.

    How can i solve it?

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: variable

    post some code

  3. #3
    Join Date
    Jul 2009
    Posts
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: variable

    FIRST::FIRST(QWidget *parent)
    : QWidget(parent)
    {
    ui.setupUi(this);
    aldaInt= 40;

    ui.pushButton->setText(qstr.number(aldaInt,10));
    }



    this pushButton is transparent and I want to change the color from black to white of the variable "aldaInt".

  4. #4
    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: variable

    since you use designer, change the palette there (ButtonText). There is also a preview that you can check your changes. Or set a style sheet with
    css Code:
    1. color: #FFFFFF;
    To copy to clipboard, switch view to plain text mode 

  5. #5
    Join Date
    Jul 2009
    Posts
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: variable

    sorry?i don't understand you!

  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: variable

    Qt Code:
    1. ui.pushButton->setText(QString::number(aldaInt,10));
    2. ui.pushButton->setStyleSheet("color: #ffffff;");
    To copy to clipboard, switch view to plain text mode 
    now the text of your button is white. (I thought this is what you want.)

  7. #7
    Join Date
    Jul 2009
    Posts
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: variable

    yes but no!

    my button must be transparent and the text white.
    If I do as you told me , both of them are white.

  8. #8
    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: variable

    Quote Originally Posted by Atuti2009 View Post
    If I do as you told me , both of them are white.
    What windowstyle do you use? You also can specify the background color using qss:
    Qt Code:
    1. ui.pushButton->setStyleSheet("color: #fff; background-color: transparent;")
    To copy to clipboard, switch view to plain text mode 

  9. #9
    Join Date
    Jul 2009
    Posts
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: variable

    oh!thanks!

    I forgot declaring the background color!!!

Similar Threads

  1. Eclipse debugging: Unable to create variable object
    By PUK_999 in forum Installation and Deployment
    Replies: 0
    Last Post: 20th August 2009, 21:42
  2. linking a slider to a global variable
    By switch in forum Newbie
    Replies: 6
    Last Post: 5th August 2009, 08:02
  3. nmake error during .pro compiling
    By mattia in forum Installation and Deployment
    Replies: 5
    Last Post: 18th June 2008, 10:15
  4. System environment variable
    By fahlen in forum Qt Programming
    Replies: 4
    Last Post: 27th November 2007, 19:02
  5. custom plugin designer property with out a variable?
    By high_flyer in forum Qt Programming
    Replies: 1
    Last Post: 15th March 2006, 19:11

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.