I tried to make this class
{
Q_OBJECT
public:
explicit ColorButton() {return;}
explicit ColorButton
(QWidget *parent,
int x,
int y,
int alto,
int ancho
);
//Define the button with parent, position, width and height QColor Color
() {return Colore;
} //return the actual color void setColor
(QColor color
);
//Define the color of the button ~ColorButton();
private:
};
class ColorButton : public QAbstractButton
{
Q_OBJECT
public:
explicit ColorButton() {return;}
explicit ColorButton(QWidget *parent,int x, int y, int alto, int ancho); //Define the button with parent, position, width and height
QColor Color() {return Colore;} //return the actual color
void setColor(QColor color); //Define the color of the button
~ColorButton();
private:
QPixmap *Col;
QColor Colore;
QLabel *Show;
};
To copy to clipboard, switch view to plain text mode
After i tried use this class with:
1 QVector<ColorButton> Button(32);
2 for (i =0; i< 4;i++)
3 {
4 for (int j = 0; j < 8;j++)
5 Button[i] = ColorButton(this,x+(i*21),y+(j*21),21,21); //intent for define each button
}
1 QVector<ColorButton> Button(32);
2 for (i =0; i< 4;i++)
3 {
4 for (int j = 0; j < 8;j++)
5 Button[i] = ColorButton(this,x+(i*21),y+(j*21),21,21); //intent for define each button
}
To copy to clipboard, switch view to plain text mode
But gcc say:
cannot allocate and object of type 'ColorButton' in the line 5
because the following virtual functions are abstracts
then how make the class type abstractsbuttons to create a new button?
Sorry for my bad english
Bookmarks