Skip to content

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

Description

@dsoronda

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" );

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions