You Are Here:

Community: Wiki

This page was last modified on 31 October 2009, at 14:13.

How to use QGraphicsProxyWidget

From Forum Nokia Wiki


Reviewer Approved   



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

Introduction

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.


Preconditions

Souce Code

Main.cpp

#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();
}

ScreenShot

Before Clicking The ComboBox

Note the changes in the scrollBar of the widget

More about QGraphicProxyWidget

Image:Mescreen001.jpg

Related Wiki Articles

      Rate This

       
      Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
      京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
      RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2findeE78E2ephpE2fTalkE3aE4cargeE5fscreenE5fsaverX qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqfntypeZWikiContentQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qfnZtypeQUqfntypeZWikiContentQ qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqfntypeZWikiContentQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ
      User Rating: qfnZuserE5FratingQNx5E2E0000X