Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't add more than one string in QtCore.QStringList #79

Open
dsoronda opened this issue Jun 6, 2018 · 1 comment
Open

Can't add more than one string in QtCore.QStringList #79

dsoronda opened this issue Jun 6, 2018 · 1 comment

Comments

@dsoronda
Copy link

dsoronda commented Jun 6, 2018

I'm trying to add more strings in QtCore.QStringList but constructor only allows one string as parameter.

We need this implementation:

QtCore.QStringList( IEnumerable<string> stringList);

// and then use it like
// new QtCore.QStringList( new string[] { "text1", "text2"} );

Problem is when I try to generate ie. QTreeWidget:

var tree = new QTreeWidget();
var headers = new QtCore.QStringList( new string[] { "text1", "text2" } );

tree.ColumnCount = 2;
tree.SetHeaderLabels( headers );

This is example I found for Qt

QStringList headerLabels;
headerLabels.push_back(tr("text1"));
headerLabels.push_back(tr("text2"));
headerLabels.push_back(tr("text3"));

headerLabels.push_back(tr("textN"));

treeWidget->setColumnCount(headerLabels.count());
treeWidget->setHeaderLabels(headerLabels);

Current workaround

var tree = new QTreeWidget();

tree.ColumnCount = 2;
var name = new QtCore.QStringList( "name" );
tree.SetHeaderLabels( name );
tree.HeaderItem.SetText( 1, "description" );
@ddobrev
Copy link
Owner

ddobrev commented Jun 8, 2018

This constructor requires support for templates which is not complete yet. I'll let you know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants