I made an own GridPushButton class to store the buttons position in gridlayout. The parent is QPushButton
. I have a problem with asking it's x and y coordinates in window (like x:654, y:768). I thought it will be inherited from base class, but it doesn't. Now i have two options:
Use the original
QPushButton
class and somehow get its position in gridlayout (like x:0, y:1 if it's in the first row and second column) orUse my GridPushButton and somehow get the x and y coordinate in window.
class GridPushButton : public QPushButton { Q_OBJECT public: GridPushButton(int coordX, int coordY, QWidget *parent = 0); int coordinateX() { return _coordX; } int coordinateY() { return _coordY; } protected: int _coordX; int _coordY; };
This is my class. I tried to make a new private variable and give it the QPushButton::x()
, but doesn't work. Any idea to get the x and y coordinate from parent?
Or any idea to get the QPushButtons
position in GridLayout?