Simple and silly question about QWidget
I have default application CTest based on QMainWindow.
If I add Qt class dirive from QWidget , do I have to add also UI file for that class ????????????
//Code Not working CTest inherite QWidget
Code:
#include "test3.h"
#include <QWidget>
#include "CTest.h"
test3
::test3(QWidget *parent, Qt
::WFlags flags
){
ui.setupUi(this);
m_pT = new CTest(ui.centralWidget);
m_pT->setStyleSheet("QWidget { background-color: blue; }");
}
Code:
//Code working
#include "test3.h"
#include <QWidget>
test3
::test3(QWidget *parent, Qt
::WFlags flags
) {
ui.setupUi(this);
pT->setStyleSheet("QWidget { background-color: blue; }");
}
Re: Simple and silly question about QWidget
Just post the code please, its easy to misunderstand your explanation.
Re: Simple and silly question about QWidget
If you reimplemented the paintEvent for the CTest class then stylesheets won't work, they only work with default widgets as the drawing goes through the style then. Instead of stylesheets you can always use QPalette.
Re: Simple and silly question about QWidget
I didn't reimplemented anything , I just added new class to project that derive QWidget , with no more extra code lines.