Results 1 to 2 of 2

Thread: Grid Layout problem

  1. #1
    Join Date
    Apr 2009
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Grid Layout problem

    Hi,

    I am writing a simple calendar app and am facing a few problems in creating my layout. This is the basic layout I created :

    Qt Code:
    1. QWidget *centralWidget = new QWidget;
    2. QPushButton* next = new QPushButton;
    3. QPushButton* previous = new QPushButton;
    4.  
    5. calendar->setStyleSheet("border-radius:20px;background-color:#ffffff");
    6.  
    7. QGridLayout *layout = new QGridLayout;
    8.  
    9. layout->addWidget(calendar,0,0);
    10. layout->addWidget(next,1,0);
    11. layout->addWidget(previous,1,1);
    12.  
    13. centralWidget->setLayout(layout);
    14. setCentralWidget(centralWidget);
    To copy to clipboard, switch view to plain text mode 


    I have uploaded the image . The calendar widget is actually a QTableWidget . how do I get it centered and of a fixed size ?
    Attached Images Attached Images

  2. #2
    Join Date
    Jan 2006
    Location
    Knivsta, Sweden
    Posts
    153
    Thanks
    30
    Thanked 13 Times in 12 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: Grid Layout problem

    QGridLayout::addWidget() takes an optional alignment parameter.

Similar Threads

  1. How Coulld I create a Grid Layout on a QGraphicsScene
    By c_srikanth1984 in forum Qt Programming
    Replies: 3
    Last Post: 12th January 2009, 11:18
  2. Problem in layout spacing
    By mails.hemant in forum Qt Tools
    Replies: 15
    Last Post: 24th November 2008, 12:48
  3. Layout Problem
    By sabonis in forum Qt Tools
    Replies: 4
    Last Post: 3rd March 2008, 21:57
  4. QT4 layout of complex dialog is very slow
    By cboles in forum Qt Programming
    Replies: 15
    Last Post: 28th April 2006, 20:57
  5. Layout Problem
    By Seema Rao in forum Qt Programming
    Replies: 4
    Last Post: 19th April 2006, 12:08

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.