Add css on widget inside an other one
-
wrote on 10 Jan 2024, 13:35 last edited by
Hi
I ve a Widget A which contains 4 QPushButtons and i add this widget on a other one B. When i had some css on A for buttons, css desepear on B. I don't know why
Thanks
Marius
-
Hi
I ve a Widget A which contains 4 QPushButtons and i add this widget on a other one B. When i had some css on A for buttons, css desepear on B. I don't know why
Thanks
Marius
@marius-thorre said in Add css on widget inside an other one:
When i had some css on A for buttons
Please show how you do this
-
wrote on 10 Jan 2024, 13:49 last edited by
ok that s it
#include "imagedit.h"
#include "ui_imagedit.h"ImagEdit::ImagEdit(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::ImagEdit)
{
ui->setupUi(this);//Instance editionarea = new EditionArea(); libraryarea = new LibraryArea(); settingarea = new SettingArea(); toolboxarea = new ToolboxArea(); settingarea->setStyleSheet("background-color: red");
}
ImagEdit::~ImagEdit()
{
delete ui;
}and one of them:
#include "settingarea.h"
#include "ui_settingarea.h"SettingArea::SettingArea(QWidget *parent)
: QWidget(parent)
, ui(new Ui::SettingArea)
{
ui->setupUi(this);
}SettingArea::~SettingArea()
{
delete ui;
}i see buttons but whithout color
-
ok that s it
#include "imagedit.h"
#include "ui_imagedit.h"ImagEdit::ImagEdit(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::ImagEdit)
{
ui->setupUi(this);//Instance editionarea = new EditionArea(); libraryarea = new LibraryArea(); settingarea = new SettingArea(); toolboxarea = new ToolboxArea(); settingarea->setStyleSheet("background-color: red");
}
ImagEdit::~ImagEdit()
{
delete ui;
}and one of them:
#include "settingarea.h"
#include "ui_settingarea.h"SettingArea::SettingArea(QWidget *parent)
: QWidget(parent)
, ui(new Ui::SettingArea)
{
ui->setupUi(this);
}SettingArea::~SettingArea()
{
delete ui;
}i see buttons but whithout color
@marius-thorre said in Add css on widget inside an other one:
settingarea->setStyleSheet("background-color: red");
What is settingarea and why it does not have a parent? Without setting "this" as parent it is not part of ImagEdit.
-
wrote on 10 Jan 2024, 14:02 last edited by
parent is QWidget. I had it on cpp file
-
wrote on 10 Jan 2024, 14:14 last edited by
settingArea is a form that i ve created and i want to add it in an other form with css setting too
-
parent is QWidget. I had it on cpp file
Lifetime Qt Championwrote on 10 Jan 2024, 15:28 last edited by jsulm 1 Oct 2024, 15:28@marius-thorre said in Add css on widget inside an other one:
parent is QWidget. I had it on cpp file
Where? In the code you posted you do not set parent:
settingarea = new SettingArea("WHERE IS THE PARENT?");
-
@marius-thorre said in Add css on widget inside an other one:
parent is QWidget. I had it on cpp file
Where? In the code you posted you do not set parent:
settingarea = new SettingArea("WHERE IS THE PARENT?");
wrote on 10 Jan 2024, 15:37 last edited by@jsulm it was that ... sorry i m beginner in C++ et Qt and sometime do some mistakes, thanks a lot for your help
-
@jsulm it was that ... sorry i m beginner in C++ et Qt and sometime do some mistakes, thanks a lot for your help
wrote on 10 Jan 2024, 16:57 last edited by@marius-thorre
Please mark the topic as "solved" if you dont have further questions and your issue got resolved.
-
1/9