Seamly2D
Code documentation
calculator_dialog.cpp
Go to the documentation of this file.
1 /************************************************************************
2  **
3  ** @file decimalchart_dialog.h
4  ** @author DSCaskey <dscaskey@gmail.com>
5  ** @date 12 26, 2021
6  **
7  ** @brief
8  ** @copyright
9  ** This source code is part of the Valentine project, a pattern making
10  ** program, whose allow create and modeling patterns of clothing.
11  ** Copyright (C) 2013-2015 Seamly2D project
12  ** All Rights Reserved.
13  **
14  ** Seamly2D is free software: you can redistribute it and/or modify
15  ** it under the terms of the GNU General Public License as published by
16  ** the Free Software Foundation, either version 3 of the License, or
17  ** (at your option) any later version.
18  **
19  ** Seamly2D is distributed in the hope that it will be useful,
20  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
21  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  ** GNU General Public License for more details.
23  **
24  ** You should have received a copy of the GNU General Public License
25  ** along with Seamly2D. If not, see <http://www.gnu.org/licenses/>.
26  **
27  *************************************************************************/
28 
29 #include <QDate>
30 #include <QDesktopServices>
31 #include <QMessageBox>
32 #include <QtDebug>
33 #include <QWidget>
34 #include <QDialog>
35 #include "../options.h"
36 #include "../core/vapplication.h"
37 #include "../fervor/fvupdater.h"
38 #include "../vwidgets/calculator/calculator.h"
39 #include "calculator_dialog.h"
40 #include "ui_calculator_dialog.h"
41 #include "../version.h"
42 
43 //---------------------------------------------------------------------------------------------------------------------
45  : QDialog(parent)
46  , ui(new Ui::CalculatorDialog)
47  , isInitialized(false)
48  , calc(new CalculatorUtil(this))
49 {
50 
51  ui->setupUi(this);
52  setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
53  setWindowIcon(QIcon("://icon/32x32/calculator.png"));
54 
55  ui->calculatorLayout->addWidget(calc);
56 }
57 
58 //---------------------------------------------------------------------------------------------------------------------
60 {
61  delete ui;
62 }
63 
64 //---------------------------------------------------------------------------------------------------------------------
65 void CalculatorDialog::showEvent(QShowEvent *event)
66 {
67  QDialog::showEvent( event );
68  if ( event->spontaneous() )
69  {
70  return;
71  }
72 
73  if (isInitialized)
74  {
75  return;
76  }
77 
78  isInitialized = true;//first show windows are held
79 }
CalculatorDialog(QWidget *parent=nullptr)
CalculatorUtil * calc
virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE
Ui::CalculatorDialog * ui