QElectroTech  0.70
gridlayoutanimation.cpp
Go to the documentation of this file.
1 /*
2  Copyright 2006-2019 The QElectroTech Team
3  This file is part of QElectroTech.
4 
5  QElectroTech is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 2 of the License, or
8  (at your option) any later version.
9 
10  QElectroTech is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #include "gridlayoutanimation.h"
19 
25 GridLayoutAnimation::GridLayoutAnimation(QGraphicsGridLayout *grid, QObject *parent) :
26  QVariantAnimation(parent),
27  grid_(grid)
28 {
29 }
30 
35 }
36 
40 QGraphicsGridLayout *GridLayoutAnimation::grid() {
41  return(grid_);
42 }
43 
47 void GridLayoutAnimation::setGrid(QGraphicsGridLayout *grid) {
48  grid_ = grid;
49 }
50 
55  return(index_);
56 }
57 
62  index_ = index;
63 }
64 
69  return(row_);
70 }
71 
76 void GridLayoutAnimation::setActsOnRows(bool acts_on_row) {
77  row_ = acts_on_row;
78 }
79 
83 void GridLayoutAnimation::updateCurrentValue(const QVariant &value) {
84  if (!grid_) return;
85  if (row_) {
86  grid_ -> setRowFixedHeight(index_, value.toReal());
87  } else {
88  grid_ -> setColumnFixedWidth(index_, value.toReal());
89  }
90 }
QGraphicsGridLayout * grid_
Grid this class will animate.
GridLayoutAnimation(QGraphicsGridLayout *=nullptr, QObject *=nullptr)
void setGrid(QGraphicsGridLayout *)
int index_
Index of the row/column to be animated.
bool row_
Whether we should animate a row or a column.
void updateCurrentValue(const QVariant &) override
QGraphicsGridLayout * grid()