Results 1 to 3 of 3

Thread: QPushButton size problem

  1. #1
    Join Date
    Oct 2011
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default QPushButton size problem

    I am trying to make my icon pictures be there original size. I am unsure how to do it. Any help that can provided is appreciated.

    Qt Code:
    1. iconArea::iconArea(QWidget *parent)
    2.  
    3. {
    4. QGridLayout *mainLayout = new QGridLayout;
    5. setLayout(mainLayout);
    6.  
    7. QPushButton *button1 = new QPushButton;
    8. button1->setIcon(QIcon("light.png"));
    9.  
    10. QPushButton *button2 = new QPushButton;
    11. button2->setIcon(QIcon("cloud.png"));
    12.  
    13. QPushButton *button3 = new QPushButton;
    14. button3->setIcon(QIcon("Control.gif"));
    15.  
    16. QPushButton *button4 = new QPushButton;
    17. button4->setIcon(QIcon("images.jpg"));
    18.  
    19. QPushButton *button5 = new QPushButton;
    20. button4->setIcon(QIcon("upgrade.png"));
    21.  
    22. QPushButton *button6 = new QPushButton;
    23. button4->setIcon(QIcon("power.gif"));
    24.  
    25. mainLayout->addWidget(button1, 0,0);
    26. mainLayout->addWidget(button2, 0,1);
    27. mainLayout->addWidget(button3, 1,0);
    28. mainLayout->addWidget(button4, 1,1);
    29. mainLayout->addWidget(button5, 2,0);
    30. mainLayout->addWidget(button6, 2,1);
    31.  
    32. }
    To copy to clipboard, switch view to plain text mode 
    Attached Images Attached Images

  2. #2
    Join Date
    Aug 2011
    Posts
    44
    Thanked 13 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows Symbian S60

    Default Re: QPushButton size problem

    Did you try setIconSize method?

  3. #3
    Join Date
    Oct 2011
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QPushButton size problem

    That worked perfectly thank you

Similar Threads

  1. How get max size text in a QPushButton (Qt embedded linux 4.3.0)
    By Gerard in forum Qt for Embedded and Mobile
    Replies: 4
    Last Post: 27th July 2011, 10:31
  2. QPushButton dynamic size
    By cutie.monkey in forum Qt Programming
    Replies: 1
    Last Post: 29th April 2010, 09:37
  3. size of QPushButton
    By eleanor in forum Qt Programming
    Replies: 3
    Last Post: 4th May 2009, 17:21
  4. QPixmap in QPushButton size problem
    By MarkoSan in forum Qt Programming
    Replies: 3
    Last Post: 22nd January 2008, 12:50
  5. QPushbutton problem
    By amulya in forum Qt Programming
    Replies: 5
    Last Post: 30th August 2006, 08:11

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.