void MainWindow::toggleTheme() { Wt::WApplication* app = Wt::WApplication::instance(); // Get the Wt::WApplication intstance for our thread std::string oldTheme = app->cssTheme(); std::string newTheme = oldTheme == "default" ? "polished" : "default"; app->setCssTheme(newTheme); // Toggle the theme between 'default' and 'polished' _btnToggleTheme->setText("Change to " + oldTheme); // Make the client reload the css app->doJavaScript(app->javaScriptClass() + ".updateStyles()"); }