Results 1 to 2 of 2

Thread: QLabel array

  1. #1
    Join Date
    Jul 2007
    Posts
    166
    Thanks
    25
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QLabel array

    Hi,
    I have a QLabel array in my program. I declare it like this.
    QLabel *pixmapLabels [5] [2];
    How can I increase the size of that array at runtime?

    my code is like this
    Qt Code:
    1. int NumStates_New = files.size()/2;
    2.  
    3. if ( files.size()%2 >0 ) NumStates_New++;
    4.  
    5. QLabel *pixmapLabels [ NumStates_New ] [2];
    To copy to clipboard, switch view to plain text mode 

    it is working in Linux. But in windows it display error like this

    error C2057: expected constant expression
    error C2466: cannot allocate an array of constant size 0
    error C2133: 'pixmapLabels' : unknown size
    Please help me to solve this
    Last edited by jpn; 27th December 2007 at 12:40. Reason: missing [code] tags

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QLabel array

    See Generic Containers and QVarLengthArray.

    PS. Could you wrap code blocks inside [code]-tags, thank you.

    [code]
    // code here
    [/code]
    J-P Nurmi

Similar Threads

  1. QLabel size policy
    By Caius Aérobus in forum Qt Programming
    Replies: 3
    Last Post: 7th December 2007, 17:57
  2. Problem in converting QString to QChar array?
    By KaKa in forum Qt Programming
    Replies: 2
    Last Post: 19th March 2007, 00:38
  3. QScrollArea display custom QLabel
    By spawnwj in forum Qt Programming
    Replies: 6
    Last Post: 6th December 2006, 03:38
  4. How to create QPixmap from unsigned character array?
    By rashidbutt in forum Qt Programming
    Replies: 4
    Last Post: 16th May 2006, 18:25
  5. QSettings again ... how to remove array elements
    By Mike in forum Qt Programming
    Replies: 4
    Last Post: 11th January 2006, 08:58

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
  •  
Qt is a trademark of The Qt Company.