[Qt-interest] Adding widget to QGraphicsView

tangke tangk at lemote.com
Sat Jul 25 14:50:24 CEST 2009


On 07/22/2009 09:29 PM, John McClurkin wrote:
> Yuvaraj R wrote:
>    
>>
>>
>> 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
>>      
> The compiler went to Qlineedit.h 268? I assume you mean that the
> debugger went to qlineedit.h 268. If this is a stack trace, then this
> line just the last entry of the trace. Since this is a Qt src file, I
> double strongly that the error is here. The error was triggered by your
> code. You need to examine the stack trace to find the entries that
> identify your code. That said, I would guess that, since the debugger
> stops in qlineedit.h, you are using an invalid pointer to a QLineEdit
> widget.
>
>    
sometimes the debug stop at the qt src file, but it's caused by your code .
>>
>>
>> Thanks
>>
>> Yuvaraj R
>>
>> On Wed, Jul 22, 2009 at 5:15 PM, John McClurkin<jwm at nei.nih.gov
>> <mailto: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  <mailto:Qt-interest at trolltech.com>
>>      http://lists.trolltech.com/mailman/listinfo/qt-interest
>>
>>
>>      
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>    




More information about the Qt-interest-old mailing list