current revision

This commit is contained in:
2016-09-28 12:16:45 +02:00
parent 075d8bb633
commit d47322e73b
90 changed files with 8228 additions and 606 deletions

View File

@@ -4,12 +4,13 @@
#include <QPushButton>
#include <QGridLayout>
#include <QLabel>
#include <Indoor/Assertions.h>
#include "../UIHelper.h"
MainMenu::MainMenu(QWidget* parent) : QWidget(parent) {
setMinimumHeight(64);
QGridLayout* lay = new QGridLayout(this);
int row = 0;
@@ -27,28 +28,50 @@ MainMenu::MainMenu(QWidget* parent) : QWidget(parent) {
Assert::isTrue(connect(btnCamera, &QPushButton::clicked, this, &MainMenu::onCameraButton), "connect() failed");
lay->addWidget(btnCamera, row, col, 1,1,Qt::AlignTop); ++col;
btnTransparent = getButton("cube");
btnTransparent = getButton("wall");
Assert::isTrue(connect(btnTransparent, &QPushButton::clicked, this, &MainMenu::onTransparentButton), "connect() failed");
lay->addWidget(btnTransparent, row, col, 1,1,Qt::AlignTop); ++col;
lay->addWidget(btnTransparent, row, col, 1,1,Qt::AlignTop); ++col;
btn3D = getButton("cube");
Assert::isTrue(connect(btn3D, &QPushButton::clicked, this, &MainMenu::on3DButton), "connect() failed");
lay->addWidget(btn3D, row, col, 1,1,Qt::AlignTop); ++col;
btnStart = getButton("run");
Assert::isTrue(connect(btnStart, &QPushButton::clicked, this, &MainMenu::onStartButton), "connect() failed");
lay->addWidget(btnStart, row, col, 1,1,Qt::AlignTop); ++col;
}
static inline void setButtonSize(QPushButton* btn, int size) {
const int border = 4;
btn->setMinimumHeight(size+border);
btn->setMaximumHeight(size+border);
btn->setMinimumWidth(size+border);
btn->setMaximumWidth(size+border);
}
void MainMenu::resizeEvent(QEvent* evt) {
const int s = UIHelper::getButtonSize(this->parent());
setButtonSize(btnLoadMap, s);
setButtonSize(btnDebug, s);
setButtonSize(btnCamera, s);
setButtonSize(btnTransparent, s);
setButtonSize(btnStart, s);
setButtonSize(btn3D, s);
}
QPushButton* MainMenu::getButton(const std::string& icon) {
const int size = 48;
const int border = 4;
const int size = UIHelper::getButtonSize(this->parent());
QPushButton* btn = new QPushButton(Icons::getIcon(icon, size), "");
btn->setIconSize(QSize(size,size));
btn->setMinimumHeight(size+border);
btn->setMaximumHeight(size+border);
btn->setMinimumWidth(size+border);
btn->setMaximumWidth(size+border);
setButtonSize(btn, size);
return btn;

View File

@@ -3,6 +3,7 @@
#include <QWidget>
class QLabel;
class QPushButton;
class MainMenu : public QWidget {
@@ -13,6 +14,10 @@ public:
/** ctor */
explicit MainMenu(QWidget* parent);
public slots:
void resizeEvent(QEvent*);
signals:
void onLoadButton();
@@ -20,6 +25,7 @@ signals:
void onDebugButton();
void onCameraButton();
void onTransparentButton();
void on3DButton();
private:
@@ -30,6 +36,8 @@ private:
QPushButton* btnDebug;
QPushButton* btnCamera;
QPushButton* btnTransparent;
QPushButton* btn3D;
QLabel* lblLog;
};