[Qt-interest] Adding widget to QGraphicsView
Yuvaraj R
yuvaraj at ongobiz.com
Wed Jul 22 10:41:14 CEST 2009
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
On Wed, Jul 22, 2009 at 12:30 PM, Chandru... <sekarwagmare at gmail.com> wrote:
>
> take a look at QGraphicsProxyWidget
> On Wed, Jul 22, 2009 at 12:24 PM, Yuvaraj R <yuvaraj at ongobiz.com> wrote:
>
>> Hi All
>>
>> I am newbee to Graphics side..
>>
>> I tried to add the widget to QGraphics View with the 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);
>>
>> ui->graphicsView->setScene(scene);
>>
>>
>>
>> Here How do i add the Widget to QgraphicsScene.
>>
>>
>>
>> Please Help me
>>
>>
>>
>>
>>
>> Advance Thanks
>>
>>
>>
>> Yuvaraj R
>>
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>
>>
>
>
> --
> WAGMARE
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090722/8db3b189/attachment.html
More information about the Qt-interest-old
mailing list