Skip to content
Snippets Groups Projects
Commit 9b61c781 authored by Nils Jonathan Friedrich Eckardt's avatar Nils Jonathan Friedrich Eckardt
Browse files

TopBar Layout Fix

parent 562e6a00
No related branches found
No related tags found
2 merge requests!38Merge the level editor,!29Merge main into box2d to implement physics
......@@ -48,10 +48,10 @@ QPixmap SpriteProvider::load_pixmap(std::vector<std::vector<std::vector<uint32_t
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
uint32_t color = pixels[index][height - 1 - y][x];
uint32_t r = (color >> 24) & 0xFF; // Most significant byte //uint8_t sollte reichen
uint32_t g = (color >> 16) & 0xFF; // Second byte //uint8_t sollte reichen
uint32_t b = (color >> 8) & 0xFF; // Third byte //uint8_t sollte reichen
uint32_t a = color & 0xFF; // Least significant byte //uint8_t sollte reichen
uint8_t r = (color >> 24) & 0xFF; // Most significant byte //uint8_t sollte reichen
uint8_t g = (color >> 16) & 0xFF; // Second byte //uint8_t sollte reichen
uint8_t b = (color >> 8) & 0xFF; // Third byte //uint8_t sollte reichen
uint8_t a = color & 0xFF; // Least significant byte //uint8_t sollte reichen
image.setPixel(x, y, qRgba(r, g, b, a));
}
}
......
......@@ -9,35 +9,27 @@
TopBar::TopBar(const std::string& level_name, int level_width, int level_height, QWidget *parent) : QToolBar(parent) {
QWidget *container = new QWidget(this);
QHBoxLayout *main_layout = new QHBoxLayout(container);
QWidget *left_container = new QWidget(container);
QWidget *middle_container = new QWidget(container);
QWidget *right_container = new QWidget(container);
QWidget *full_right_container = new QWidget(container);
QHBoxLayout* left_layout = new QHBoxLayout(left_container);
QHBoxLayout* middle_layout = new QHBoxLayout(middle_container);
QHBoxLayout* right_layout = new QHBoxLayout(right_container);
QHBoxLayout* full_right_layout = new QHBoxLayout(full_right_container);
QLabel *field_label = new QLabel("Name: ", left_container);
LevelNameEdit *text_field = new LevelNameEdit(level_name, left_container);
QHBoxLayout* left_layout = new QHBoxLayout(container);
QHBoxLayout* middle_layout = new QHBoxLayout(container);
QHBoxLayout* right_layout = new QHBoxLayout(container);
QLabel *field_label = new QLabel("Name: ", left_layout);
LevelNameEdit *text_field = new LevelNameEdit(level_name, left_layout);
left_layout->addWidget(field_label);
left_layout->addWidget(text_field);
left_layout->addStretch();
LevelTitle* title = new LevelTitle(level_width, level_height, level_name, middle_container);
LevelTitle* title = new LevelTitle(level_width, level_height, level_name, middle_layout);
middle_layout->addStretch();
middle_layout->addWidget(title);
middle_layout->addStretch();
QPushButton *save_button = new SaveButton("Speichern", right_layout);
right_layout->addStretch();
right_layout->addWidget(save_button);
QPushButton *save_button = new SaveButton("Speichern", right_container);
full_right_layout->addStretch();
full_right_layout->addWidget(save_button);
full_right_container->setFixedWidth(300);
main_layout->addWidget(left_container, 1);
main_layout->addWidget(middle_container, 1);
main_layout->addWidget(right_container, 1);
main_layout->addWidget(full_right_container);
main_layout->addLayout(left_layout, 1);
main_layout->addLayout(middle_layout, 1);
main_layout->addLayout(right_layout, 1);
this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); // Allow resizing
this->addWidget(container);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment