Results 1 to 5 of 5

Thread: Backgroundcolor QLCDNumber in Windows?

  1. #1
    Join Date
    Aug 2006
    Location
    The Netherlands
    Posts
    64
    Thanks
    6
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Backgroundcolor QLCDNumber in Windows?

    I use a QLCDNumber and I changed the color of the background like this:

    Qt Code:
    1. lCDNumber1 = new QLCDNumber(myobjectDialog);
    2. lCDNumber1->setGeometry(QRect(240, 810, 130, 40));
    3. lCDNumber1->setLineWidth(1);
    4. lCDNumber1->setSmallDecimalPoint(FALSE);
    5. lCDNumber1->setNumDigits(7);
    6. lCDNumber1->setSegmentStyle(QLCDNumber::Flat);
    7. lCDNumber1->setProperty("value", 0);
    8.  
    9. lcdpalette = new QPalette;
    10. lcdpalette->setColor(QPalette::Background, QColor(170, 255, 0));
    11. lcdpalette->setColor(QPalette::Base, QColor(170, 255, 0));
    12. lcdpalette->setColor(QPalette::AlternateBase, QColor(170, 255, 0));
    13. lCDNumber1->setPalette(*lcdpalette);
    To copy to clipboard, switch view to plain text mode 

    In Linux it works ok, but in Windows XP the backgroundcolor of the QLCDNumber
    is lightgrey instead of green. I changed the style to Plastique with:

    Qt Code:
    1. app.setStyle(new QPlastiqueStyle);
    To copy to clipboard, switch view to plain text mode 

    this changed the style to plastic in Windows XP but I still can not change the
    backgroundcolor of QLCDNumber.

    What do I need to do to get this working in Windows XP?

    Regards, Teuniz

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Backgroundcolor QLCDNumber in Windows?

    Have you tried?
    Qt Code:
    1. lCDNumber1->setAutoFillBackground(true);
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  3. #3
    Join Date
    Aug 2006
    Location
    The Netherlands
    Posts
    64
    Thanks
    6
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Backgroundcolor QLCDNumber in Windows?

    Qt Code:
    1. lCDNumber1->setAutoFillBackground(true);
    To copy to clipboard, switch view to plain text mode 
    does not work

    mainwindow.cpp: In constructor ‘UI_Mainwindow::UI_Mainwindow()’:
    mainwindow.cpp:246: error: ‘class QLCDNumber’ has no member named ‘setAutoFillBackground
    Last edited by Teuniz; 30th August 2006 at 12:31.

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Backgroundcolor QLCDNumber in Windows?

    Quote Originally Posted by Teuniz
    mainwindow.cpp:246: error: ‘class QLCDNumber’ has no member named ‘setAutoFillBackground
    Are you using Qt 4.0? The function was introduced in 4.1. I strongly suggest you to update to a recent version of Qt..
    Attached Images Attached Images
    J-P Nurmi

  5. #5
    Join Date
    Aug 2006
    Location
    The Netherlands
    Posts
    64
    Thanks
    6
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Backgroundcolor QLCDNumber in Windows?

    You are right, my QT version in Linux is 4.0 and it doesn't recognize this function.
    I switched to Windows and now the fucntion is recognized because this version is 4.1.

    Now the LCDNumber has the right backgroundcolor

    Many thanks!

Similar Threads

  1. Draging a non-existing file to the Windows Desktop
    By klaus1111 in forum Qt Programming
    Replies: 13
    Last Post: 20th September 2007, 11:47
  2. Child Windows
    By s_a_white in forum Newbie
    Replies: 1
    Last Post: 16th July 2006, 00:20
  3. qt and mingw can not run on windows 98?
    By evewei in forum Installation and Deployment
    Replies: 4
    Last Post: 26th June 2006, 09:22
  4. MDI windows without QWorkspace
    By Big Duck in forum Newbie
    Replies: 2
    Last Post: 16th June 2006, 17:15
  5. Installing Qt 4.1 (open source) on Windows XP
    By katrina in forum Installation and Deployment
    Replies: 8
    Last Post: 19th February 2006, 12:26

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.