mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-19 20:19:13 +12:00
Add dark theme button
This commit is contained in:
parent
155d2b8f24
commit
837bf7524f
2 changed files with 43 additions and 1 deletions
|
@ -4,7 +4,41 @@ MainWindow::MainWindow(QApplication* app, QWidget* parent) : QMainWindow(parent)
|
|||
setWindowTitle("Alber");
|
||||
// Enable drop events for loading ROMs
|
||||
setAcceptDrops(true);
|
||||
|
||||
resize(320, 240);
|
||||
screen.show();
|
||||
|
||||
// Set our menu bar up
|
||||
menuBar = new QMenuBar(this);
|
||||
setMenuBar(menuBar);
|
||||
|
||||
auto pandaMenu = menuBar->addMenu(tr("PANDA"));
|
||||
auto pandaAction = pandaMenu->addAction(tr("panda..."));
|
||||
|
||||
auto themeButton = new QPushButton(tr("Dark theme"), this);
|
||||
themeButton->setGeometry(40, 40, 100, 400);
|
||||
themeButton->show();
|
||||
connect(themeButton, &QPushButton::pressed, this, [&]() { setDarkTheme(); });
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow() { delete menuBar; }
|
||||
|
||||
void MainWindow::setDarkTheme() {
|
||||
QApplication::setStyle(QStyleFactory::create("Fusion"));
|
||||
|
||||
QPalette p;
|
||||
p.setColor(QPalette::Window, QColor(53, 53, 53));
|
||||
p.setColor(QPalette::WindowText, Qt::white);
|
||||
p.setColor(QPalette::Base, QColor(25, 25, 25));
|
||||
p.setColor(QPalette::AlternateBase, QColor(53, 53, 53));
|
||||
p.setColor(QPalette::ToolTipBase, Qt::white);
|
||||
p.setColor(QPalette::ToolTipText, Qt::white);
|
||||
p.setColor(QPalette::Text, Qt::white);
|
||||
p.setColor(QPalette::Button, QColor(53, 53, 53));
|
||||
p.setColor(QPalette::ButtonText, Qt::white);
|
||||
p.setColor(QPalette::BrightText, Qt::red);
|
||||
p.setColor(QPalette::Link, QColor(42, 130, 218));
|
||||
|
||||
p.setColor(QPalette::Highlight, QColor(42, 130, 218));
|
||||
p.setColor(QPalette::HighlightedText, Qt::black);
|
||||
qApp->setPalette(p);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue