New in MailingList & Qsocket
Jeff Weeks
jweeks at mailandnews.com
Thu Jun 27 15:22:09 BST 2002
> Sorry, but the QSocket::State property is an enum and not a QString...
>
> > How can i do ??
>
> Assuming You have
>
> QSocket *sock;
> QLabel *label;
>
> Try something like
>
> switch( sock()->state() )
> {
> case QSocket::Idle:
> label->setText("Idle");
> break;
> .
> .
> .
> }
Or (perhaps a little more efficient?):
struct {
long stateNum;
char *stateText;
} StateInfo;
struct StateInfo stateInfo[5] = {
{ QSocket::Idle, "Idle" },
{ QSocket::Other, "Other },
{ etc .... }
}
and...
long currentState = sock()->state();
long i = 0;
while(stateInfo[i].stateNum != currentState) { i++; }
label->setText(stateInfo[i].stateText);
Cheers,
Jeff
PS: That's off the top of my head... there might be errors, but you probably
see what I'm getting at (I just don't trust the efficiency of switch
statements ;)
-
to unsubscribe from this list send an email to kdevelop-request at kdevelop.org with the following body:
unsubscribe »your-email-address«
More information about the KDevelop
mailing list