make MapProps a dialogue

gui-branch-qt
an 2019-05-16 17:50:59 -04:00
parent c984ba50a9
commit 11f90cb112
8 changed files with 136 additions and 73 deletions

View File

@ -18,13 +18,16 @@ find_package(Qt5Widgets CONFIG REQUIRED)
add_executable(
maraiah-tycho
WIN32
source/tycho-qt/main.cc
source/tycho-qt/mapprops.cc
source/tycho-qt/mapprops.h
source/tycho-qt/mapprops.ui
source/tycho-qt/winmenu.cc
source/tycho-qt/winmenu.h
source/tycho-qt/winmenu.ui
source/tycho-qt/common.h
source/tycho-qt/mapprops.h
source/tycho-qt/winmenu.h
source/tycho-qt/mapprops.cc
source/tycho-qt/winmenu.cc
source/tycho-qt/main.cc
)
add_custom_target(

29
source/tycho-qt/common.h Normal file
View File

@ -0,0 +1,29 @@
#pragma once
#include <cstdint>
#include <cstddef>
#include <cstdio>
#ifndef NDEBUG
# define DbgPrintFunc() std::puts(__func__)
#else
# define DbgPrintFunc()
#endif
typedef float f32;
typedef double f64;
typedef std::int8_t i8;
typedef std::int16_t i16;
typedef std::int32_t i32;
typedef std::int64_t i64;
typedef std::uint8_t u8;
typedef std::uint16_t u16;
typedef std::uint32_t u32;
typedef std::uint64_t u64;
typedef std::ptrdiff_t isize;
typedef std::size_t usize;
// EOF

View File

@ -1,8 +1,9 @@
#include "common.h"
#include "mapprops.h"
#include "ui_mapprops.h"
MapProps::MapProps(QWidget *parent) :
QWidget(parent),
QDialog(parent, Qt::Window),
ui(new Ui::MapProps)
{
ui->setupUi(this);
@ -10,6 +11,7 @@ MapProps::MapProps(QWidget *parent) :
MapProps::~MapProps()
{
DbgPrintFunc();
}
// EOF

View File

@ -1,6 +1,6 @@
#pragma once
#include <QWidget>
#include <QDialog>
#include <memory>
namespace Ui
@ -8,7 +8,7 @@ namespace Ui
class MapProps;
}
class MapProps : public QWidget
class MapProps : public QDialog
{
Q_OBJECT

View File

@ -1,15 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MapProps</class>
<widget class="QWidget" name="MapProps">
<widget class="QDialog" name="MapProps">
<property name="windowModality">
<enum>Qt::WindowModal</enum>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>467</width>
<height>628</height>
<height>668</height>
</rect>
</property>
<property name="windowTitle">
<string>Map Properties</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox_5">
@ -326,8 +332,51 @@
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>MapProps</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>MapProps</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -1,17 +1,28 @@
#include "common.h"
#include "winmenu.h"
#include "ui_winmenu.h"
#include <stdio.h>
WinMenu::WinMenu(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::WinMenu)
ui(new Ui::WinMenu),
props(new MapProps(this))
{
ui->setupUi(this);
props = new MapProps(ui->dockScrollArea);
ui->dockScrollArea->setWidget(props);
connect(ui->actionMapProps, &QAction::triggered,
this, &WinMenu::openMapProperties);
}
WinMenu::~WinMenu()
{
DbgPrintFunc();
}
void WinMenu::openMapProperties()
{
props->show();
}
// EOF

View File

@ -18,6 +18,9 @@ public:
explicit WinMenu(QWidget *parent = nullptr);
~WinMenu();
public slots:
void openMapProperties();
private:
std::unique_ptr<Ui::WinMenu> ui;
MapProps *props;

View File

@ -6,14 +6,14 @@
<rect>
<x>0</x>
<y>0</y>
<width>500</width>
<height>400</height>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>500</width>
<height>400</height>
<width>800</width>
<height>600</height>
</size>
</property>
<property name="windowTitle">
@ -25,81 +25,47 @@
<rect>
<x>0</x>
<y>0</y>
<width>500</width>
<width>800</width>
<height>30</height>
</rect>
</property>
<widget class="QMenu" name="menu">
<widget class="QMenu" name="menuFile">
<property name="title">
<string>File</string>
</property>
<addaction name="actionNew"/>
<addaction name="actionOpen"/>
</widget>
<addaction name="menu"/>
<widget class="QMenu" name="menuEdit">
<property name="title">
<string>Edit</string>
</property>
<addaction name="actionMapProps"/>
</widget>
<addaction name="menuFile"/>
<addaction name="menuEdit"/>
</widget>
<widget class="QStatusBar" name="statusBar"/>
<widget class="QToolBar" name="toolBar">
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<widget class="QDockWidget" name="dockWidget">
<property name="floating">
<bool>false</bool>
</property>
<property name="features">
<set>QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable</set>
</property>
<property name="allowedAreas">
<set>Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea</set>
</property>
<property name="windowTitle">
<string>Property Editor</string>
</property>
<attribute name="dockWidgetArea">
<number>2</number>
</attribute>
<widget class="QWidget" name="widget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QScrollArea" name="dockScrollArea">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="widget_2">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>80</width>
<height>289</height>
</rect>
</property>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
<action name="actionOpen">
<property name="text">
<string>Open Project</string>
</property>
<property name="shortcut">
<string>Ctrl+O</string>
</property>
</action>
<action name="actionNew">
<property name="text">
<string>New Project</string>
</property>
<property name="shortcut">
<string>Ctrl+N</string>
</property>
</action>
<action name="actionMapProps">
<property name="text">
<string>Map Properties</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>