Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 7

Qt-interest Archive, April 2007
need your help, please


Message 1 in thread

hi, all
i just want to  creat  a  few labels, lineedits and pushbuttons, and i do it
like this as follows. check for me if it does work as i expect, please!
thank you in advance.

     QStringList coord;
     QList<double> val;
     QVBoxLayout vBoxLayout = new QVBoxLayout(this);
     vBoxLayout->addLayout(...);
     vBoxLayout->addLayout(...);
     for (int i = 0; i < numaxis; ++i)
    {
        QLabel *coordLabel = new QLabel(coord[i]);
        QLineEdit *coordLineEdit = new QLineEdit();
        coordLineEdit->setText(val[i]);
        QPushButton *coordPushButton = new QPushButton(tr("Teach"), 0);
        QHBoxLayout *coordLayout = new QHBoxLayout(this);
        QHBoxLayout->addWidget(coordLabel);
        QHBoxLayout->addWidget(coordLineEdit);
        QHBoxLayout->addWidget(coordPushButton);
        vBoxLayout->addLayout(coorLayoutLayout);
        connect(coordLineEdit, SIGNAL(returnPressed()), this,
SLOT(coordLineEditTextChanged()));
        connect(coordPushButton, SIGNAL(clicked()), this,
SLOT(getLocation()));
    }

regards
fengli

Message 2 in thread

On 30.04.07 22:35:46, ååä wrote:
> hi, all
> i just want to  creat  a  few labels, lineedits and pushbuttons, and i do it
> like this as follows. check for me if it does work as i expect, please!
> thank you in advance.

How should we test this code snippet? Do you expect us to write the
needed code around that to be able to run it? We generally don't have
time for such stuff. Do you have specific problems? If so explain what
you're seeing and what you would expect, also add information about the
Qt version you use.

Andreas

-- 
 [ signature omitted ] 

Message 3 in thread

"???" <zhangfenglisdu@xxxxxxxxx> wrote in message 
news:340b09b40704300735hdd78c91ha818fedbec52604b@xxxxxxxxxxxxxxxxx
> hi, all
> i just want to  creat  a  few labels, lineedits and pushbuttons, and i 
> do it
> like this as follows. check for me if it does work as i expect, please!
> thank you in advance.
>
>     QStringList coord;
>     QList<double> val;
>     QVBoxLayout vBoxLayout = new QVBoxLayout(this);
>     vBoxLayout->addLayout(...);
>     vBoxLayout->addLayout(...);
>     for (int i = 0; i < numaxis; ++i)
>    {
>        QLabel *coordLabel = new QLabel(coord[i]);
>        QLineEdit *coordLineEdit = new QLineEdit();
>        coordLineEdit->setText(val[i]);
>        QPushButton *coordPushButton = new QPushButton(tr("Teach"), 0);
>        QHBoxLayout *coordLayout = new QHBoxLayout(this);
>        QHBoxLayout->addWidget(coordLabel);
>        QHBoxLayout->addWidget(coordLineEdit);
>        QHBoxLayout->addWidget(coordPushButton);
>        vBoxLayout->addLayout(coorLayoutLayout);
>        connect(coordLineEdit, SIGNAL(returnPressed()), this,
> SLOT(coordLineEditTextChanged()));
>        connect(coordPushButton, SIGNAL(clicked()), this,
> SLOT(getLocation()));
>    }


This will not compile.

If you make it compile, then it will probably do something.

One thing it will probably do is to assert, as you accessing an index in a 
list "coord" and a vector "val" that is out of range (unless numaxis is 0, 
in which case you can save yourself a lot of code).

Volker


--
 [ signature omitted ] 

Message 4 in thread

On Monday 30 April 2007, ååä wrote:
> i just want to  creat  a  few labels, lineedits and pushbuttons, and i do
> it like this as follows. check for me if it does work as i expect,
> please! thank you in advance.

What is wrong with trying it yourself? Is your computer broken? (If so: how 
did you manage to write this mail?)

Maybe you might be interested in this:
http://www.catb.org/~esr/faqs/smart-questions.html


	Konrad

Attachment:

Attachment: pgpm3zcVF6lQo.pgp
Description: PGP signature