Uploaded image for project: 'Qt Solutions'
  1. Qt Solutions
  2. QTSOLBUG-156

QtTreePropertyBrowser/QTreeWidget Crash

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • Some Release
    • Property Editor
    • None
    • Windows 7 64bit

    Description

      The following sample code causes a crash with a invalid index in QTreeView. Haven't been able to track down why. I'm not sure if it's a propblem in QtTreePropertyBrowser or QTreeView.

      Sample Code
      #include <QtGui>
      
      #include "qtpropertymanager.h"
      #include "qteditorfactory.h"
      #include "qttreepropertybrowser.h"
      #include "qtbuttonpropertybrowser.h"
      #include "qtgroupboxpropertybrowser.h"
      
      
      int main(int argc, char *argv[])
      {
          QApplication app(argc, argv);
      
          QWidget *w = new QWidget();
      
          QtBoolPropertyManager *boolManager = new QtBoolPropertyManager(w);
          QtStringPropertyManager *stringManager = new QtStringPropertyManager(w);
          QtGroupPropertyManager *groupManager = new QtGroupPropertyManager(w);
      
          QtProperty *item0 = groupManager->addProperty("QObject");
      
          QtProperty *item1 = stringManager->addProperty("objectName");
          item0->addSubProperty(item1);
      
          QtProperty *item2 = boolManager->addProperty("enabled");
          item0->addSubProperty(item2);
      
          QtCheckBoxFactory *checkBoxFactory = new QtCheckBoxFactory(w);
          QtLineEditFactory *lineEditFactory = new QtLineEditFactory(w);
          
          QtTreePropertyBrowser *editor1 = new QtTreePropertyBrowser();
          editor1->setFactoryForManager(boolManager, checkBoxFactory);
          editor1->setFactoryForManager(stringManager, lineEditFactory);
          editor1->setResizeMode(QtTreePropertyBrowser::ResizeToContents);
      
          QVBoxLayout *layout = new QVBoxLayout();
          layout->addWidget(editor1);
          w->setLayout(layout);
          
          editor1->addProperty(item0);
      
          QListIterator<QtBrowserItem *> itItem(editor1->items(item1));
          while (itItem.hasNext())
          {
              QtBrowserItem *item = itItem.next();
      
              editor1->setItemVisible(item, false);
          }
      
          itItem = editor1->items(item2);
          while (itItem.hasNext())
          {
              QtBrowserItem *item = itItem.next();
      
              editor1->setItemVisible(item, false);
          }
          
          w->show();
      
          app.exec();
          return 0;
      }
      
      
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            andysh Andy Shaw
            steno Jon Mullen
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes