Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor web_tur's Avatar
    Join Date
    Aug 2004
    Posts
    64
    Hi,

    I need a good source to understand how Qt::Foreground Role works with tableview. I just want to change text color depend on the one column value.

    Any body has good reading pages.

  2. #2
    Nokia Developer Expert Devnull's Avatar
    Join Date
    Sep 2011
    Posts
    381
    Please try adding the following to data() changes text colour for a cell or row:

    QVariant CustomSqlModel::data(const QModelIndex &index, int role) const
    {
    QVariant value = QSqlQueryModel::data(index, role);
    if (role == Qt::ForegroundRole && index.column() == 1)
    return qVariantFromValue(QColor(Qt::blue));
    return value;
    }

Similar Threads

  1. Table view
    By nqrgaard in forum Qt
    Replies: 4
    Last Post: 2010-11-30, 13:29
  2. Table view
    By siva_321 in forum Symbian C++
    Replies: 2
    Last Post: 2010-01-20, 19:28
  3. Panic DBMS-Table 9 when view runs PutL
    By FrankTheFox in forum Symbian C++
    Replies: 2
    Last Post: 2009-06-27, 12:58
  4. Problem switching app to foreground and activating view just after
    By juannoguera in forum Symbian User Interface
    Replies: 4
    Last Post: 2009-05-31, 10:24

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved