Results 1 to 2 of 2

Thread: QLabel not showing

  1. #1
    Join Date
    Jan 2006
    Location
    Ljubljana
    Posts
    687
    Thanks
    111
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default QLabel not showing

    Hi to all again!

    I have a small nasty error. I have this code chunk:
    Qt Code:
    1. // label creation
    2. m_pTotalLabel=new QLabel(tr("SKUPAJ:"), this); // creates new label
    3. Q_CHECK_PTR(m_pTotalLabel); // checks creation
    4. //m_pTotalLabel->setFrameStyle(QFrame::Panel | QFrame::Raised);
    5. m_pTotalLabel->setAutoFillBackground(true);
    6. QPalette TotalFieldPalette=m_pTotalLabel->palette(); // gets current pallete of current widget
    7. TotalFieldPalette.setColor(QPalette::Base, Qt::black); // sets backgorund color of widget
    8. TotalFieldPalette.setColor(QPalette::Text, Qt::white); // sets foreground color of widget
    9. m_pTotalLabel->setPalette(TotalFieldPalette); // sets palette
    10. m_pTotalLayout->addWidget(m_pTotalLabel); // adds widget to layout
    11. // **** end of label creation
    To copy to clipboard, switch view to plain text mode 

    Well, the label is not shown. Why???!!!
    Qt 5.3 Opensource & Creator 3.1.2

  2. #2
    Join Date
    Jan 2006
    Location
    Ljubljana
    Posts
    687
    Thanks
    111
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: QLabel not showing [SOLVED]

    Well, god damn, sloppy again. Instead of
    Qt Code:
    1. TotalFieldPalette.setColor(QPalette::Text, Qt::white); // sets foreground color of widget
    To copy to clipboard, switch view to plain text mode 
    one must use
    Qt Code:
    1. TotalFieldPalette.setColor(QPalette::WindowText, Qt::white); // sets foreground color of widget
    To copy to clipboard, switch view to plain text mode 
    Qt 5.3 Opensource & Creator 3.1.2

Similar Threads

  1. QLabel ScaledContents ignored by style sheet?
    By WinchellChung in forum Newbie
    Replies: 3
    Last Post: 27th February 2008, 15:50
  2. QLabel size policy
    By Caius Aérobus in forum Qt Programming
    Replies: 3
    Last Post: 7th December 2007, 18:57
  3. about qt/embedded widgets showing in ARM platform
    By xianshuiren in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 3rd December 2007, 06:48
  4. QScrollArea display custom QLabel
    By spawnwj in forum Qt Programming
    Replies: 6
    Last Post: 6th December 2006, 04:38

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.