QTableview properties
-
hi , i have defined qtableview as this example i found on the internet :
@
model = new QStandardItemModel(2,3,this); //2 Rows and 3 Columns
model->setHorizontalHeaderItem(0, new QStandardItem(QString("ID")));
model->setHorizontalHeaderItem(1, new QStandardItem(QString("Name")));
model->setHorizontalHeaderItem(2, new QStandardItem(QString("Description")));
ui->tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
ui->tableView->setModel(model);
@i'm not finding no help using google with the following issues ,can somebody help pls :
1 - how can i define a size for every columns using percentages , meaning i.e first columns 10% of the width second 50% ,third 40% .2 - how can i disable when double clicking on a row the edit . i mean when i double click on a row it is possible to change the value of the clicked column in a specified row .
3 - if possible that when on doubleclick to highlight the whole row not only the column .
4 - make the columns resizable , meaning can be resized with the mouse dragging them .
thank you -
-
Did you look at the setDefaultSectionSize(...). With this you need to do your math to set appropriate size.
-
Did you look at setSectionResizeMode(...) ?
-
2 and 3 are confused slightly. However you can do this with handling MouseHandling on your view
-
-
!http://i57.tinypic.com/fu1gkp.png(example)!
in this picture 1(in red) shows what i talked about in 2 above .
2(in red) what i mean by highlighting the whole row .[quote author="Dheerendra" date="1410196137"]1. Did you look at the setDefaultSectionSize(...). With this you need to do your math to set appropriate size.
[/quote]
it didn't work , and it only takes one argument , how can i specify for each column a size . -
Hi all , im still looking for an answer , if it helps it doesn't have to be a tableview , i just need to list rows and flixible columns .