Added custom Yes-No choice Dialog

This commit is contained in:
Valentino Orlandi 2022-10-05 21:20:42 +02:00
parent a809a96d5d
commit 0a3f9833b0
Signed by: elB4RTO
GPG Key ID: 1719E976DB2D4E71
3 changed files with 271 additions and 0 deletions

View File

@ -0,0 +1,34 @@
#include "dialogbool.h"
#include "ui_dialogbool.h"
DialogBool::DialogBool( const QString& title, const QString& text, QWidget *parent ) :
QDialog(parent),
ui(new Ui::DialogBool)
{
ui->setupUi(this);
// insert the given title and text
this->ui->label_Title->setText( title );
this->ui->label_Message->setText( text );
// adjust the initial size
this->adjustSize();
}
DialogBool::~DialogBool()
{
delete ui;
}
void DialogBool::on_button_NO_clicked()
{
this->done( 0 );
}
void DialogBool::on_button_YES_clicked()
{
this->done( 1 );
}

View File

@ -0,0 +1,27 @@
#ifndef DIALOGBOOL_H
#define DIALOGBOOL_H
#include <QDialog>
namespace Ui {
class DialogBool;
}
class DialogBool : public QDialog
{
Q_OBJECT
public:
explicit DialogBool( const QString& title, const QString& text, QWidget *parent=nullptr );
~DialogBool();
private slots:
void on_button_NO_clicked();
void on_button_YES_clicked();
private:
Ui::DialogBool *ui;
};
#endif // DIALOGBOOL_H

View File

@ -0,0 +1,210 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DialogBool</class>
<widget class="QDialog" name="DialogBool">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>512</width>
<height>256</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>512</width>
<height>192</height>
</size>
</property>
<property name="font">
<font>
<family>Metropolis</family>
<pointsize>13</pointsize>
</font>
</property>
<property name="windowIcon">
<iconset resource="../../resources/resources.qrc">
<normaloff>:/logo/logo/logdoctor.svg</normaloff>:/logo/logo/logdoctor.svg</iconset>
</property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QFrame" name="frame_Message">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="topMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0" rowspan="3">
<widget class="QLabel" name="label_Icon">
<property name="minimumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="pixmap">
<pixmap resource="../../resources/resources.qrc">:/icons/icons/dialog_quest.png</pixmap>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_Title">
<property name="minimumSize">
<size>
<width>0</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>64</height>
</size>
</property>
<property name="font">
<font>
<family>Metropolis</family>
<pointsize>13</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="indent">
<number>8</number>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="label_Message">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>24</height>
</size>
</property>
<property name="font">
<font>
<family>Metropolis</family>
<pointsize>13</pointsize>
</font>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="margin">
<number>4</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="frame_Buttons">
<property name="minimumSize">
<size>
<width>0</width>
<height>48</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>48</height>
</size>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>333</width>
<height>27</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="button_YES">
<property name="minimumSize">
<size>
<width>96</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>96</width>
<height>32</height>
</size>
</property>
<property name="text">
<string>Yes</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="button_NO">
<property name="minimumSize">
<size>
<width>96</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>96</width>
<height>32</height>
</size>
</property>
<property name="text">
<string>No</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../../resources/resources.qrc"/>
</resources>
<connections/>
</ui>