Results 1 to 2 of 2

Thread: tableview and layouts

  1. #1
    Join Date
    Jan 2007
    Posts
    95
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default tableview and layouts

    I have used a tableview but when i try to put this table into a qwidget and use a Layout, i get an error....

    QHBoxLayout *Layout3=new QHBoxLayout();
    Layout3->addWidget(tableView);

    error C2664: 'QBoxLayout::addWidget' : no se puede convertir el parámetro 1 de 'QTableView' a 'QWidget *'

    I know that a tableview is not a QWidget, but how can i transform a tableview to a QWidget, or how can i use layouts with qtableview?????

  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: tableview and layouts

    Actually, QTableView is a QWidget. Looks like the table view is allocated on the stack. Allocate it on the heap (with operator "new") and pass the pointer to the table view to QBoxLayout::addWidget().
    J-P Nurmi

  3. The following user says thank you to jpn for this useful post:

    zorro68 (10th February 2007)

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.