Skip to content
Snippets Groups Projects
Commit c6872e30 authored by TheUltimateOptimist's avatar TheUltimateOptimist
Browse files

Revert "TopBar Layout Fix"

This reverts commit 9b61c781.
parent 9b61c781
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 ...@@ -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 y = 0; y < height; y++) {
for (int x = 0; x < width; x++) { for (int x = 0; x < width; x++) {
uint32_t color = pixels[index][height - 1 - y][x]; uint32_t color = pixels[index][height - 1 - y][x];
uint8_t r = (color >> 24) & 0xFF; // Most significant byte //uint8_t sollte reichen uint32_t r = (color >> 24) & 0xFF; // Most significant byte //uint8_t sollte reichen
uint8_t g = (color >> 16) & 0xFF; // Second byte //uint8_t sollte reichen uint32_t g = (color >> 16) & 0xFF; // Second byte //uint8_t sollte reichen
uint8_t b = (color >> 8) & 0xFF; // Third byte //uint8_t sollte reichen uint32_t b = (color >> 8) & 0xFF; // Third byte //uint8_t sollte reichen
uint8_t a = color & 0xFF; // Least significant byte //uint8_t sollte reichen uint32_t a = color & 0xFF; // Least significant byte //uint8_t sollte reichen
image.setPixel(x, y, qRgba(r, g, b, a)); image.setPixel(x, y, qRgba(r, g, b, a));
} }
} }
......
...@@ -9,27 +9,35 @@ ...@@ -9,27 +9,35 @@
TopBar::TopBar(const std::string& level_name, int level_width, int level_height, QWidget *parent) : QToolBar(parent) { TopBar::TopBar(const std::string& level_name, int level_width, int level_height, QWidget *parent) : QToolBar(parent) {
QWidget *container = new QWidget(this); QWidget *container = new QWidget(this);
QHBoxLayout *main_layout = new QHBoxLayout(container); 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);
QHBoxLayout* left_layout = new QHBoxLayout(container); QLabel *field_label = new QLabel("Name: ", left_container);
QHBoxLayout* middle_layout = new QHBoxLayout(container); LevelNameEdit *text_field = new LevelNameEdit(level_name, left_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(field_label);
left_layout->addWidget(text_field); left_layout->addWidget(text_field);
left_layout->addStretch(); left_layout->addStretch();
LevelTitle* title = new LevelTitle(level_width, level_height, level_name, middle_layout);
LevelTitle* title = new LevelTitle(level_width, level_height, level_name, middle_container);
middle_layout->addStretch(); middle_layout->addStretch();
middle_layout->addWidget(title); middle_layout->addWidget(title);
middle_layout->addStretch(); middle_layout->addStretch();
QPushButton *save_button = new SaveButton("Speichern", right_layout);
right_layout->addStretch();
right_layout->addWidget(save_button);
main_layout->addLayout(left_layout, 1); QPushButton *save_button = new SaveButton("Speichern", right_container);
main_layout->addLayout(middle_layout, 1); full_right_layout->addStretch();
main_layout->addLayout(right_layout, 1); 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);
this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); // Allow resizing this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); // Allow resizing
this->addWidget(container); this->addWidget(container);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment