It seems you almost did that but constructor for you dialog should be like this. In my application, my mainwindow.ui background is black, and when i open a QColorDialog, it inherits the same background color. then it should have a blank UI file just like mainwindow and you can just add. QString styleSheet = QLatin1String(file. New ->Qt->Form designer Class->Dialog Without buttons. QPushButton* pButton = new QPushButton("Test", pWindow) QVBoxLayout* pLayout = new QVBoxLayout(pWindow) On my Mac, my whole application window is black (except the title bar).ĮDIT : according to comment, here is a solution without using ui files and loading an external style sheet #include This->setStyleSheet("background-color: black ") The method is as follows: The first step is to click the setting button of. ui->tableWidgetAlertList->currentItem()->backgroundColor() QColorDialog palette. The style sheet file (default.I would simply use a Style Sheet for the whole window.įor instance, if your window is inheriting from QWidget, here is what I'm doing : MainWindow::MainWindow(QWidget *parent) : QWidget(parent), ui(new Ui::MainWindow) Method 1The easiest way is to set it directly in the UI properties window. setCurrentColor(mbgColor) if(dialog.exec()QDialog::Accepted). QString styleSheet = QLatin1String(file.readAll()) I would simply use a Style Sheet for the whole window.įor instance, if your window is inheriting from QWidget, here is what I'm doing : MainWindow::MainWindow(QWidget *parent) : QWidget(parent), ui(new Ui::MainWindow)
0 Comments
Leave a Reply. |