Results 1 to 4 of 4

Thread: [Qt4 WinXP] Designer widget QTreeView problem

  1. #1
    Join Date
    Apr 2006
    Location
    San Francisco, CA
    Posts
    186
    Thanks
    55
    Thanked 12 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default [Qt4 WinXP] Designer widget QTreeView problem

    Hi, I'm trying to create a custom designer widget that derives from QTreeView, for QtDesigner. However, I'm getting the attached error messages whenever I try to drag it onto, and access it within, the QtDesigner. (I didn't know VS2005 was written using .NET) Has anyone run across this before?

    My widget class is very bare bones - all it really does is publicly inherit QTreeView. I can post it if needed.

    (edit: apologies about the attachment - failed to realize they had failed to post previously because of the 800x600 size limitation)
    Attached Images Attached Images
    Last edited by gfunk; 4th May 2006 at 22:41.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 975 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: [Qt4 WinXP] Designer widget QTreeView problem

    Where are those errors?

  3. #3
    Join Date
    Apr 2006
    Location
    San Francisco, CA
    Posts
    186
    Thanks
    55
    Thanked 12 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: [Qt4 WinXP] Designer widget QTreeView problem

    I tried adding an iconSize() and setIconSize() member to my class, but it didn't seem to have an effect. This doesn't seem to be an overridable method anyway, and should have been defined in the QAbstractItemView class, so I don't know why it's complaining there...

    I've tried inheriting a different class as well - seems to also crash in the same way with QListView, but works okay if it inherits QPushButton.

    Here's the header file fwcartview.h
    Qt Code:
    1. #ifndef FWCARTVIEW_H
    2. #define FWCARTVIEW_H
    3. #include <QObject>
    4. #include <QTreeView>
    5. #include <QtDesigner/QDesignerExportWidget>
    6. class QDESIGNER_WIDGET_EXPORT FwCartView : public QTreeView
    7. {
    8. Q_OBJECT
    9. public:
    10. FwCartView(QWidget *parent = 0);
    11. ~FwCartView();
    12. };
    13. #endif
    To copy to clipboard, switch view to plain text mode 

    Here's the plugin cpp file fwcartviewplugin.cpp
    Qt Code:
    1. #include "FwCartView.h"
    2. #include "FwCartViewplugin.h"
    3. #include <QtPlugin>
    4. FwCartViewPlugin::FwCartViewPlugin(QObject *parent)
    5. : QObject(parent) {
    6. initialized = false;
    7. }
    8. void FwCartViewPlugin::initialize(QDesignerFormEditorInterface *formEditor) {
    9. if (initialized) {
    10. return;
    11. }
    12. initialized = true;
    13. }
    14. bool FwCartViewPlugin::isInitialized() const {
    15. return initialized;
    16. }
    17.  
    18. QWidget *FwCartViewPlugin::createWidget(QWidget *parent) {
    19. return new FwCartView(parent);
    20. }
    21. QString FwCartViewPlugin::name() const {
    22. return "FwCartView";
    23. }
    24. QString FwCartViewPlugin::group() const {
    25. return "Leapfrog Widgets";
    26. }
    27.  
    28. QIcon FwCartViewPlugin::icon() const {
    29. return QIcon();
    30. }
    31.  
    32. QString FwCartViewPlugin::toolTip() const {
    33. return "FwCartView";
    34. }
    35. QString FwCartViewPlugin::whatsThis() const {
    36. return "Custom cartridge view widget";
    37. }
    38.  
    39. bool FwCartViewPlugin::isContainer() const {
    40. return false;
    41. }
    42.  
    43. QString FwCartViewPlugin::includeFile() const {
    44. return "FwCartView.h";
    45. }
    46.  
    47. QString FwCartViewPlugin::domXml() const {
    48. return "<widget class=\"FwCartView\" name=\"fwCartView\">\n"
    49. " <property name=\"geometry\">\n"
    50. " <rect>\n"
    51. " <x>0</x>\n"
    52. " <y>0</y>\n"
    53. " <width>100</width>\n"
    54. " <height>25</height>\n"
    55. " </rect>\n"
    56. " </property>\n"
    57. " <property name=\"toolTip\" >\n"
    58. " <string>FwCartView</string>\n"
    59. " </property>\n"
    60. " <property name=\"whatsThis\" >\n"
    61. " <string>Custom cartridge view to be used for "
    62. "each page to be shown in the content pane</string>\n"
    63. " </property>\n"
    64. "</widget>\n";
    65. }
    66. QString FwCartViewPlugin::codeTemplate() const {
    67. return "";
    68. }
    69. Q_EXPORT_PLUGIN2(fwcartviewplugin, FwCartViewPlugin)
    To copy to clipboard, switch view to plain text mode 

    Here's fwcartview.cpp:
    Qt Code:
    1. #include "FwCartView.h"
    2. #include <QPainter>
    3.  
    4. FwCartView::FwCartView(QWidget *parent)
    5. : QTreeView(parent)
    6. :QPushButton(parent)
    7. {
    8. setAttribute(Qt::WA_DeleteOnClose, true);
    9. }
    10. FwCartView::~FwCartView()
    11. {
    12. }
    To copy to clipboard, switch view to plain text mode 

    On a somewhat related note, Is there any way to debug designer widgets within QtDesigner? Since they have to be compiled in release mode, I guess the only way is to use qDebug() and look at the output or use QMessageBox's. Seems rather painful, as VS2005 has to be restarted and the plugin dll copied over to the plugin folder, everytime a change is made. Though I guess the widget can be debugged once the app is running, as it can link in the debug version of the designer widget dll...
    Last edited by gfunk; 5th May 2006 at 01:41.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: [Qt4 WinXP] Designer widget QTreeView problem

    What if you test the plugin against a standalone (without MSVS integration) Designer?

Similar Threads

  1. Tricky problem with ARGB widget / UpdateLayeredWindow
    By nooky59 in forum Qt Programming
    Replies: 3
    Last Post: 21st February 2008, 11:35
  2. [QT4 & XP] QTreeView issue with Designer form
    By incapacitant in forum Newbie
    Replies: 3
    Last Post: 2nd March 2006, 18:42

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.