Hello world! First commit.
This commit is contained in:
commit
263c65ac46
2435 changed files with 30491 additions and 0 deletions
103
mainwindow.cpp
Normal file
103
mainwindow.cpp
Normal file
|
@ -0,0 +1,103 @@
|
|||
#include "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
#include "assetlist.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QBitmap>
|
||||
#include <QComboBox>
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::MainWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
/*connect( comboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), [=](int index){
|
||||
ui->stackedWidget_2->setCurrentIndex(index);
|
||||
});
|
||||
|
||||
const int currentIndex = 0;
|
||||
comboBox->setCurrentIndex(currentIndex);
|
||||
ui->stackedWidget_2->setCurrentIndex(currentIndex);*/
|
||||
|
||||
/*const auto pOutputDock = new OutputDock();
|
||||
pOutputDock->setMinimumHeight(50);
|
||||
this->addDockWidget(Qt::BottomDockWidgetArea, pOutputDock->GetDock());
|
||||
pOutputDock->setMinimumHeight(0);*/
|
||||
|
||||
const auto pDefineList = new AssetList();
|
||||
pDefineList->setMinimumWidth(150);
|
||||
this->addDockWidget(Qt::LeftDockWidgetArea, pDefineList);
|
||||
pDefineList->setMinimumHeight(0);
|
||||
pDefineList->setWindowTitle("Define");
|
||||
|
||||
const auto pDeclareList = new AssetList();
|
||||
pDeclareList->setMinimumWidth(150);
|
||||
this->addDockWidget(Qt::LeftDockWidgetArea, pDeclareList);
|
||||
pDeclareList->setMinimumHeight(0);
|
||||
pDeclareList->setWindowTitle("Declare");
|
||||
|
||||
QMainWindow::tabifyDockWidget(pDefineList, pDeclareList);
|
||||
|
||||
connect( ui->actionToggleDark, &QAction::triggered, [=](bool checked){
|
||||
if( checked ) {
|
||||
EnableThemeDark();
|
||||
} else {
|
||||
EnableThemeLight();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void MainWindow::EnableThemeDark()
|
||||
{
|
||||
ui->actionToggleDark->setIcon(QIcon(":/icons/data/icons/alexandru.stoica/sun_star [#1268].svg"));
|
||||
|
||||
QFile file(":/css/data/css/style.qss");
|
||||
file.open(QFile::ReadOnly);
|
||||
QTextStream ts(&file);
|
||||
qApp->setStyleSheet(ts.readAll());
|
||||
|
||||
auto& children = this->children();
|
||||
for( auto& child : children )
|
||||
{
|
||||
QAction* action = qobject_cast<QAction*>(child);
|
||||
if( action )
|
||||
{
|
||||
auto icon = action->icon();
|
||||
auto pixmap = icon.pixmap(icon.actualSize(QSize(32,32)));
|
||||
const auto& mask = pixmap.createMaskFromColor(QColor("transparent"), Qt::MaskInColor);
|
||||
pixmap.fill(QColor("white"));
|
||||
pixmap.setMask(mask);
|
||||
action->setIcon(QIcon(pixmap));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::EnableThemeLight()
|
||||
{
|
||||
ui->actionToggleDark->setIcon(QIcon(":/icons/data/icons/alexandru.stoica/moon [#1248].svg"));
|
||||
|
||||
qApp->setStyleSheet("");
|
||||
|
||||
auto& children = this->children();
|
||||
for( auto& child : children )
|
||||
{
|
||||
QAction* action = qobject_cast<QAction*>(child);
|
||||
if( action )
|
||||
{
|
||||
auto icon = action->icon();
|
||||
auto pixmap = icon.pixmap(icon.actualSize(QSize(32,32)));
|
||||
const auto& mask = pixmap.createMaskFromColor(QColor("transparent"), Qt::MaskInColor);
|
||||
pixmap.fill(QColor("black"));
|
||||
pixmap.setMask(mask);
|
||||
action->setIcon(QIcon(pixmap));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
delete ui;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue