Maki
Formally verfied low-code orchestration
Loading...
Searching...
No Matches
base_dialog.h
1#pragma once
2
3#include <QDialog>
4
5#include "style_helpers.h"
6
7class QDialogButtonBox;
8
12class BaseDialog : public QDialog
13{
14 Q_OBJECT
15public:
24 BaseDialog(const QString& title, double ratio, double screenFraction, QWidget* parent = nullptr);
25
26protected:
33 void setSize(double ratio, double screenFraction);
34
35 void setFlexibleSize(int minWidth, int minHeight);
36
44 void setSize(double ratio, double screenFraction, qreal heightFraction);
45
46 void keyPressEvent(QKeyEvent* event) override;
47
53 QVBoxLayout* layout();
54
62 QDialogButtonBox* createButtons(const QString& ok, const QString& cancel);
63
69 void limitWidth(int minWidth);
70
76 void limitHeight(int minHeight);
77
78private:
79 int mMinimunWidth;
80 int mMinimunHeight;
81};
BaseDialog(const QString &title, double ratio, double screenFraction, QWidget *parent=nullptr)
Constructs a new BaseDialog instance.
Definition base_dialog.cpp:19
void limitHeight(int minHeight)
Defines the heigth limits for the dialog.
Definition base_dialog.cpp:122
void setSize(double ratio, double screenFraction)
Sets the size of the dialog based on the given ratio and screen fraction.
Definition base_dialog.cpp:33
void limitWidth(int minWidth)
Defines the width limits for the dialog.
Definition base_dialog.cpp:115
QDialogButtonBox * createButtons(const QString &ok, const QString &cancel)
Creates a button box with OK and Cancel buttons.
Definition base_dialog.cpp:78
QVBoxLayout * layout()
Returns the layout of the dialog.
Definition base_dialog.cpp:73