Discussion Board

Results 1 to 5 of 5

Thread: Table view

  1. #1
    Registered User nqrgaard's Avatar
    Join Date
    Nov 2010
    Posts
    9
    Hello

    I'm trying to make a app with table view.
    I want to make some kind of parking lot where each table item has a ID. Any one who can help me?
    Should i use table view og table widget?
    I also want to change the color when a item with a cirtan ID is taken. Green color when it is free and red when it is taken.

  2. #2
    Nokia Developer Moderator divanov's Avatar
    Join Date
    Oct 2009
    Posts
    4,326
    It's easier to use QTableWidget, but QTableView is more flexible.
    You can change color of a cell with QAbstractItemModel::setData() changing brush for Qt::BackgroundRole
    http://doc.qt.nokia.com/4.7/qabstrac...l.html#setData
    http://doc.qt.nokia.com/4.7/qtablewidget.html#item
    http://doc.qt.nokia.com/4.7/qtablewi...m.html#setData

  3. #3
    Registered User nqrgaard's Avatar
    Join Date
    Nov 2010
    Posts
    9
    Thanks for your reply.
    I have made a tableview with the widget, so it must be the tablewidget. And i clicked go to slot where i choose the cellpressed. But i don't know if it is the right way to do it.
    I still want to change the color of a item in the table. But i don't know how to use these.

    If it was the right way to set up the widget, is the code i got from the CPP file here:

    void MainWindow:n_tableWidget_cellPressed(int row, int column)
    {

    }


    When i press the item the backgroundcolor should change

  4. #4
    Nokia Developer Moderator divanov's Avatar
    Join Date
    Oct 2009
    Posts
    4,326
    Two last links from my previous post explain how to achieve what you want.
    How to get pointer to QTableWidget in the slot:
    http://doc.qt.nokia.com/4.7/qobject.html#sender

  5. #5
    Registered User nqrgaard's Avatar
    Join Date
    Nov 2010
    Posts
    9
    I appreciate your reply, but i'm a noob, so if you could help me by writing the actural code, so i understand what you mean when you tell me how to use ex this code QAbstractItemModel:setData();

    I have made a table widget in the UI, which is called tableWidget and i have made a pushButton, so when the button is clicked the background of a item in the tableview would change color from green to red.

Similar Threads

  1. Table view
    By siva_321 in forum Symbian C++
    Replies: 2
    Last Post: 2010-01-20, 19:28
  2. Panic DBMS-Table 9 when view runs PutL
    By FrankTheFox in forum Symbian C++
    Replies: 2
    Last Post: 2009-06-27, 12:58
  3. Replies: 6
    Last Post: 2008-12-09, 10:47
  4. Replies: 1
    Last Post: 2002-10-29, 13:25
  5. Replies: 0
    Last Post: 2002-10-29, 07:31

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