Results 1 to 5 of 5

Thread: problems with setbackgroundcolor of tablewidgetItem

  1. #1
    Join Date
    Feb 2012
    Location
    Bologna
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Post problems with setbackgroundcolor of tablewidgetItem

    Hi all,

    I create an application with qt4.7
    I'm using a QTableWidget (tableData) and I define his property runtime.

    Here I define a header
    Qt Code:
    1. void AnaResults::SetHeaderRow(int row, QString dato)
    2. {
    3. newItem->setData(0,dato);
    4. const QColor color(76,123,200);
    5. newItem->setBackgroundColor(color);
    6. newItem->setSizeHint(QSize(280,20));
    7. ui->tableData->setVerticalHeaderItem(row,newItem);
    8.  
    9. }
    To copy to clipboard, switch view to plain text mode 

    all it's ok!

    But when I install the application on another pc, the color of the alls headers is wrong!!!
    Do I missing some .dll on installation package???? I didn't find it!!!!

    thans for help or suggestions!!

    Claudia

  2. #2
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Thanks
    3
    Thanked 106 Times in 103 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: problems with setbackgroundcolor of tablewidgetItem

    On what OS you're developing and on what OS you're installing your app?
    Maybe the target OS is taking over styling of the table headers?

    Aslo, what you mean "all headers is wrong"? Is the color there but not the one you've set?
    You could show screenshot of how it is and how it should be for us to better understand your problem.

  3. #3
    Join Date
    Feb 2012
    Location
    Bologna
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: problems with setbackgroundcolor of tablewidgetItem

    Hi..

    I tested my app in a differrent PC but in same OS of the developing (XP), the result is the same, the table is wrong.

    I show you the different tables:

    Here the RIGHT table in my developing pc (XP) (release version):

    Rtable.png

    Here the WRONG table in a different PC (XP without qt application) (release version) --PC2--:

    WRtable.png


    I tried to save in the PC2 different qt dlls in the path of my application .. without to resolve the problem. Now I don't What I have do!!

    THANKS

  4. #4
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Thanks
    3
    Thanked 106 Times in 103 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: problems with setbackgroundcolor of tablewidgetItem

    Hmmm odd.

    Try using stylesheets:
    Qt Code:
    1. tableWidget->setStyleSheet(
    2. "QHeaderView:section{ background-color: rgb(108, 82, 255); }\n"
    3. "QTableCornerButton::section{ background-color: rgb(108, 82, 255); }"
    4. );
    To copy to clipboard, switch view to plain text mode 

    For more information on what and how you can style take a look here and here.

  5. The following user says thank you to Spitfire for this useful post:

    cfalcioni (24th May 2012)

  6. #5
    Join Date
    Feb 2012
    Location
    Bologna
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: problems with setbackgroundcolor of tablewidgetItem

    Hi,
    I solved my question with stlylesheets..

    thanks

Similar Threads

  1. Replies: 2
    Last Post: 23rd July 2010, 14:53
  2. Some problems
    By Dante in forum Qt Programming
    Replies: 13
    Last Post: 20th July 2009, 14:38
  3. Replies: 1
    Last Post: 31st January 2009, 23:00
  4. Problems using a DLL
    By prosass in forum Newbie
    Replies: 7
    Last Post: 6th March 2007, 17:45
  5. QT4 Plugins - problems, problems
    By NormanDunbar in forum Qt Programming
    Replies: 6
    Last Post: 9th May 2006, 15:39

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.