4

I start my application initially in a dark color theme according to this example.

I would like to make possible for users, to switch back to their current default system color profiles of their operating system (as I start that application without setting QPalette). Is that posssible?

4

1 回答 1

11

一种可能的方法是使用默认设置和参数:

void MainWindow::on_pushButton_clicked()
{
    qApp->setPalette(this->style()->standardPalette());
    qApp->setStyle(QStyleFactory::create("WindowsVista"));
    qApp->setStyleSheet("");
}

但是这种方式有一些限制:我们需要一些QWidget来设置调色板,以我的方式我使用thispoiter to QMainWindow,但我认为这不是那么严重的问题。

于 2015-08-06T08:05:46.370 回答