Hello,
In QTableWidget is a method "editItem", however it does not return the created editor (quite contrary in Qt3 AFAIR). How to get the pointer to this editor?
have a nice day
bye
Hello,
In QTableWidget is a method "editItem", however it does not return the created editor (quite contrary in Qt3 AFAIR). How to get the pointer to this editor?
have a nice day
bye
You cannot obtain it from a QTableWidget.
Use a QTableView instead and create the editor with the default item delegate, using:
QAbstractItemView::itemDelegate and QAbstractItemDelegate::createEditor.
The latter will also return a pointer to the editor.
Regards
Marcel, thank you for your answer.
This method is available in QTableWidget too.
I use my own delegate already, but if I call directly createEditor I maybe miss some internals of editItem, I don't know.
Is there is a guarantee, that
editItem() is 100% equivalent of itemDelegate()->createEditor() ?
I read and I read Qt documentation but I cannot find any way to connect somehow table with editor (so table will know about the editor) or editor with table.
The same problem as for editItem I have with openPersistentEditor -- vide my other post here:
http://www.qtcentre.org/forum/f-qt-p...them-7653.html
have a nice day, bye
It is not identical. You will still have to call editItem to start editing. But you will also have a pointer to the editor.Is there is a guarantee, that
editItem() is 100% equivalent of itemDelegate()->createEditor() ?
To see how the default editor is created you can look in the sources and create it like just they do.
Regards
I hesitate to use such code -- porting really tiny app from Qt3 to Qt4 is an ordeal (imho) and it is still not finished. I am afraid that by using such "hacks" as duplicating Qt source I am at even greater risk when I will port app from Qt4 to Qt5. So what I need is a "legit" way to get the table<->editor connection.
But don't get me wrong -- I appreciate your help! Thank you.
have a nice day, bye
PS. I think I will manage to do it manually -- after creating a delegate in table I can add some method to set which table it is, so delegate will know about table. So when createEditor is called I could pass an extra parameter for this editor, or notify table about the editor.
Ugly, but since there is no nice method in Qt....
Last edited by macias; 22nd June 2007 at 22:09.
Have it your way, but this is not a hack since it uses the interface provided by Qt.I hesitate to use such code -- porting really tiny app from Qt3 to Qt4 is an ordeal (imho) and it is still not finished. I am afraid that by using such "hacks" as duplicating Qt source I am at even greater risk when I will port app from Qt4 to Qt5. So what I need is a "legit" way to get the table<->editor connection.
I suggested to create the editor as in the Qt sources because you needed something like the default editor.
So, the bottom line is that this is not a hack. It just means you adapt to the new changes, even if it means making more and unexpected modifications.
Regards
This is a hack.PS. I think I will manage to do it manually -- after creating a delegate in table I can add some method to set which table it is, so delegate will know about table. So when createEditor is called I could pass an extra parameter for this editor, or notify table about the editor.
Ugly, but since there is no nice method in Qt....
Bookmarks