[Qt-interest] Adding widget to QGraphicsView

Yuvaraj R yuvaraj at ongobiz.com
Wed Jul 22 14:03:20 CEST 2009


Thanks for your reply..

I ran my program in  Debugger.. It was hunging.. and complier went to
Qlineedit .h line number 268...

I have used lineedit in my program.. and used properly

 But i don't understand the bug.

Could explain me.please


Thanks

Yuvaraj R

On Wed, Jul 22, 2009 at 5:15 PM, John McClurkin <jwm at nei.nih.gov> wrote:

>  Yuvaraj R wrote:
> >
> > What mistake below code.
> >
> >  QGraphicsScene *scene= new QGraphicsScene(this);
> >
> > ui->graphicsView->setScene(scene);
> >
> > ui->graphicsView->setCacheMode(QGraphicsView::CacheBackground);
> >
> > Ui_Form *m_ui = new Ui_Form;
> >
> > QWidget *wid = new QWidget;
> >
> > m_ui->setupUi(wid);
> >
> > QGraphicsProxyWidget *proxy = new QGraphicsProxyWidget;
> >
> > QLabel *label = new QLabel;
> >
> > label->setText("Hello World !!!");
> >
> > QPushButton *button = new QPushButton;
> >
> > button->setText("dfgdfgdsg");
> >
> > label->setGeometry(30,30,40,20);
> >
> > QLineEdit *line = new QLineEdit;
> >
> > line->setGeometry(0,0,50,50);
> >
> > line->setFocus();
> >
> > proxy =scene->addWidget(line);
> >
> > label->setScaledContents(true);
> >
> > QObject::connect(button,SIGNAL(clicked()),this,SLOT(show_message1()));
> >
> > proxy = scene->addWidget(button);
> >
> > proxy = scene->addWidget(label);
> >
> > ui->graphicsView->setBackgroundBrush(Qt::darkCyan);
> >
> > ui->graphicsView->setScene(scene);
> >
> > void Widget::show_message1()
> >
> > {
> >
> > QMessageBox::information(0,"",QString(line->text()));
> >
> > }
> >
> >
> > When i pressing the button ,application is crashing. if use the base
> > class slots,it is working..any mistake in above code..
> >
> > And one more thing  i want to design the login page ,2 label,2 line edit
> > ,one push button..
> >
> > Functionality wise i am strong..But i am struggling with GUi.. I have to
> > do get rich GUi..
> >
> > What are things  i have to use.Good Gui based examples are Welcome
> >
> > Please Guide me..
> >
> > Thanks
> >
> > Yuvaraj R
>
> I see this a lot on this news group. Some one has a program that
> crashes, so they post some code and ask what is wrong with the code. The
> first thing any one should do when their program crashes is run it in a
> debugger to get, at the very least, a stack trace. Most often this will
> show what the problem is. This is much quicker than posting to a news
> group. So, Yuvaraj, run your program in a debugger, make it crash, and
> examine the stack trace. Most program crashes are caused by trying to
> dereference a NULL pointer or trying to access invalid memory.
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090722/75307a21/attachment.html 


More information about the Qt-interest-old mailing list