Results 1 to 2 of 2

Thread: Switch case in Qvector object

  1. #1
    Join Date
    Jan 2010
    Posts
    28
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Switch case in Qvector object

    h. i am use switch condition in Qvector object, the code given below.
    iobinvect is an object of QVector , how to use QVector object in switch condition,
    i got error like this: Switch quantity is not an integer.

    please go through this code and give me your valuable answer , it is very urgent.



    logic.cpp

    QVector <iobin_config> iobinvect; // created an object.



    channel.cpp

    qDebug()<<"SlotNo"<< QString("%1").arg(iobinvect[0].slotNo); // display's the slotno


    switch(iobinvect[0].slotNo)
    {
    case 1:

    diword=s1diword;
    doword=s1doword;
    aioword=s1aioword;

    dimod=s1dimod;
    domod=s1domod;
    aiomod=(aioword)/2;

    modvalues();
    SlotType();
    break;

    case 2:

    diword=s2diword;
    doword=s2doword;
    aioword=s2aioword;

    dimod=s2dimod;
    domod=s2domod;
    aiomod=(aioword)/2;

    modvalues();
    SlotType();
    break;

    case 3:
    diword=s3diword;
    doword=s3doword;
    aioword=s3aioword;

    dimod=s3dimod;
    domod=s3domod;
    aiomod=(aioword)/2;

    modvalues();
    SlotType();
    break;

    case 4:
    diword=s4diword;
    doword=s4doword;
    aioword=s4aioword;

    dimod=s4dimod;
    domod=s4domod;
    aiomod=(aioword)/2;

    modvalues();
    SlotType();
    break;

    case 5:
    diword=s5diword;
    doword=s5doword;
    aioword=s5aioword;

    dimod=s5dimod;
    domod=s5domod;
    aiomod=(aioword)/2;

    modvalues();
    SlotType();
    break;

    case 6:
    diword=s6diword;
    doword=s6doword;
    aioword=s6aioword;

    dimod=s6dimod;
    domod=s6domod;
    aiomod=(aioword)/2;

    modvalues();
    SlotType();
    break;

    case 7:
    diword=s7diword;
    doword=s7doword;
    aioword=s7aioword;

    dimod=s7dimod;
    domod=s7domod;
    aiomod=(aioword)/2;

    modvalues();
    SlotType();
    break;

    case 8:
    diword=s8diword;
    doword=s8doword;
    aioword=s8aioword;

    dimod=s8dimod;
    domod=s8domod;
    aiomod=(aioword)/2;

    modvalues();
    SlotType();
    break;

    case 9:
    diword=s9diword;
    doword=s9doword;
    aioword=s9aioword;

    dimod=s9dimod;
    domod=s9domod;
    aiomod=(aioword)/2;

    modvalues();
    SlotType();
    break;

    case 10:
    diword=s10diword;
    doword=s10doword;
    aioword=s10aioword;

    dimod=s10dimod;
    domod=s10domod;
    aiomod=(aioword)/2;

    modvalues();
    SlotType();
    break;

    case 11:
    diword=s11diword;
    doword=s11doword;
    aioword=s11aioword;

    dimod=s11dimod;
    domod=s11domod;
    aiomod=(aioword)/2;

    modvalues();
    SlotType();
    break;

    case 12:
    diword=s12diword;
    doword=s12doword;
    aioword=s12aioword;

    dimod=s12dimod;
    domod=s12domod;
    aiomod=(aioword)/2;

    modvalues();
    SlotType();
    break;

    case 13:
    diword=s13diword;
    doword=s13doword;
    aioword=s13aioword;

    dimod=s13dimod;
    domod=s13domod;
    aiomod=(aioword)/2;

    modvalues();
    SlotType();
    break;

    case 14:
    diword=s14diword;
    doword=s14doword;
    aioword=s14aioword;

    dimod=s14dimod;
    domod=s14domod;
    aiomod=(aioword)/2;

    modvalues();
    SlotType();
    break;

    case 15:
    diword=s15diword;
    doword=s15doword;
    aioword=s15aioword;

    dimod=s15dimod;
    domod=s15domod;
    aiomod=(aioword)/2;

    modvalues();
    SlotType();
    break;

    case 16:
    diword=s16diword;
    doword=s16doword;
    aioword=s16aioword;

    dimod=s16dimod;
    domod=s16domod;
    aiomod=(aioword)/2;

    modvalues();
    SlotType();
    break;

    default:
    break;
    }

    Thankyou

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Switch case in Qvector object

    Everything is urgent... But you should take your time and post the "right" piece of code. The big one above is much useless since the question is what iobinvect[0].slotNo returns. As to the error message it is not an int. Make sure you return an integer or convert it to one.

Similar Threads

  1. Switch blue and red
    By bryan in forum Qt for Embedded and Mobile
    Replies: 2
    Last Post: 19th January 2010, 15:23
  2. Switch GUI language of Creator 1.3.0?!?
    By Tiansen in forum Qt Tools
    Replies: 5
    Last Post: 12th January 2010, 14:33
  3. Switch the focus between 2 widgets
    By franco.amato in forum Qt Programming
    Replies: 4
    Last Post: 15th December 2009, 00:05
  4. How to Switch the dialog Form
    By Smiler in forum Qt Programming
    Replies: 1
    Last Post: 28th August 2009, 11:36
  5. How to switch Qt4 version
    By vieraci in forum Installation and Deployment
    Replies: 1
    Last Post: 1st May 2007, 18:17

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.