Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- QGraphicsGridLayout *layout = new QGraphicsGridLayout(this->centralWidget());
- qDebug() << orientation;
- qDebug() << buttons.count();
- if (orientation == M::Landscape) {
- int row = 0;
- int column = 0;
- int maxColumns = 4;
- layout = new QGraphicsGridLayout();
- foreach (MButton *button, buttons) {
- layout->addItem(button, row, column);
- column++;
- if (column == maxColumns) {
- row ++;
- column = 0;
- }
- }
- } else {
- int row = 0;
- int column = 0;
- int maxColumns = 2;
- layout = new QGraphicsGridLayout();
- foreach (MButton *button, buttons) {
- layout->addItem(button, row, column);
- column++;
- if (column == maxColumns) {
- row ++;
- column = 0;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement