Results 1 to 5 of 5

Thread: QT enum array

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2011
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default QT enum array

    Hi everybody,

    How can I declare an array of shape in QPainter?

    In the header file, I have an enumerated shape. It works fine without making array. But now I want to have an array of size 10 of this enumerated shape. I could not successfully convert the shape to an array of size 10. Please help..

    Here are my code pieces:

    my header file

    Qt Code:
    1. enum Shape {Kare, Hexa, Rect};
    2. void setShape(Shape shape[10]);
    3. Shape shape[10];
    To copy to clipboard, switch view to plain text mode 

    my cpp file

    Qt Code:
    1. void RenderArea1::setShape(Shape shape[10])
    2. {
    3. for (int kat = 0; kat < 10; kat += 1) {
    4. this->shape[kat] = shape[kat];
    5. update();
    6. }
    7. }
    8.  
    9. for (int kat = 0; kat < 10; kat += 1) {
    10.  
    11. switch (shape[kat]) {
    12.  
    13. case Kare:
    14. ....
    15. case Hexa:
    16. ....
    17. case Rect:
    18. ....
    19. }
    20. }
    21.  
    22. RenderArea1::Shape shape[Window::kat] = renderArea1->Kare;
    23. renderArea1->setShape(shape[Window::kat]);
    24. renderArea1->update();
    To copy to clipboard, switch view to plain text mode 


    Thanks in advance..
    Last edited by wysota; 3rd April 2011 at 08:27. Reason: missing [code] tags

Similar Threads

  1. Replies: 2
    Last Post: 12th November 2010, 14:42
  2. How to export enum ?
    By Peppy in forum Qt Programming
    Replies: 1
    Last Post: 14th May 2010, 15:15
  3. declare an array of QSemaphore and array of slot functions
    By radeberger in forum Qt Programming
    Replies: 11
    Last Post: 2nd May 2010, 13:24
  4. enum property
    By illuzioner in forum Qt Tools
    Replies: 10
    Last Post: 22nd August 2006, 21:47
  5. enum scope
    By illuzioner in forum General Programming
    Replies: 1
    Last Post: 15th February 2006, 05:39

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.