Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Clarification on removeColum function from QStandardItemModel

    General and Desktop
    3
    6
    932
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      amonR last edited by

      Hi,
      I'm using QStandardItemModel and I would like to delete a column through removeColumn() function.
      I know the function takes two arguments, however I don't know how to include the seconde. Here is an example of how I use it:
      @
      model = new QStandardItemModel;
      QStandardItem item1 = new QStandardItem(tr("BMW"));
      model->appendColumn(QList<QStandardItem
      >() << item1);

      if(model->item(0,2)!=0)
      {
      model->removeColumn(0);
      }
      @
      As you can see I put just one argument in the function. Although the compiler does not complain, will it work properly that way? if not, how am I supposed to write (or use) it please?

      1 Reply Last reply Reply Quote 0
      • guidupas
        guidupas last edited by

        As we can see "here":http://qt-project.org/doc/qt-4.8/qabstractitemmodel.html#removeColumn , you just need to inform which column you want to remove.

        Att.
        Guilherme Cortada Dupas

        1 Reply Last reply Reply Quote 0
        • A
          amonR last edited by

          Hi, I have already seen this doc and sorry but it does not answer my questions.

          1 Reply Last reply Reply Quote 0
          • SGaist
            SGaist Lifetime Qt Champion last edited by

            Hi,

            This is basic c++, if you re-read the function signature you'll see that the second parameter has a default value if you don't give it.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply Reply Quote 0
            • A
              amonR last edited by

              Hi, but will it behave properly even if the default value is given? And sorry how am I supposed to know that the second parameter has a default value if I don't give it?

              1 Reply Last reply Reply Quote 0
              • SGaist
                SGaist Lifetime Qt Champion last edited by

                It's documented "here":http://qt-project.org/doc/qt-5/qabstractitemmodel.html#removeColumn

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post