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. [solved] QAbstractItemView::rowsInserted() seems to have a problem...
Forum Updated to NodeBB v4.3 + New Features

[solved] QAbstractItemView::rowsInserted() seems to have a problem...

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 1.6k Views 1 Watching
  • 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.
  • jerome_isAviableJ Offline
    jerome_isAviableJ Offline
    jerome_isAviable
    wrote on last edited by
    #1

    I try to use it for a QTreeView (i use also a QAbstractItemView::dataChanged() who works fine...), nut i have some errors point on my .h file at declaration time:
    errors list on this declarration line:
    stray '/342' in program
    stray '/200' in program
    stray '/213' in program

    part of classeurs_treeview.h code:
    @
    class Classeurs_treeView : public QTreeView
    {
    Q_OBJECT
    ....

    protected slots:
    void mouseReleaseEvent ( QMouseEvent * event );
    void dataChanged (const QModelIndex &topLeft,
    const QModelIndex &bottomRight,
    const QVector<int> &roles = QVector<int> ());
    void ​rowsInserted(const QModelIndex &parent, // here is the error... (i just follow the doc)
    int start, int end);
    ...
    @

    part of my defined classeurs_treeview.cpp file

    @
    void Classeurs_treeView::​rowsInserted(const QModelIndex &parent,
    int start, int end) {
    emit add_classeur(parent, start, end);
    }
    @

    the signal is catch by a inherited edit_project class, who inherit a new_project QDialog class
    the new_project class not catch the signal and no have the slot declared, the slot is only in the edit_project class...

    the edit_project.cpp part of declared signal inside his constructor:
    @
    edit_project::edit_project(QWidget *parent, const int &id_project) {
    user->initdb();
    Project.id = id_project;
    populate_entries();
    ui_new_project->pushButton_add_comment_dir->setText("Editer le comentaire");
    QObject::connect(ui_new_project->treeView_classeur,
    SIGNAL(add_classeur(QModelIndex, int, int)),
    this,
    SLOT(on_treeView_classeur_add_classeur(const QModelIndex &parent,
    int start, int end)));
    }
    @

    the edit_project.ccp part where the slot is define:
    @

    void edit_project::on_treeView_classeur_add_classeur(const QModelIndex &parent,
    int start, int end) {
    for (int i(start); i <= end; i++) {
    int id_tree = classeurs_model->index(i, 2, parent).data().toInt();
    int id_tree_parent = classeurs_model->index(i, 3, parent).data().toInt();
    QString nom = classeurs_model->index(i, 0, parent).data().toString();
    QString comment = classeurs_model->index(i, 1, parent).data().toString();
    QList<QVariant> datas;
    datas << id_tree_parent << nom << comment;
    Modified.classeurs_add.insert(id_tree, datas);
    }
    }
    @

    the edit_project.h part of file where slot is declared:
    @

    protected slots:
    virtual void on_pushButton_OK_clicked() override ;
    virtual void on_treeView_classeur_change_data(const QModelIndex &topLeft,
    const QModelIndex &bottomRight,
    const QVector<int> &roles) override;
    virtual void on_treeView_classeur_delete_classeur(QModelIndexList list_indexs) override;
    void on_treeView_classeur_add_classeur(const QModelIndex &parent,
    int start, int end);
    @

    i don't know..; maybe the error come from the fact that this slot is not declared inisde the new_project files/class. Maybe i need to catch the signal here and override the slot function ?
    Someone has an idea ?

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      you probably have some 'hidden' Unicode characters somewhere in your source files. Make sure they are ASCII only (except in string literals of course).

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andre
        wrote on last edited by
        #3

        I guess you copy/pasted from the docs. Unfortunately, there are some unicode characters in there that don't go down nicely with compilers. That is unfortunate, but it does mean that the savest way is to just type your code yourself instead of using copy/paste.

        1 Reply Last reply
        0
        • jerome_isAviableJ Offline
          jerome_isAviableJ Offline
          jerome_isAviable
          wrote on last edited by
          #4

          that's right, this was exactly the problem.
          thanks raven-workx and Andre
          i do this post solved

          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