Results 1 to 1 of 1

Thread: Qt designer crashes with custom plugin [SOLVED]

  1. #1
    Join Date
    Nov 2010
    Posts
    47
    Thanks
    7
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Qt designer crashes with custom plugin [SOLVED]

    Created custom designer plugin similar to Container Extension Example. After some modifications with QDesignerCustomWidgetInterface, QDesignerContainerExtension and QExtensionFactory classes and adding following methods to my container:
    Qt Code:
    1. Q_OBJECT
    2. Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex)
    3. Q_PROPERTY(QString pageTitle READ pageTitle WRITE setPageTitle STORED false)
    4.  
    5. public:
    6. WidgetBox(QWidget *parent = 0);
    7.  
    8. int count() const { return mTreeWidget->topLevelItemCount(); }
    9. QWidget* widget(int index) const;
    10. QString pageTitle() const;
    11.  
    12. public slots:
    13. void setCurrentIndex(int index);
    14.  
    15. void addPage(QWidget *widget);
    16. void insertPage(int index, QWidget *widget);
    17. void removePage(int index);
    18. int currentIndex() const { return mTreeWidget->currentIndex().row(); }
    19.  
    20. void setPageTitle(QString const &newTitle);
    21.  
    22.  
    23. protected:
    24. QTreeWidgetItem * addCategory(QString pageName);
    25. QTreeWidgetItem * insertCategory(int index, QString pageName);
    26.  
    27. PageButton *categoryButton(int index) const;
    28.  
    29. void createContainerWidget(QTreeWidgetItem* page, QWidget *widget);
    30. void createCategoryButton(QTreeWidgetItem* page, QString pageName);
    31.  
    32. signals:
    33. void currentIndexChanged(int index);
    34. void pageTitleChanged(const QString &title);
    To copy to clipboard, switch view to plain text mode 
    Qt designer started to crash on start with my plugin. Any way do debug plugin (extension) and found the cause? Plugin build in release mode with same Qt and VS C++ versions as Qt Designer and Creator - Based on Qt 5.5.1 (MSVC 2013, 32 bit).



    Partial solution added after 18 minutes:


    So method is following: commented out extension and factory classes - still crashes, sequentaly commented/uncommented methods in my widget class: problem appears in
    Qt Code:
    1. Q_PROPERTY(QString pageTitle READ pageTitle WRITE setPageTitle STORED false)
    To copy to clipboard, switch view to plain text mode 
    and methods pageTitle and setPageTitle for current page when no pages available. Need think what to set/output here when no pages were added. Or add at least 1 page by default.

    Now Qt Designer crashes on adding widget to a form. Will continue searching the cause.


    Added after 51 minutes:


    Added index check to widget() method as well, works fine for now.
    Last edited by AlekseyK; 13th March 2016 at 15:12.

Similar Threads

  1. Replies: 1
    Last Post: 19th January 2011, 23:01
  2. Program crashes when connecting custom signal.
    By hersheyzombie in forum Qt Programming
    Replies: 5
    Last Post: 4th September 2010, 11:00
  3. Designer plugin crashes when opening *.ui
    By dimm0n in forum Qt Tools
    Replies: 2
    Last Post: 12th April 2010, 07:40
  4. Designer crashes with any plugin added
    By newqtuser in forum Qt Tools
    Replies: 2
    Last Post: 25th November 2008, 14:39
  5. plugin crashes designer but not app
    By jayw710 in forum Qt Tools
    Replies: 1
    Last Post: 27th June 2007, 19:37

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.