Results 1 to 9 of 9

Thread: Creating an Array of Button

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #5
    Join Date
    Apr 2011
    Posts
    25
    Qt products
    Qt/Embedded
    Platforms
    Symbian S60

    Default Re: Creating an Array of Button

    hello squidge

    yeh u r right..its working now by using grid layout..now hw can i decrease the space between each rows..moreever hw can i add textBrowser below..after all buttons are arranged in rows and colums..

    my code is:u plz check it..
    Qt Code:
    1. QWidget *centralWidget = new QWidget;
    2. selectedDate=QDate::currentDate();
    3. int count=1,i,j;
    4.  
    5. QPushButton *button[10][10];
    6. QGridLayout *controlsLayout = new QGridLayout;
    7. [B]QTextBrowser *T=new QTextBrowser() //how can i add this text browser below after all the array of buttons are set[/B]
    8. for(i=0;i<7;i++)
    9. {
    10.  
    11. for(j=0;j<7;j++)
    12. {
    13.  
    14.  
    15. if(count<=42)
    16. {
    17.  
    18. button[i][j] = new QPushButton(QString::number(count));
    19.  
    20. button[i][j]->resize(40,40);
    21.  
    22. button[i][j]->move(40*j, 40*i);
    23.  
    24. button[i][j]->show();
    25.  
    26. controlsLayout->addWidget(button[i][j],i,j);
    27.  
    28.  
    29.  
    30. controlsLayout->setSpacing(0);
    31.  
    32. centralWidget->setLayout(controlsLayout);
    33.  
    34. setCentralWidget(centralWidget);
    35.  
    36. count++;
    37. }
    38.  
    39. }
    40.  
    41.  
    42. }
    To copy to clipboard, switch view to plain text mode 



    with regards
    Anshuman
    Last edited by high_flyer; 21st April 2011 at 15:04. Reason: code tags

Similar Threads

  1. Array of button for creating custom calender
    By anshumanBorah in forum Qt Programming
    Replies: 1
    Last Post: 12th April 2011, 13:21
  2. Creating a style for a button
    By Luc4 in forum Qt Programming
    Replies: 2
    Last Post: 23rd April 2010, 13:16
  3. Creating a button programmatically
    By Luc4 in forum Newbie
    Replies: 1
    Last Post: 27th January 2010, 10:30
  4. Creating a Pixmap out of an array of data
    By toratora in forum Qt Programming
    Replies: 2
    Last Post: 5th June 2007, 19:00
  5. Creating a global array in my code???
    By therealjag in forum General Programming
    Replies: 5
    Last Post: 13th March 2006, 11:13

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.