There's the Star Delegate and the Spinbox Delegate examples in the Item View examples, those were pretty easy to understand.
Thanks wysota,
But i still have some doubts like should i create a new class to handle QTableWidgetItem and then create a delegate(create_editor???) through which we can customize our cell or should i just create a create_editor( ) of type QWidget and use it in setcellWidget(i, j, QWidget) in the current QTableWidget class???? I am confused, what to do??
And i know its kind of hard to understand what i am trying to say here, if u want, then i can upload the code here, i have the whole flow going but i just need to add a QTextedit and QComboBox in each cell when clicked.... please help me out![]()
Thanks!!!
Read about QAbstractItemDelegate and its descendants.
danish.ahmed (24th September 2010)
Hey guys,
Even i'm stuck with the same kinda problem, i have one question, i also want to customize the cell of a Tablewidget, i have tried all the things but m nt able to go one step further, just wanted to know for customizing my cells in tablewidget which is working fine, do i need to create a new class for handling items and customize them. And right now m using tablewidgetname->item(i,j)->setText(variable) to insert value in the tablewidget. if i m going to built a new class of type QTableWidgetItem, which handles each item, what do i do in constructor of dis class?? n how do i customize it. i have seen each and every example but m not getting any further. can nyone explain, what should b done and how.....
N sorry for bad english.....![]()
Please edit your post and write it in simpler, shorter sentences with more or less proper English grammar without skipping characters from words. Right now I can't understand what you want. If you don't respect people here and don't care about checking what you have written, how can you expect someone to devote his time to help you?
Hi,
In simple words, i just wanted to know that, if i need to implement this functionality of adding a linedit and combobox in a cell of a tablewidget.
1. Do i need to change the way i was initializing the tablewidgetitems, or should i just create a new Delegate class???
2. Does a delegate class plays any role in intializing the table items???
3. If it does plays a role in intializing tableitems then, how could i implement this functionality???
Help me, I m really a Newbie To QT.
Thanks!!!
Hi,
In case we are creating a new class which inherits QItemDelegate class, then How can we maintain the QModelIndex and other options if we are using QTableWidget for displaying our data. And What is this qVariantfromValue( ), i mean what does it do???
If the goal is to use the model in more than one view, then do not use a QTableWidget but a QTableView. The model always maintains the indexes. The view might keep a list of indexes to store view specific parameters (like expanded items), but if the view wants to change an item, it needs to tell the model about it.
The description of qVariantFromValue:
http://doc.qt.nokia.com/4.7/qvariant...riantFromValue
Hi,
Thanks for replying,
I have few questions to ask about Delegates....
Earlier i was populating my tablewidget using SetItem(i, j, newItem) and Now(using Delegates) Do i need to Change the way i was populating my tablewidget???
if so, then how???
In createEditor function i have dynamically created a custom widget in which i have added one LineEdit and ComboBox in a widget, but when executing it..... the LineEdit and ComboBox size is too small.....
Thanks!!!!!!
Hi,
I am still not getting the proper size of a custom widget in a cell. Its small and when i click to edit that cell, the background value is shown in the parent widget here is a screenshot of a single widget..widget.jpg Can anyone help me??
How can i resize it, so that i will fit properly in a cell....
Thanks!!!!!
Last edited by prin; 19th October 2010 at 11:51.
Hey, Thanks all for replying to some of my threads...... My problem is solved......![]()
Bookmarks