I want to overlay my QFrame(Draw several lines) onto a QGridLayout, to show some lines connecting some grids on the layout. But I can't find my lines with following code.
QHBoxLayout *basicLayout = new QHBoxLayout(parent);
QVBoxLayout *mapLayout = new QVBoxLayout(); // Grid Map
rightBarLayout = new QVBoxLayout(); // Game status bar
layout = new QGridLayout();
lines = new lineMask(); // A mask overlaying grid to draw lines
layout->addWidget(lines, 0, 0, -1, -1,
Qt::AlignRight);
mapLayout->addLayout(layout);
basicLayout->addLayout(mapLayout);
basicLayout->addLayout(rightBarLayout);
basicLayout->addWidget(lines);
And in lines:
class lineMask: public QFrame
{
private:
QVector<QVector<QLine>> lineGroup;
void paintEvent(QPaintEvent *) override;
QVector<bool> seen;
unsigned int num;
public:
lineMask();
int addLines(QVector<QLine> &);
void removeLines(int idx);
};