Results 1 to 4 of 4

Thread: Dynamic QLabels

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2007
    Location
    India/Bangalore
    Posts
    156
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Thumbs up Re: Dynamic QLabels

    Thank you for you reply . i have achieved dynamic adding , how to remove dynamically?
    Thanks,
    Rajesh.S

  2. #2
    Join Date
    Jun 2007
    Location
    India/Bangalore
    Posts
    156
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Thumbs up Re: Dynamic QLabels

    Now i got Solution ,

    I used the folowing code ,

    Every time when user gives some input and clicks some button, in button click,

    Qt Code:
    1. for(int i=0;i<listLabel->count();i++)
    2. {
    3. delete listLabel->at(i);
    4. }
    5.  
    6. listLabel->clear();
    7. for(int i = 0;i<lineEdit->text().toInt();i++)
    8. {
    9. QLabel* l = new QLabel("Hello"+QString::number(i));
    10. layout->addWidget(l,0,i);
    11. listLabel->append(l);
    12. }
    To copy to clipboard, switch view to plain text mode 
    Here listLabel is the QList<QLabel*> ,layout is QGridLayout applied to QFrame. I have the following code in Constructor

    Qt Code:
    1. setupUi(this);
    2.  
    3. layout = new QGridLayout(frame);
    4.  
    5. listLabel = new QList<QLabel*>();
    6.  
    7. connect(pushButton,SIGNAL(pressed()),this,SLOT(add()));
    To copy to clipboard, switch view to plain text mode 

    Thank you for ur Guidence.
    Last edited by jpn; 30th May 2008 at 11:28. Reason: missing [code] tags
    Thanks,
    Rajesh.S

Similar Threads

  1. Dynamic number of QLabel
    By jd in forum Qt Programming
    Replies: 2
    Last Post: 4th April 2008, 17:09
  2. Static vs. Dynamic Building for GPL Open Source Software Release
    By brent99 in forum Installation and Deployment
    Replies: 6
    Last Post: 11th March 2008, 20:46
  3. Rezizing the Qlabels vertically
    By anju123 in forum Qt Programming
    Replies: 3
    Last Post: 3rd January 2008, 15:35
  4. Table made from QLabels
    By T4ng10r in forum Qt Programming
    Replies: 1
    Last Post: 25th April 2007, 06:58
  5. Dynamic grid layout
    By eriwik in forum Qt Programming
    Replies: 1
    Last Post: 12th June 2006, 15:19

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