added options dialog

This commit is contained in:
Herwig Birke
2018-06-22 10:23:56 +02:00
parent 7fd8235870
commit 97a94f6ce3
8 changed files with 207 additions and 4 deletions
+16
View File
@@ -15,6 +15,8 @@
#include "cwidget.h"
#include "coptionsdialog.h"
#include <QTextDocument>
#include <QTextBlockFormat>
#include <QTextCharFormat>
@@ -437,6 +439,11 @@ void cMainWindow::createTextActions()
void cMainWindow::createToolsActions()
{
QAction* lpAction;
m_lpToolsMenu = menuBar()->addMenu(tr("&Tools"));
lpAction = m_lpToolsMenu->addAction(tr("&Options..."), this, &cMainWindow::onToolsOptions);
}
void cMainWindow::createWindowActions()
@@ -1379,6 +1386,15 @@ void cMainWindow::onFileProperties()
onShowPropertiesWindow();
}
void cMainWindow::onToolsOptions()
{
cOptionsDialog* lpOptionsDialog = new cOptionsDialog(this);
lpOptionsDialog->exec();
delete lpOptionsDialog;
}
void cMainWindow::onHelpContents()
{
QMessageBox::information(this, "Help", "Contents");
+8 -1
View File
@@ -445,6 +445,13 @@ private slots:
*/
void onFileProperties();
/*!
\brief
\fn onToolsOptions
*/
void onToolsOptions();
/*!
\brief
@@ -638,7 +645,7 @@ private slots:
private:
Ui::cMainWindow* ui; /*!< User Interface */
cSplashScreen* m_lpSplashScreen;
cSplashScreen* m_lpSplashScreen; /*!< Splash Screen */
QStandardItemModel* m_lpOutlineModel; /*!< Item Model for Outline list */
QStandardItemModel* m_lpCharacterModel; /*!< Item Model for Character list */
+24
View File
@@ -0,0 +1,24 @@
#include "coptionsdialog.h"
#include "ui_coptionsdialog.h"
cOptionsDialog::cOptionsDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::cOptionsDialog)
{
ui->setupUi(this);
m_lpCategoryModel = new QStandardItemModel(0, 1);
ui->m_lpCategoryList->setModel(m_lpCategoryModel);
QIcon icon(":/category/category_core.png");
QStandardItem* lpItem = new QStandardItem(icon, tr("General"));
m_lpCategoryModel->appendRow(lpItem);
ui->m_lpCategoryList->resizeColumnToContents(0);
}
cOptionsDialog::~cOptionsDialog()
{
delete ui;
}
+43
View File
@@ -0,0 +1,43 @@
#ifndef COPTIONSDIALOG_H
#define COPTIONSDIALOG_H
#include <QDialog>
#include <QStandardItemModel>
namespace Ui {
class cOptionsDialog;
}
/*!
\brief
\class cOptionsDialog coptionsdialog.h "coptionsdialog.h"
*/
class cOptionsDialog : public QDialog
{
Q_OBJECT
public:
/*!
\brief
\fn cOptionsDialog
\param parent
*/
explicit cOptionsDialog(QWidget *parent = 0);
/*!
\brief
\fn ~cOptionsDialog
*/
~cOptionsDialog();
private:
Ui::cOptionsDialog* ui; /*!< TODO: describe */
QStandardItemModel* m_lpCategoryModel; /*!< TODO: describe */
};
#endif // COPTIONSDIALOG_H
+107
View File
@@ -0,0 +1,107 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>cOptionsDialog</class>
<widget class="QDialog" name="cOptionsDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>544</width>
<height>386</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,100">
<item>
<widget class="QTreeView" name="m_lpCategoryList">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
</widget>
</item>
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>366</width>
<height>335</height>
</rect>
</property>
</widget>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<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>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>cOptionsDialog</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>cOptionsDialog</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>
Binary file not shown.

After

Width:  |  Height:  |  Size: 593 B

+6 -3
View File
@@ -88,7 +88,8 @@ SOURCES += \
ccharacterselectdialog.cpp \
csplashscreen.cpp \
cplaceselectdialog.cpp \
cobjectselectdialog.cpp
cobjectselectdialog.cpp \
coptionsdialog.cpp
HEADERS += \
cmainwindow.h \
@@ -128,7 +129,8 @@ HEADERS += \
ccharacterselectdialog.h \
csplashscreen.h \
cplaceselectdialog.h \
cobjectselectdialog.h
cobjectselectdialog.h \
coptionsdialog.h
FORMS += \
cmainwindow.ui \
@@ -143,7 +145,8 @@ FORMS += \
cpropertieswindow.ui \
ccharacterselectdialog.ui \
cplaceselectdialog.ui \
cobjectselectdialog.ui
cobjectselectdialog.ui \
coptionsdialog.ui
DISTFILES += \
Doxyfile \
+3
View File
@@ -665,4 +665,7 @@
<qresource prefix="/locale">
<file>storyWriter_de.qm</file>
</qresource>
<qresource prefix="/category">
<file alias="category_core.png">images/category/category_core.png</file>
</qresource>
</RCC>