I used QGraphicsView to write an event display for my experiment. Now I’m trying to integrate TQtWidget in my application to plot some histograms using Root. At first, I noticed that simply creating a TQtWidget in the GUI makes my existing code behave in a strange way; I prepared an example to better explain it, it is attached as a tarball to this message. The ui file contains a simple interface definition wit a main window containing a QGraphicsView object and a TQtWidget.
I add a QGraphicsSimpleTextItem to my graphics scene in MainWindow constructor and then I read the size of its font:
ui->graphicsView->setScene(new QGraphicsScene(0, 0, 100, 100, this));
QGraphicsSimpleTextItem *text = ui->graphicsView->scene()->addSimpleText("Hello");
std::cout << "Font size: " << text->font().pointSizeF() << std::endl;
The console output is:
$ ./TestQtRoot
** $Id: TGQt.cxx 42700 2012-01-18 14:33:18Z rdm $ this=0x13918f0
Symbol font family found: "Standard Symbols L"
Font size: 0
If I remove the TQtWidget from the interface (for example using QtCreator) I get:
$ ./TestQtRoot
Font size: 9
I find this really strange but maybe it’s the intended behaviour… I’m new to QtRoot and this is my first experiment.
Using Root 5.34.07 and Qt 4.8.5 on a 64 bit ArchLinux machine.
Thanks.
TestQtRoot.tar.gz (1.57 KB)