Advertisement
Guest User

Untitled

a guest
Sep 9th, 2011
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.91 KB | None | 0 0
  1.     QGraphicsGridLayout *layout = new QGraphicsGridLayout(this->centralWidget());
  2.     qDebug() << orientation;
  3.     qDebug() << buttons.count();
  4.     if (orientation == M::Landscape) {
  5.         int row = 0;
  6.         int column = 0;
  7.         int maxColumns = 4;
  8.         layout = new QGraphicsGridLayout();
  9.         foreach (MButton *button, buttons) {
  10.             layout->addItem(button, row, column);
  11.             column++;
  12.  
  13.             if (column == maxColumns) {
  14.                 row ++;
  15.                 column = 0;
  16.             }
  17.         }
  18.     } else {
  19.         int row = 0;
  20.         int column = 0;
  21.         int maxColumns = 2;
  22.         layout = new QGraphicsGridLayout();
  23.         foreach (MButton *button, buttons) {
  24.             layout->addItem(button, row, column);
  25.             column++;
  26.  
  27.             if (column == maxColumns) {
  28.                 row ++;
  29.                 column = 0;
  30.             }
  31.         }
  32.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement