| ID | ... | Creation date | 10 April 2009 |
| Platform | S60 3rd Edition FP1, S60 3rd Edition FP2, S60 5th Edition | Tested on devices | S60 Emulator |
| Category | Qt for S60 | Subcategory | Application |
| Keywords (APIs, classes, methods, functions): QGraphicsProxyWidget,QGraphicsScene,QGraphicsView,QLineEdit,QLabel |
The QGraphicsProxyWidget class provides a proxy layer for embedding a QWidget in a QGraphicsScene. QGraphicsProxyWidget embeds QWidget-based widgets, for example, a QPushButton, QFontComboBox, or even QFileDialog, into QGraphicsScene. It forwards events between the two objects and translates between QWidget's integer-based geometry and QGraphicsWidget's qreal-based geometry.
QGraphicsProxyWidget takes care of automatically embedding popup children of embedded widgets through creating a child proxy for each popup.
#include "proxywidget.h"
#include <QtGui>
#include <QApplication>
#include<QGroupBox>
#include<QFormLayout>
#include<QLabel>
#include<QLineEdit>
#include<QGraphicsScene>
#include<QGraphicsProxyWidget>
#include<QGraphicsView>
#include<QPushButton>
#include<QComboBox>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QGroupBox *groupBox = new QGroupBox("Contact Details",this);
QLabel *numberLabel = new QLabel("Telephone number",this);
QLineEdit *numberEdit = new QLineEdit(this);
QPushButton *but=new QPushButton("Helloooo",this);
QFormLayout *layout = new QFormLayout;
QComboBox *box=new QComboBox(this);
box->addItem("Nokia");
box->addItem("Qt for S60");
box->addItem("Widget");
box->addItem("N96");
box->addItem("London");
box->addItem("Finland");
box->addItem("NewYork");
box->addItem("Symbian");
box->addItem("Paris");
box->addItem("Budapest");
layout->addRow(numberLabel, numberEdit);
layout->addRow(but);
layout->addRow(box);
groupBox->setLayout(layout);
QGraphicsScene scene;
QGraphicsProxyWidget *proxy = scene.addWidget(groupBox);
QGraphicsView view(&scene);
view.show();
return a.exec();
}
Note the changes in the scrollBar of the widget
More about QGraphicProxyWidget
|
|
|