Results 1 to 9 of 9

Thread: Correct Member Sheet Extension Implementation

  1. #1
    Join Date
    Jul 2009
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Question Correct Member Sheet Extension Implementation

    I'm using Qt 4.5.2 and Qt 4 Visual Studio Add-In.

    I've created a custom widget plugin for Qt Designer with Visual Studio's Qt Plugin template.
    The widget itself shows up in Qt Designer and works correctly if I compile a Qt Application Project which includes the plugin.

    Additionally, the widget implements custom signals and slots.
    Since I would like to use Visual Studio's Qt Application template and Qt Designer, I want these signals and slots to show up in Qt Designer, so I don't have to add them manually in the generated code files.

    To achieve that, I've tried to implement my own Member Sheet Extension.
    The plugin actually compiles without any errors or warnings, but if I try to open the popup menus in the "signals and slots" window in Qt Designer, it crashes.
    Unfortunately, it doesn't give me any error messages or exceptions, it just shuts down.

    So, I guess my implementation of QDesignerMemberSheetExtension isn't correct or contains a bad method, but I don't have any clues what the problem is.
    So far, I couldn't find a correct example implementation either so I can't compare my code to a working plugin.

    I took the Task Menu Extension Example, QDesignerMemberSheetExtension and QExtensionFactory as reference.

    To implement the membersheet methods, I use QMetaObject and QMetaMethod:

    Qt Code:
    1. Qt4D3DCMemberSheetExtension::Qt4D3DCMemberSheetExtension(Qt4Direct3DContainer *p_d3dc, QObject *parent) : QObject(parent)
    2. {
    3. m_qt4D3DC = p_d3dc;
    4. m_qMetaObject = m_qt4D3DC->metaObject();
    5. }
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. bool Qt4D3DCMemberSheetExtension::isSignal( int index ) const
    2. {
    3. QMetaMethod method = m_qMetaObject->method(index);
    4. return method.methodType() == QMetaMethod::Signal;
    5. }
    To copy to clipboard, switch view to plain text mode 

    Is that a reasonable thing to do?

    I took the implementation of the QExtensionFactory code primarily from the Task Menu Extension Example:

    Qt Code:
    1. QObject * Qt4D3DCExtensionFactory::createExtension(QObject *object, const QString &iid, QObject *parent) const
    2. {
    3. if (iid != Q_TYPEID(QDesignerMemberSheetExtension))
    4. return 0;
    5.  
    6. if (Qt4Direct3DContainer *widget = qobject_cast<Qt4Direct3DContainer*>(object))
    7. {
    8. return new Qt4D3DCMemberSheetExtension(widget, parent);
    9. }
    10.  
    11. return NULL;
    12. }
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. void Qt4Direct3DContainerPlugin::initialize(QDesignerFormEditorInterface *formEditor)
    2. {
    3. if (initialized)
    4. return;
    5.  
    6. QExtensionManager *manager = formEditor->extensionManager();
    7. Q_ASSERT(manager != 0);
    8.  
    9. manager->registerExtensions(new Qt4D3DCExtensionFactory(manager), Q_TYPEID(QDesignerMemberSheetExtension));
    10.  
    11. initialized = true;
    12. }
    To copy to clipboard, switch view to plain text mode 

    Has anything gone wrong there?


    Is there any reasonable way of debugging a custom widget plugin?

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

    Default Re: Correct Member Sheet Extension Implementation

    No no no... that's a wrong way. All you need to do for a slot or signal to be available in designer for a custom widget is to declare them as such in the class and remember about placing the Q_OBJECT macro. The same goes for properties - use the Q_PROPERTY macro. You seldom need to touch the member sheet extension.

    Qt Code:
    1. class SomeWidget : public QWidget {
    2. Q_OBJECT
    3. Q_PROPERTY(int someProp READ getSomeProp WRITE setSomeProp)
    4. public:
    5. // ...
    6. public slots:
    7. void myCustomSlot() { ... }
    8. signals:
    9. void myCustomSignal(int);
    10. };
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jul 2009
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Correct Member Sheet Extension Implementation

    Quote Originally Posted by wysota View Post
    No no no... that's a wrong way. All you need to do for a slot or signal to be available in designer for a custom widget is to declare them as such in the class and remember about placing the Q_OBJECT macro. The same goes for properties - use the Q_PROPERTY macro. You seldom need to touch the member sheet extension.

    Qt Code:
    1. class SomeWidget : public QWidget {
    2. Q_OBJECT
    3. Q_PROPERTY(int someProp READ getSomeProp WRITE setSomeProp)
    4. public:
    5. // ...
    6. public slots:
    7. void myCustomSlot() { ... }
    8. signals:
    9. void myCustomSignal(int);
    10. };
    To copy to clipboard, switch view to plain text mode 
    That's what didn't work in the beginning, which is why I've tried the member sheet approach in the first place.

    These are the important parts of my widget header:

    Qt Code:
    1. class Qt4Direct3DContainer : public QWidget
    2. {
    3. Q_OBJECT
    4.  
    5. public:
    6. Qt4Direct3DContainer(QWidget *parent = 0);
    7. ~Qt4Direct3DContainer();
    8.  
    9. // ...
    10.  
    11. public slots:
    12.  
    13. void turn();
    14.  
    15. private:
    16.  
    17. // ...
    18.  
    19. };
    To copy to clipboard, switch view to plain text mode 

    I've had the Q_OBJECT macro in there all along, I also have one public slot.
    Now, if I compile that plugin and place the files in the plugins/designer folder, the widget appears in Qt Designer, but if I open the popup menu for slots, I only see the standard QWidget and QObject slots, not my custom slot.

    Have I overlooked something? What do I have to do to make my custom slot appear in Qt Designer?

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

    Default Re: Correct Member Sheet Extension Implementation

    It is hard to say. Try cleaning the project and rebuilding it from scratch. Also make sure your slot works from within Designer (try connecting to it from the plugin's QDesignerCustomWidgetInterface::createWidget() method. See if the connect succeeds or fails.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. The following user says thank you to wysota for this useful post:

    PeeAeMKAy (17th July 2009)

  6. #5
    Join Date
    Jul 2009
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Correct Member Sheet Extension Implementation

    Quote Originally Posted by wysota View Post
    It is hard to say. Try cleaning the project and rebuilding it from scratch.
    I did that, but it didn't seem to have any effect.

    Also make sure your slot works from within Designer (try connecting to it from the plugin's QDesignerCustomWidgetInterface::createWidget() method. See if the connect succeeds or fails.
    I'm not sure I know what you mean by that.
    The custom slot itself does work. If I code the signal/slot connection manually in the ui header file generated by Qt, it compiles and works properly. In the compiled application, I can press the button sending the signal, and my custom slot will be executed correctly.

    Qt Code:
    1. QObject::connect(actionCreate_Curve, SIGNAL(triggered()), qt4Direct3DContainer, SLOT(turn()));
    To copy to clipboard, switch view to plain text mode 

    This is the code I manually put into the generated ui header file. So it does work that way,
    it's just that I don't want to do that for every connection and every custom signal or slot I'm about to have.

    I actually found a way making my custom slot appear in Qt Designer. I don't like it though...
    Maybe most of you already know it, I'll still describe here, since it doesn't seem to be covered in the documentation yet.
    customslots.jpg
    As seen in the attached image,
    • I go into Signals and Slots Edit Mode,
    • connect my custom widget with anything, e.g. itself
    • in the edit connection window I click on "change"
    • and add my custom slot there manually


    From that moment on, the custom slot appears in the popup menus and can be selected. I don't have to manually add any code, which is nice.

    But this isn't the regular way of doing this, is it? I still hope Qt Designer somehow recognizes my custom signals and slots by itself.

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

    Default Re: Correct Member Sheet Extension Implementation

    Can you show us the complete code for this widget and its plugin?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  8. #7
    Join Date
    Jul 2009
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Correct Member Sheet Extension Implementation

    Quote Originally Posted by wysota View Post
    Can you show us the complete code for this widget and its plugin?
    qt4direct3dcontainer.h
    Qt Code:
    1. #pragma once
    2.  
    3. #ifndef QT4DIRECT3DCONTAINER_H
    4. #define QT4DIRECT3DCONTAINER_H
    5.  
    6. #include <QtGui/QWidget>
    7. #include <qmessagebox.h>
    8. #include <QResizeEvent>
    9. #include <QTimer>
    10.  
    11. #include <QtDesigner/QDesignerExportWidget>
    12.  
    13. // Direct3D Header
    14. #include <d3d9.h>
    15. #include <d3dx9.h>
    16.  
    17. #include "Cube.h"
    18.  
    19. class QDESIGNER_WIDGET_EXPORT Qt4Direct3DContainer : public QWidget
    20. {
    21. Q_OBJECT
    22.  
    23. public:
    24. Qt4Direct3DContainer(QWidget *parent = 0);
    25. ~Qt4Direct3DContainer();
    26.  
    27. BOOL Init();
    28. void Shut();
    29. PDIRECT3DDEVICE9 GetDevice(){ return m_pD3D9dev; };
    30.  
    31. QPaintEngine *paintEngine() const;
    32. void paintEvent(QPaintEvent *p_event);
    33. void resizeEvent(QResizeEvent *p_event);
    34.  
    35. public slots:
    36.  
    37. void turn();
    38.  
    39. private:
    40.  
    41. D3DPRESENT_PARAMETERS m_d3dPP;
    42. PDIRECT3D9 m_pD3D9;
    43. PDIRECT3DDEVICE9 m_pD3D9dev;
    44.  
    45. QTimer *m_pqTimer;
    46.  
    47. D3DXVECTOR3 m_vEye;
    48. D3DXVECTOR3 m_vAt;
    49. D3DXVECTOR3 m_vUp;
    50.  
    51. D3DXMATRIX m_mtxWorld;
    52. D3DXMATRIX m_mtxView;
    53. D3DXMATRIX m_mtxProjection;
    54.  
    55. float m_fTurn;
    56. bool m_bTurn;
    57.  
    58. };
    59.  
    60. #endif // QT4DIRECT3DCONTAINER_H
    To copy to clipboard, switch view to plain text mode 

    qt4direct3dcontainer.cpp
    Qt Code:
    1. #include "qt4direct3dcontainer.h"
    2.  
    3. Qt4Direct3DContainer::Qt4Direct3DContainer(QWidget *parent)
    4. : QWidget(parent)
    5. {
    6. m_pD3D9 = NULL;
    7. m_pD3D9dev = NULL;
    8. ZeroMemory(&m_d3dPP, sizeof(m_d3dPP));
    9.  
    10. m_pqTimer = NULL;
    11.  
    12. setAttribute(Qt::WA_PaintOnScreen, true);
    13.  
    14. Init();
    15. }
    16.  
    17. Qt4Direct3DContainer::~Qt4Direct3DContainer()
    18. {
    19. Shut();
    20. }
    21.  
    22. BOOL Qt4Direct3DContainer::Init()
    23. {
    24. Shut();
    25.  
    26. // Initialize Direct3D 9
    27. m_pD3D9 = Direct3DCreate9(D3D_SDK_VERSION);
    28.  
    29. // Test for Success
    30. if(m_pD3D9 == NULL)
    31. {
    32. QMessageBox::information(this, "Direct 3D Initialization",
    33. "Unable to initialize Direct3D 9.");
    34. return FALSE;
    35. }
    36.  
    37. // Presentation Parameters
    38.  
    39. // Backbuffer Parameters
    40. m_d3dPP.BackBufferWidth = width();
    41. m_d3dPP.BackBufferHeight = height();
    42. m_d3dPP.BackBufferFormat = D3DFMT_A8R8G8B8;
    43. m_d3dPP.BackBufferCount = 1;
    44. m_d3dPP.SwapEffect = D3DSWAPEFFECT_FLIP;
    45. m_d3dPP.FullScreen_RefreshRateInHz = 0;
    46. m_d3dPP.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
    47.  
    48. // Multisampling(Antialiasing) Parameters
    49. m_d3dPP.MultiSampleType = D3DMULTISAMPLE_NONE;
    50. m_d3dPP.MultiSampleQuality = 0;
    51.  
    52. // Window Parameters
    53. m_d3dPP.hDeviceWindow = winId();
    54. m_d3dPP.Windowed = TRUE;
    55.  
    56. // Depth/Stencil Buffer Parameters
    57. m_d3dPP.EnableAutoDepthStencil = TRUE;
    58. m_d3dPP.AutoDepthStencilFormat = D3DFMT_D24S8;
    59.  
    60. // misc. Parameters
    61. m_d3dPP.Flags = 0;
    62.  
    63. // Initialize Direct3D 9 Device
    64. if(!SUCCEEDED(m_pD3D9->CreateDevice( D3DADAPTER_DEFAULT,
    65. D3DDEVTYPE_HAL,
    66. winId(),
    67. D3DCREATE_SOFTWARE_VERTEXPROCESSING,
    68. &m_d3dPP,
    69. &m_pD3D9dev)))
    70. {
    71. QMessageBox::information(this, "Direct 3D Device Initialization",
    72. "Unable to initialize Direct3D 9 Device.");
    73. return FALSE;
    74. }
    75.  
    76. //Vectors
    77. m_vEye = D3DXVECTOR3(5.0f, 2.0f, 5.0f);
    78. m_vAt = D3DXVECTOR3(0.0f, 0.0f, 0.0f);
    79. m_vUp = D3DXVECTOR3(0.0f, 1.0f, 0.0f);
    80.  
    81. //Matrices
    82. m_fTurn = 0.0f;
    83. m_bTurn = false;
    84. D3DXMatrixRotationY(&m_mtxWorld, m_fTurn);
    85. D3DXMatrixLookAtLH(&m_mtxView, &m_vEye, &m_vAt, &m_vUp);
    86. D3DXMatrixPerspectiveFovLH(&m_mtxProjection, 0.14f, width() / height(), 0.1f, 10.0f);
    87.  
    88. if(InitCubeObjects(m_pD3D9dev))
    89. {
    90. cube_effect->SetMatrix(cube_world, &m_mtxWorld);
    91. cube_effect->SetMatrix(cube_view, &m_mtxView);
    92. cube_effect->SetMatrix(cube_projection, &m_mtxProjection);
    93.  
    94. cube_effect->CommitChanges();
    95. }
    96.  
    97. //QTimer
    98.  
    99. m_pqTimer = new QTimer(this);
    100. connect(m_pqTimer, SIGNAL(timeout()), this, SLOT(repaint()));
    101. m_pqTimer->start(10);
    102.  
    103. return TRUE;
    104. }
    105.  
    106. void Qt4Direct3DContainer::turn()
    107. {
    108. m_bTurn = !m_bTurn;
    109. }
    110.  
    111. void Qt4Direct3DContainer::Shut()
    112. {
    113. // delete QTimer
    114. if(m_pqTimer != NULL && m_pqTimer->isActive())
    115. {
    116. m_pqTimer->stop();
    117. }
    118. delete m_pqTimer;
    119. m_pqTimer = NULL;
    120.  
    121. ReleaseCubeObjects();
    122.  
    123. // Release Direct3D 9 Device
    124. if(m_pD3D9dev != NULL)
    125. {
    126. m_pD3D9dev->Release();
    127. }
    128. m_pD3D9dev = NULL;
    129.  
    130. // Zero Direct3D 9 Presentation Parameters
    131. ZeroMemory(&m_d3dPP, sizeof(m_d3dPP));
    132.  
    133. // Release Direct3D 9
    134. if(m_pD3D9 != NULL)
    135. {
    136. m_pD3D9->Release();
    137. }
    138. m_pD3D9 = NULL;
    139.  
    140. // Matrices
    141. ZeroMemory(&m_mtxWorld, sizeof(D3DXMATRIX));
    142. ZeroMemory(&m_mtxView, sizeof(D3DXMATRIX));
    143. ZeroMemory(&m_mtxProjection, sizeof(D3DXMATRIX));
    144.  
    145. // Vectors
    146. ZeroMemory(&m_vEye, sizeof(D3DXVECTOR3));
    147. ZeroMemory(&m_vAt, sizeof(D3DXVECTOR3));
    148. ZeroMemory(&m_vUp, sizeof(D3DXVECTOR3));
    149. }
    150.  
    151. QPaintEngine *Qt4Direct3DContainer::paintEngine() const
    152. {
    153. return NULL;
    154. }
    155.  
    156. void Qt4Direct3DContainer::paintEvent(QPaintEvent *p_event)
    157. {
    158. m_pD3D9dev->Clear( 0,
    159. NULL,
    160. D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER,
    161. D3DCOLOR_RGBA(64, 64, 96, 255),
    162. 1.0f,
    163. 0);
    164.  
    165. m_pD3D9dev->BeginScene();
    166.  
    167. m_pD3D9dev->SetVertexDeclaration(pDeclarationPosColorNormal);
    168. m_pD3D9dev->SetStreamSource(0, cube_vertexBuffer, 0, sizeof(VertexPosColorNormal));
    169. m_pD3D9dev->SetIndices(cube_indexBuffer);
    170.  
    171. //m_pD3D9dev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
    172.  
    173. UINT uiNumberOfPasses,
    174. uiPass;
    175.  
    176. if(m_bTurn)
    177. {
    178. m_fTurn += 0.01f;
    179. D3DXMatrixRotationY(&m_mtxWorld, m_fTurn);
    180. }
    181. cube_effect->SetMatrix(cube_world, &m_mtxWorld);
    182. cube_effect->SetMatrix(cube_view, &m_mtxView);
    183. cube_effect->SetMatrix(cube_projection, &m_mtxProjection);
    184.  
    185. cube_effect->CommitChanges();
    186.  
    187. cube_effect->Begin(&uiNumberOfPasses, 0);
    188. for(uiPass = 0; uiPass < uiNumberOfPasses; uiPass++)
    189. {
    190. cube_effect->BeginPass(uiPass);
    191. /*m_pD3D9dev->DrawIndexedPrimitive( D3DPT_TRIANGLELIST,
    192. 0,
    193. 0,
    194. cube_numberOfVertices,
    195. 0,
    196. 12);*/
    197.  
    198. m_pD3D9dev->DrawIndexedPrimitiveUP( D3DPT_TRIANGLELIST,
    199. 0,
    200. cube_numberOfVertices,
    201. 12,
    202. cube_indices,
    203. D3DFMT_INDEX32,
    204. &cube_vertices,
    205. sizeof(VertexPosColorNormal));
    206.  
    207. cube_effect->EndPass();
    208. }
    209. cube_effect->End();
    210.  
    211. m_pD3D9dev->EndScene();
    212.  
    213. m_pD3D9dev->Present( NULL,
    214. NULL,
    215. NULL,
    216. NULL);
    217. }
    218.  
    219. void Qt4Direct3DContainer::resizeEvent(QResizeEvent *p_event)
    220. {
    221. QSize newSize = p_event->size();
    222.  
    223. m_d3dPP.BackBufferWidth = newSize.rwidth();
    224. m_d3dPP.BackBufferHeight = newSize.rheight();
    225.  
    226. D3DXMatrixPerspectiveFovLH(&m_mtxProjection, 1.6f, (float)m_d3dPP.BackBufferWidth / (float)m_d3dPP.BackBufferHeight, 0.1f, 10.0f);
    227.  
    228. ReleaseCubeObjects();
    229.  
    230. m_pD3D9dev->Reset(&m_d3dPP);
    231.  
    232. InitCubeObjects(m_pD3D9dev);
    233. }
    To copy to clipboard, switch view to plain text mode 

    qt4direct3dcontainerplugin.h
    Qt Code:
    1. #ifndef QT4DIRECT3DCONTAINERPLUGIN_H
    2. #define QT4DIRECT3DCONTAINERPLUGIN_H
    3.  
    4. #include <QDesignerCustomWidgetInterface>
    5. #include <QDesignerMemberSheetExtension>
    6. #include <QExtensionManager>
    7. #include <QDesignerFormEditorInterface>
    8.  
    9. class Qt4Direct3DContainerPlugin : public QObject, public QDesignerCustomWidgetInterface
    10. {
    11. Q_OBJECT
    12.  
    13. public:
    14. Qt4Direct3DContainerPlugin(QObject *parent = 0);
    15.  
    16. bool isContainer() const;
    17. bool isInitialized() const;
    18. QIcon icon() const;
    19. QString domXml() const;
    20. QString group() const;
    21. QString includeFile() const;
    22. QString name() const;
    23. QString toolTip() const;
    24. QString whatsThis() const;
    25. QWidget *createWidget(QWidget *parent);
    26. void initialize(QDesignerFormEditorInterface *core);
    27.  
    28. private:
    29. bool initialized;
    30. };
    31.  
    32. #endif // QT4DIRECT3DCONTAINERPLUGIN_H
    To copy to clipboard, switch view to plain text mode 

    qt4direct3dcontainerplugin.cpp
    Qt Code:
    1. #include "qt4direct3dcontainer.h"
    2.  
    3. #include <QtCore/QtPlugin>
    4. #include "Qt4D3DCExtensionFactory.h"
    5. #include "qt4direct3dcontainerplugin.h"
    6.  
    7.  
    8. Qt4Direct3DContainerPlugin::Qt4Direct3DContainerPlugin(QObject *parent)
    9. : QObject(parent)
    10. {
    11. initialized = false;
    12. }
    13.  
    14. void Qt4Direct3DContainerPlugin::initialize(QDesignerFormEditorInterface *formEditor)
    15. {
    16. if (initialized)
    17. return;
    18.  
    19. initialized = true;
    20. }
    21.  
    22. bool Qt4Direct3DContainerPlugin::isInitialized() const
    23. {
    24. return initialized;
    25. }
    26.  
    27. QWidget *Qt4Direct3DContainerPlugin::createWidget(QWidget *parent)
    28. {
    29. return new Qt4Direct3DContainer(parent);
    30. }
    31.  
    32. QString Qt4Direct3DContainerPlugin::name() const
    33. {
    34. return "Direct3D Container";
    35. }
    36.  
    37. QString Qt4Direct3DContainerPlugin::group() const
    38. {
    39. return "Containers";
    40. }
    41.  
    42. QIcon Qt4Direct3DContainerPlugin::icon() const
    43. {
    44. return QIcon(":/icons/directx.png");
    45. }
    46.  
    47. QString Qt4Direct3DContainerPlugin::toolTip() const
    48. {
    49. return QString();
    50. }
    51.  
    52. QString Qt4Direct3DContainerPlugin::whatsThis() const
    53. {
    54. return QString();
    55. }
    56.  
    57. bool Qt4Direct3DContainerPlugin::isContainer() const
    58. {
    59. return false;
    60. }
    61.  
    62. QString Qt4Direct3DContainerPlugin::domXml() const
    63. {
    64. return "<widget class=\"Qt4Direct3DContainer\" name=\"qt4Direct3DContainer\">\n"
    65. " <property name=\"geometry\">\n"
    66. " <rect>\n"
    67. " <x>0</x>\n"
    68. " <y>0</y>\n"
    69. " <width>100</width>\n"
    70. " <height>100</height>\n"
    71. " </rect>\n"
    72. " </property>\n"
    73. "</widget>\n";
    74. }
    75.  
    76. QString Qt4Direct3DContainerPlugin::includeFile() const
    77. {
    78. return "qt4direct3dcontainer.h";
    79. }
    80.  
    81. Q_EXPORT_PLUGIN2(qt4direct3dcontainer, Qt4Direct3DContainerPlugin)
    To copy to clipboard, switch view to plain text mode 

  9. #8
    Join Date
    Jul 2009
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Correct Member Sheet Extension Implementation

    Okay, next weird thing:

    I've created another Qt Designer Plugin project in Visual Studio and created some dummy public slots.

    Well after compiling and putting the files into he plugins folder, the dummy slots appear in Qt Designer without problems.

    So, I guess something has to be missing from my actual Widget...

  10. #9
    Join Date
    Jul 2009
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Correct Member Sheet Extension Implementation

    Alright,

    I've solved the problem:

    I've created a new Qt Plugin project and copied the code from the old one.
    I can see the custom slots now.
    Also, the preview of my plugin is working correctly now, previously Qt Designer wouldn't draw anything inside the bounding boxes of my widget.

    So I can only guess some of the preferences or settings of my old project were incorrect.
    Unfortunately, I can't tell which ones, but I'm glad it works now :-)

    Try cleaning the project and rebuilding it from scratch.
    Well that kind of was the solution. So, thanks wysota ;-)

Tags for this Thread

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.