Qt Extensions custom widgets

Hi Rooters

I am trying to use the BNL contribution to qt-root, the Qt Extension not in the offcial ROOT distribution.

There is a TQtWidget (also in the official ROOT package) and the “.cw” assiociated file that allows me to use “designer”. This is explained well in the ROOT manual and it works fine.

But in the “Qt extension” made by BNL, there are other objects I am very interested too, for instance “TQtColorSelectButton”. But there is no “.cw” associated file to allow to have an easy manipulation in “designer”. How can I create such files?
Of course I could use the libraries directly but positionning widgets is much easier with designer.

Thahks for your help

[quote=“matthieuguillo”]Hi Rooters

I am trying to use the BNL contribution to qt-root, the Qt Extension not in the offcial ROOT distribution.

There is a TQtWidget (also in the official ROOT package) and the “.cw” assiociated file that allows me to use “designer”. This is explained well in the ROOT manual and it works fine.

But in the “Qt extension” made by BNL, there are other objects I am very interested too, for instance “TQtColorSelectButton”. But there is no “.cw” associated file to allow to have an easy manipulation in “designer”. How can I create such files?
Of course I could use the libraries directly but positionning widgets is much easier with designer.

Thahks for your help[/quote]

Qt documentation does define the way to create the “Custom widget defintion” from that C++ class header file.
doc.trolltech.com/3.3/designer-manual-7.html

In brief, they say you should load the C++ class header file into Qt designer and then save it with “cw” format.

One needs no re-compilation or any change of that class code.

What about omission. I did not create yet the “cw” for many Qt/Root classes because I am not sure yet theier interfaces are stable enough to advice it to the end-user. This means you can add any class you want to the Qt desinger yourself, it is simple . . . but you should be carefull.
On the other hands I appreciate any early user feed-back to make these class interfaces up and stable.

quote=“matthieuguillo”]
But in the “Qt extension” made by BNL, there are other objects I am very interested too, for instance “TQtColorSelectButton”. But there is no “.cw” associated file to allow to have an easy manipulation in “designer”. How can I create such files?
Of course I could use the libraries directly but positionning widgets is much easier with designer.

[/quote]

I can promise in a week (i.e. as soon as ROOT 2005 Workshop and my trip are over) to revise and provide “cw” files for

TQtFloatSpinBox.h
TQtColorSelecButton.h
TQtPatternSelectButton.h

Hope this is what you implied.

[quote=“fine”]quote=“matthieuguillo”]
But in the “Qt extension” made by BNL, there are other objects I am very interested too, for instance “TQtColorSelectButton”. But there is no “.cw” associated file to allow to have an easy manipulation in “designer”. How can I create such files?
Of course I could use the libraries directly but positionning widgets is much easier with designer.

[/quote]

I can promise in a week (i.e. as soon as ROOT 2005 Workshop and my trip are over) to revise and provide “cw” files for

TQtFloatSpinBox.h
TQtColorSelecButton.h
TQtPatternSelectButton.h

Hope this is what you implied.[/quote]

HI Valeri

Yes, that is exactly what I implied. Tha will be great. Actually I tried what you told me, and loaded the header files in designer but somehow it didn’t work, I think it is because in the header files there is more than one declaration object?

Thanks

Hello
I have updated the QT extension library and included the 3 new "Custom widgets"
root.bnl.gov/QtRoot/pictures/QtR … idgets.png
I added the “CustomWidgest” project under qtRoot/qtExamples/CustomWidgets"
root.bnl.gov/QtRoot/root/qtExamp … ets/README

The examlpe was done with the Qt designer without any hard-written code

Please update your local version

Hi Valeri

I will use them in my application. Thanks a lot.

[quote=“fine”][quote=“matthieuguillo”]

TQtFloatSpinBox.h
TQtColorSelecButton.h
TQtPatternSelectButton.h

HI Valeri

Yes, that is exactly what I implied. Tha will be great. Actually I tried what you told me, and loaded the header files in designer but somehow it didn’t work, I think it is because in the header files there is more than one declaration object?
[/quote]

Hello
I have updated the QT extension library and included the 3 new "Custom widgets"
root.bnl.gov/QtRoot/pictures/QtR … idgets.png
I added the “CustomWidgest” project under qtRoot/qtExamples/CustomWidgets"
root.bnl.gov/QtRoot/root/qtExamp … ets/README

The examlpe was done with the Qt designer without any hard-written code

Please update your local version[/quote]

I have added one extra class TQtCustomizeCanvasMenu and one extra example CustomCanvasMenu to show how to use it
To customize the standard ROOT ContextMenu with some Qt menu one has to add 2 lines of the code.

 Usage:
   1. Instantiate and attach the event filter to the TCanvas or TQtWidget object:

      TQtCustomizeCanvasMenu *eventFilter =
                TQtCustomizeCanvas::installCustomMenu(tQtWidget1);

      where   tQtWidget1 is a TQtWidget pointer

  2. Connect the AboutToShow signal of the 
TQtCustomizeCanvasMenu object with your
     Qt Slot

     connect( eventFilter,SIGNAL(AboutToShow(QPopupMenu *,TContextMenu *))
            , myMainSteeringObject,SLOT(CustomizeIt(QPopupMenu *,TContextMenu *)));


  3. Provide the method to change the "standard" ROOT Context menu:

       void CustomizeIt(QPopupMenu *contextMenu,TContextMenu *rootContyextMenu) 
       {
           // Second parameter is optional and may be disregarded.
           // One can use it to garther an extra information about the context
           contextMenu->insertSeparator();
           QPopupMenu *customMenu = new QPopupMenu();
           contextMenu->insertItem("&AtlasDAQ",propertiesMenu);
           propertiesMenu->insertItem("Menu Custom item");
       }

[quote=“matthieuguillo”]But in the “Qt extension” made by BNL, there are other objects I am very interested too, for instance “TQtColorSelectButton”. But there is no “.cw” associated file to allow to have an easy manipulation in “designer”. How can I create such files?
Of course I could use the libraries directly but positionning widgets is much easier with designer.
[/quote]I have updated the Qt extension library and included the 3 new “Custom widgets”:

// "new" classes: TQtFontComboBox.cw TQtLineStyleComboBox.cw TQtLineWidthComboBox.cw // "old" classes: TQtColorSelectButton.cw TQtFloatSpinBox.cw TQtPatternSelectButton.cw TQtWidget.cw
See the collage: root.bnl.gov/QtRoot/pictures/QtR … idgets.png
The “CustomWidgets” project (see: qtRoot/qtExamples/CustomWidgets"
root.bnl.gov/QtRoot/root/qtExamp … ets/README )
includes the simple example using 6 custom widgets. The example code is 100% automatically generated by Qt designer
without any hard-written code.
No C++ programming is involved. It should work with any not too old :wink: ROOT version on Unix , Windows, Mac (with and with no X11)

It shows how one can use the “embedded” offscreen TPad to decorate any Qt GUI component with the “real” ROOT graphics.
Please update your local version