QPalette palette;
Palette.setColor(QPalette::window,QColor(255,150,30));
this->setPalette(palette)
你可以用 qss 专门为 MainWindow 设置 ,或者专门为工具栏设置
QMainWindow #MainWindow
{
background-color: rgb(xx,xx,xx)
}
不知道你这个问题是否已经解决, 如果还没有解决的话://运动控制器 单例模式
#define SAFE_DELETE_ELEMENT( ptr ) if(ptr != NULL){delete ptr; ptr = NULL;}
class MoveController : public QObject
{
Q_OBJECT
static QMutex mutex;
static Wheel* wheel1;
static Wheel* wheel2;
static MoveController* instance;
public:
~MoveController(){
SAFE_DELETE_ELEMENT(instance)
}
static MoveController* getInstance(){
QMutexLocker locker(&mutex);
if(instance == NULL)
instance = new MoveController();
return instance;
}
public:
static bool init();
static Wheel* getWheel1(){
return wheel1;
}
static Wheel* getWheel2(){
return wheel2;
}
private:
MoveController(){}
signals:
void mySignal(QString);
private slots:
void mySlot(QString);
};