Feature #1226: Request UniversalId editing from table column

Involved development of the OpenMW construction set.
Post Reply
User avatar
Jiub
Posts: 26
Joined: 02 Aug 2014, 09:29
Location: Russia
Contact:

Feature #1226: Request UniversalId editing from table column

Post by Jiub » 14 Sep 2014, 10:41

Need some OCS architect-expert help on feature. Right now I'm in a mess.

So far I figured out, that I need to emit editRequest signal with CSMWorld::UniversalId and a hint. Am I supposed to make up a mapping for CSMWorld::UniversalId types with corresponding column display roles CSMWorld::ColumnBase::Display. Or am I wrong?

Right now I'm retrieving column roles with:

Code: Select all

int colRole = mModel->headerData( columnAt(event->x()), Qt::Horizontal, CSMWorld::ColumnBase::Role_Display ).toInt();
And how to get column id for use in CSMWorld::UniversalId ?
npunJIblJIu

User avatar
cc9cii
Posts: 434
Joined: 28 Mar 2013, 04:01

Re: Feature #1226: Request UniversalId editing from table co

Post by cc9cii » 14 Sep 2014, 10:55

I'm no exert at all, but does this help?

Code: Select all

std::vector<std::string> refIdColumns = mTable->getColumnsWithDisplay(CSMWorld::TableMimeData::convertEnums(CSMWorld::UniversalId::Type_Referenceable));
bool hasRefIdDisplay = !refIdColumns.empty();
I know it is not answering your question directly, but it might give you a starting point.

User avatar
Zini
Posts: 5134
Joined: 06 Aug 2011, 15:16

Re: Feature #1226: Request UniversalId editing from table co

Post by Zini » 14 Sep 2014, 11:19

Am I supposed to make up a mapping for CSMWorld::UniversalId types with corresponding column display roles CSMWorld::ColumnBase::Display. Or am I wrong?
Partially. You should not create your own mapping, because one already exists. Ended up as a static function in TableMimeData (which is weird, but anyway):

Code: Select all

static CSMWorld::UniversalId::Type convertEnums(CSMWorld::ColumnBase::Display type);
And how to get column id for use in CSMWorld::UniversalId ?
You do not need the column id. Just the UniversalId, which you can generate from the type (see above) and the content of the cell (string).

User avatar
Jiub
Posts: 26
Joined: 02 Aug 2014, 09:29
Location: Russia
Contact:

Re: Feature #1226: Request UniversalId editing from table co

Post by Jiub » 14 Sep 2014, 12:39

Zini wrote:and the content of the cell (string)
That's the string I put in hint like "c:cell_content", yep?
npunJIblJIu

User avatar
Zini
Posts: 5134
Joined: 06 Aug 2011, 15:16

Re: Feature #1226: Request UniversalId editing from table co

Post by Zini » 14 Sep 2014, 13:22

No. the UniversalID. The hint system is only used in a few places to give additional information about the initial state of the subview. I don't think you need it anywhere when implementing this feature.

User avatar
Jiub
Posts: 26
Joined: 02 Aug 2014, 09:29
Location: Russia
Contact:

Re: Feature #1226: Request UniversalId editing from table co

Post by Jiub » 15 Sep 2014, 19:21

Done!
npunJIblJIu

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests