Skip to content

Commit

Permalink
added in mainwindow ui file, added in new hero banner and qrc file
Browse files Browse the repository at this point in the history
  • Loading branch information
BreeDurbin committed Apr 14, 2024
1 parent 3c28ddf commit 895fa26
Show file tree
Hide file tree
Showing 14 changed files with 137 additions and 11 deletions.
9 changes: 8 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ qt_standard_project_setup()
set(HEADER_FILES
${CMAKE_CURRENT_SOURCE_DIR}/include/mainwindow.hpp
${CMAKE_CURRENT_SOURCE_DIR}/model/include/creaturemodel.hpp
${CMAKE_CURRENT_SOURCE_DIR}/mainwindow.ui
)

set(SOURCE_FILES
Expand All @@ -23,14 +24,20 @@ set(SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/model/creaturemodel.cpp
)

set(RESOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/graphics.qrc
${CMAKE_CURRENT_SOURCE_DIR}/resources.qrc
)


add_executable(
${PROJECT_NAME}
#headers
${HEADER_FILES}
#sources
${SOURCE_FILES}
#resources
${CMAKE_CURRENT_SOURCE_DIR}/resources.qrc
${RESOURCE_FILES}
)

target_include_directories(
Expand Down
11 changes: 11 additions & 0 deletions src/graphics.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<RCC>
<qresource prefix="images">
<file>images/cyrus_background.png</file>
<file>images/CYRUS_HERO.png</file>
<file>images/CYRUS_BANNER.png</file>
<file>images/CYRUS_BANNER_TINY.png</file>
<file>images/CYRUS_ICON_TINY.png</file>
<file>images/Designer.png</file>
<file>images/logo_big.png</file>
</qresource>
</RCC>
Binary file added src/images/CYRUS_BANNER.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/images/CYRUS_BANNER_TINY.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/images/CYRUS_HERO.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/images/CYRUS_ICON_TINY.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/images/Designer (3).png
Binary file not shown.
Binary file removed src/images/Designer (6).png
Binary file not shown.
File renamed without changes
10 changes: 9 additions & 1 deletion src/include/mainwindow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
#include <QMainWindow>
#include <QVBoxLayout>

namespace Ui {
class MainWindow;
}

class MainWindow
: public QMainWindow
: public QMainWindow
{
Q_OBJECT

Expand All @@ -15,4 +19,8 @@ class MainWindow
private:
void initializeInitiative(QHBoxLayout* layout);
void initializeCreatureRepository(QHBoxLayout* layout);

protected:
Ui::MainWindow *ui;

};
12 changes: 10 additions & 2 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,22 @@
#include <ctabwidget.hpp>
#include <cstyleditemdelegate.hpp>

MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)
{
ui->setupUi(this);

//title and size
this->setWindowTitle("Cyrus: Combat Tracker");
this->setMinimumSize(1920, 1080);
this->setObjectName("MainWindow");

setStyleSheet("#MainWindow { border-image: url(:/images/cyrus_background.png) 0 0 0 0 stretch stretch;}");



/*
setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred));
//setBackgroundRole(QPalette::Background);
Expand All @@ -47,11 +54,12 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
initializeCreatureRepository(outer);
// final show call
this->centralWidget()->show();
this->centralWidget()->show(); */
}

MainWindow::~MainWindow()
{
delete ui;
}

void MainWindow::initializeInitiative(QHBoxLayout* outer){
Expand Down
91 changes: 91 additions & 0 deletions src/mainwindow.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1600</width>
<height>1080</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QTabWidget" name="tabWidget">
<property name="geometry">
<rect>
<x>-10</x>
<y>70</y>
<width>1631</width>
<height>1091</height>
</rect>
</property>
<property name="tabPosition">
<enum>QTabWidget::West</enum>
</property>
<property name="tabShape">
<enum>QTabWidget::Rounded</enum>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="combat_tab">
<attribute name="title">
<string>Combat</string>
</attribute>
</widget>
<widget class="QWidget" name="creature_tab">
<attribute name="title">
<string>Creatures</string>
</attribute>
</widget>
<widget class="QWidget" name="world_tab">
<attribute name="title">
<string>World</string>
</attribute>
</widget>
<widget class="QWidget" name="settings_tab">
<attribute name="title">
<string>Settings</string>
</attribute>
</widget>
</widget>
<widget class="QWidget" name="horizontalLayoutWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>2050</width>
<height>71</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="graphics.qrc">:/images/images/CYRUS_HERO.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</widget>
<resources>
<include location="resources.qrc"/>
<include location="graphics.qrc"/>
</resources>
<connections/>
</ui>
3 changes: 3 additions & 0 deletions src/model/creaturemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ QVariant CreatureModel::data(const QModelIndex &index, int role) const{
return QString::number(creatures[index.row()].initiative);
else
return QVariant();
case Qt::SizeHintRole:
return QSize(1300, 50);
default:
return QVariant();
}
Expand All @@ -101,6 +103,7 @@ QHash<int, QByteArray> CreatureModel::roleNames() const{
roles[Qt::DecorationRole] = "decoration";
roles[Qt::DisplayRole] = "display";
roles[Qt::EditRole] = "edit";
roles[Qt::SizeHintRole] = "sizeHint";
return roles;
}

Expand Down
12 changes: 5 additions & 7 deletions src/resources.qrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<RCC>
<qresource prefix="/">
<file>images/cyrus_logo.png</file>
<file>images/cyrus_background.png</file>
<file>icons/monster.png</file>
<file>icons/initiative.png</file>
</qresource>
</RCC>
<qresource prefix="/">
<file>icons/monster.png</file>
<file>icons/initiative.png</file>
</qresource>
</RCC>

0 comments on commit 895fa26

Please sign in to comment.