Dialogue Sub-Views

Involved development of the OpenMW construction set.
Post Reply
User avatar
sirherrbatka
Posts: 2159
Joined: 07 Aug 2011, 17:21

Dialogue Sub-Views

Post by sirherrbatka »

i am working on this task right, and as usual I require a bit of support.

First i want to renable zinis code. But how do i add the new subview? Clearly i need to use signal from the table and pass it through the tablesubview to the view. But where to connect? The only place that seems to make sense seems to be the moment of creation of the subview. Is that correct aproach?
User avatar
sirherrbatka
Posts: 2159
Joined: 07 Aug 2011, 17:21

Re: Dialogue Sub-Views

Post by sirherrbatka »

oh well, i just did this. Zinis code is enabled, i will try to work on that.
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Dialogue Sub-Views

Post by Zini »

Sorry for the late reply. Was kinda busy.

You add new subviews by registering a suitable sub view factory in apps/opencs/view/world/subviews.cpp. Everything else is already taken care of.

Also, careful with my branch. I ran into a dead end there. You might be able to make it work, but I wouldn't bet on it.
User avatar
sirherrbatka
Posts: 2159
Joined: 07 Aug 2011, 17:21

Re: Dialogue Sub-Views

Post by sirherrbatka »

You add new subviews by registering a suitable sub view factory in apps/opencs/view/world/subviews.cpp. Everything else is already taken care of.
hmmm, i didn't knew that, so i did this manually. I will leave this for now.
Also, careful with my branch. I ran into a dead end there. You might be able to make it work, but I wouldn't bet on it.
Well, i think that i will be able to find some kind of solution.
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Dialogue Sub-Views

Post by Zini »

hmmm, i didn't knew that, so i did this manually. I will leave this for now.
Not a good idea, because that will inevitably break things. There are multiple sources for view request for sub views. And they all go through the established system. If you use your own method, you will miss some of these.
Well, i think that i will be able to find some kind of solution.
Looking forward to that. I am very interested in what you can come up with here.
User avatar
sirherrbatka
Posts: 2159
Joined: 07 Aug 2011, 17:21

Re: Dialogue Sub-Views

Post by sirherrbatka »

sorry for disapointment but as it seems my understandig of the problem is insufficiant, or even completly wrong.

Code: Select all

QVariant CSMWorld::IdTable::data  (const QModelIndex & index, int role) const
{
    if (role!=Qt::DisplayRole && role!=Qt::EditRole)
        return QVariant();

    if (role==Qt::EditRole && !mIdCollection->getColumn (index.column()).isEditable())
        return QVariant();

    return mIdCollection->getData (index.row(), index.column());
}
As i found, out, the data function returns the empty variant for the non editable fields. Why is that? How table itself is able to retrive the information?
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Dialogue Sub-Views

Post by Zini »

This is just for editing (Qt:EditRole). For display purpose (Qt::DisplayRole) you get the value of the cell just fine.
User avatar
sirherrbatka
Posts: 2159
Joined: 07 Aug 2011, 17:21

Re: Dialogue Sub-Views

Post by sirherrbatka »

ok, i have no idea how to register the new subview.

manager.add (CSMWorld::UniversalId::Type_Dialog, new CSVDoc::SubViewFactory<DialogueSubView>);

this is clearly wrong (yes, i added the new type). I dont know how this thing works so help is welcome.
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Dialogue Sub-Views

Post by Zini »

That is exactly how it should work, except that you are not supposed to make a new type. The types for individual records already exist.
User avatar
sirherrbatka
Posts: 2159
Joined: 07 Aug 2011, 17:21

Re: Dialogue Sub-Views

Post by sirherrbatka »

manager.add (CSMWorld::UniversalId::Type_Cells, new CSVDoc::SubViewFactory<DialogueSubView>);

Like this? This won't work because

assert (mSubViewFactories.find (id)==mSubViewFactories.end());

fails.

I'm runing in circles right now. Frustraiting.
Post Reply