Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Clarification on removeColum function from QStandardItemModel

Clarification on removeColum function from QStandardItemModel

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 1.3k Views
  • 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 Offline
    A Offline
    amonR
    wrote on last edited by
    #1

    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
    0
    • guidupasG Offline
      guidupasG Offline
      guidupas
      wrote on last edited by
      #2

      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
      0
      • A Offline
        A Offline
        amonR
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          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
          0
          • A Offline
            A Offline
            amonR
            wrote on last edited by
            #5

            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
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              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
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved