Hi All
I have a question ,If you answer this ,i will be very appreciate.
I want to use 5 pushbuttons on my frame with special shape (circular) by promoting . But the question is i want these button same shape but different colour. Have may i paint these buttons with different colour?I have prepared a class which is indicated in buton.h file and "paintEvent" is written in buton.cpp file. I promoted my buttons in designer by right click and "promote" -> "Buton.h". the problem is I have 5 buttons but 1 class and 1 paintEvent function. How may i paint may buttons with different colour,by using same paint event? Do i have to indicate different classes for every button?
"buton.h file"
#ifndef BUTON_H
#define BUTON_H
#include <QPushButton>
{
Q_OBJECT
public:
protected:
};
#endif
#ifndef BUTON_H
#define BUTON_H
#include <QPushButton>
class buton : public QPushButton
{
Q_OBJECT
public:
buton(QWidget *event);
protected:
void paintEvent(QWidget *pe);
};
#endif
To copy to clipboard, switch view to plain text mode
"buton.cpp file"
#include "buton.h"
{
}
void buton
::paintEvent(QWidget *pe
) {
//May I use this place for different 5 buttons?
}
#include "buton.h"
buton::buton(QWidget *parent=0)
: QPushButton(parent)
{
}
void buton::paintEvent(QWidget *pe)
{
//May I use this place for different 5 buttons?
}
To copy to clipboard, switch view to plain text mode
Bookmarks