Skip to content

Commit

Permalink
Agrego que las ventanas del menu sean todas responsive
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanValdevenito committed Dec 5, 2023
1 parent e3386e6 commit 03c6458
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 15 deletions.
7 changes: 7 additions & 0 deletions client/vista/menu/menu_crear_partida.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
#include "menu_crear_partida.h"
#include "ui_menu_crear_partida.h"

#include <QGuiApplication>
#include <QScreen>

MenuCrearPartida::MenuCrearPartida(Client &cliente, QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MenuCrearPartida),
cliente(cliente)
{
ui->setupUi(this);

QScreen *primaryScreen = QGuiApplication::primaryScreen();
QRect mainScreenSize = primaryScreen->availableGeometry();
setGeometry(mainScreenSize);

QIcon icono(DATA_PATH "/icono.png");
this->setWindowIcon(icono);

Expand Down
2 changes: 1 addition & 1 deletion client/vista/menu/menu_crear_partida.ui
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
</size>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<item row="0" column="0" alignment="Qt::AlignHCenter|Qt::AlignVCenter">
<widget class="QFrame" name="frame">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
Expand Down
7 changes: 7 additions & 0 deletions client/vista/menu/menu_finalizar.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#include "menu_finalizar.h"
#include "ui_menu_finalizar.h"

#include <QGuiApplication>
#include <QScreen>

MenuFinalizar::MenuFinalizar(Client &cliente, int resultado, QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MenuFinalizar),
Expand All @@ -9,6 +12,10 @@ MenuFinalizar::MenuFinalizar(Client &cliente, int resultado, QWidget *parent) :
{
ui->setupUi(this);

QScreen *primaryScreen = QGuiApplication::primaryScreen();
QRect mainScreenSize = primaryScreen->availableGeometry();
setGeometry(mainScreenSize);

QIcon icono(DATA_PATH "/icono.png");
this->setWindowIcon(icono);

Expand Down
4 changes: 2 additions & 2 deletions client/vista/menu/menu_finalizar.ui
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<string notr="true"/>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<item row="0" column="0" alignment="Qt::AlignHCenter|Qt::AlignVCenter">
<widget class="QFrame" name="frame_2">
<property name="minimumSize">
<size>
Expand Down Expand Up @@ -71,7 +71,7 @@
</widget>
</widget>
</item>
<item row="1" column="0">
<item row="1" column="0" alignment="Qt::AlignHCenter|Qt::AlignVCenter">
<widget class="QFrame" name="frame">
<property name="enabled">
<bool>true</bool>
Expand Down
6 changes: 6 additions & 0 deletions client/vista/menu/menu_partidas.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "menu_partidas.h"
#include "ui_menu_partidas.h"

#include <QGuiApplication>
#include <QScreen>
#include <QPushButton>

MenuPartidas::MenuPartidas(Client &cliente, std::list<uint8_t> &partidas, QWidget *parent) :
Expand All @@ -12,6 +14,10 @@ MenuPartidas::MenuPartidas(Client &cliente, std::list<uint8_t> &partidas, QWidge
{
ui->setupUi(this);

QScreen *primaryScreen = QGuiApplication::primaryScreen();
QRect mainScreenSize = primaryScreen->availableGeometry();
setGeometry(mainScreenSize);

QIcon icono(DATA_PATH "/icono.png");
this->setWindowIcon(icono);

Expand Down
32 changes: 20 additions & 12 deletions client/vista/menu/menu_partidas.ui
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,14 @@
</size>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<item row="0" column="1" alignment="Qt::AlignHCenter|Qt::AlignVCenter">
<widget class="QFrame" name="frame">
<property name="minimumSize">
<size>
<width>640</width>
<height>480</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
Expand All @@ -65,6 +71,12 @@
<height>391</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>301</width>
<height>391</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
Expand All @@ -86,6 +98,12 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>299</width>
<height>389</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QWidget {
background-color: black;
Expand Down Expand Up @@ -135,20 +153,10 @@ QPushButton:pressed {
<string>Elegir partida</string>
</property>
</widget>
</widget>
</item>
<item row="0" column="1">
<widget class="QFrame" name="frame_2">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<widget class="QPushButton" name="volverAtrasButton">
<property name="geometry">
<rect>
<x>86</x>
<x>390</x>
<y>410</y>
<width>150</width>
<height>40</height>
Expand Down
6 changes: 6 additions & 0 deletions client/vista/menu/menu_principal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

#include <QApplication>
#include <QMainWindow>
#include <QGuiApplication>
#include <QScreen>
#include <QKeyEvent>
#include <QLabel>
#include <QPixmap>
Expand All @@ -19,6 +21,10 @@ MenuPrincipal::MenuPrincipal(Client &cliente, QWidget *parent):
// Inicializamos la interfaz definida en el archivo .ui
ui->setupUi(this);

QScreen *primaryScreen = QGuiApplication::primaryScreen();
QRect mainScreenSize = primaryScreen->availableGeometry();
setGeometry(mainScreenSize);

QIcon icono(DATA_PATH "/icono.png");
this->setWindowIcon(icono);

Expand Down

0 comments on commit 03c6458

Please sign in to comment.