Re: Problem in Cut Operation
I think you should use a model-view approach here.
Quote:
Originally Posted by ankurjain
this way i am able to get the delegates on dblclik of the cell.
This is not good. The delegate should be set upon creation of the view and not on double click. The double click should trigger edit mode, which in turn should ask the delegate to provide an editor for the cell. You shouldn't mess with the delegates this way.
Quote:
so how can i show the border across the cell ?
In what way should it be "across"? You mean you want to have a rectangle containing many cells selected? If you use the model-view approach this should be done automatically.
Quote:
how can i activate the delegate on keyboard keys. for instance if my cell is selected, pressing any key (alphanumeric) must trigger the edit mode and thus the corresponding delegate for the cell. same must be the operation of F2 key.
You don't "activate" the delegate. The view asks the delegate to do some things... You should only trigger appropriate actions on the view (like update() and edit()).
In your case I think you need to set edit triggers (QAbstractItemView::setEditTriggers()) to QAbstractItemView::DoubleClicked|QAbstractItemView ::EditKeyPressed.
Re: Problem in Cut Operation
hi wysota,
thanks for ur reply ...
but since i was put in a team in which design and work was already going on. and this table was constructed using QTableWidget instead of using Model/View Architecture.
Code:
In what way should it be "across"?
I actually want the border around the cell :) ( sry for bad english ) or if a row is selected the border ( rectangle ) around the row.
Code:
This is not good. The delegate should be set upon creation of the view and not on double click. The double click should trigger edit mode, which in turn should ask the delegate to provide an editor for the cell. You shouldn't mess with the delegates this way.
i am calling the editor in the delegate. as one requirement was like that, bigger editor window on dbl clking the cell.
Just For My Knowledge
Can i edit data also and update it in Model/View architecuture ??
Also deadline is close for 1st release, so i can't change the design right now.
So please help out ....
Re: Problem in Cut Operation
Quote:
Originally Posted by ankurjain
but since i was put in a team in which design and work was already going on. and this table was constructed using QTableWidget instead of using Model/View Architecture.
It doesn't mean the team can't change its decisions, right? You'll experience lots of problems with the itembased approach. The model-view architecture handles some aspects of the application on its own. Without it, you'll have much more coding to do.
Quote:
I actually want the border around the cell :) ( sry for bad english ) or if a row is selected the border ( rectangle ) around the row.
And the problem is...? Drawing the selection is the views and delegates responsibility. You have a selection model associated with the view and you can act depending on its contents.
Quote:
i am calling the editor in the delegate. as one requirement was like that, bigger editor window on dbl clking the cell.
I don't quite understand... You want to have two different kinds of editors? That surely doesn't require changing the delegate upon a click on the cell.
Quote:
Can i edit data also and update it in Model/View architecuture ??
Of course you can.
Quote:
Also deadline is close for 1st release, so i can't change the design right now.
It's not that much more work as you think. And you'll probably save some time later. It's better to correct misdesigns earlier, because the consequences of such misdesigned won't require as many changes to the application as when you want to correct them on a later stage.
Re: Problem in Cut Operation
ok,
right now i m working towards alpha release ( 1 day more to go, hiw can i cahnge the design rite now) , after this release i will try to change the design again and communicate to team and integrate with their code.
if some problem there i will again post here.
Thanx 4 guidance.