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

Feature #1226: Request UniversalId editing from table column

Post by Jiub »

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 ?
User avatar
cc9cii
Posts: 523
Joined: 28 Mar 2013, 04:01

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

Post by cc9cii »

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: 5538
Joined: 06 Aug 2011, 15:16

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

Post by Zini »

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

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

Post by Jiub »

Zini wrote:and the content of the cell (string)
That's the string I put in hint like "c:cell_content", yep?
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

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

Post by Zini »

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

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

Post by Jiub »

Done!
Post Reply