mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-03-19 18:09:59 +01:00
Nomenclature : Add dialog when insert a new nomenclature table
This commit is contained in:
47
sources/ui/configsaveloaderwidget.cpp
Normal file
47
sources/ui/configsaveloaderwidget.cpp
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
Copyright 2006-2019 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "configsaveloaderwidget.h"
|
||||
#include "ui_configsaveloaderwidget.h"
|
||||
|
||||
ConfigSaveLoaderWidget::ConfigSaveLoaderWidget(QWidget *parent) :
|
||||
QGroupBox(parent),
|
||||
ui(new Ui::ConfigSaveLoaderWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
ConfigSaveLoaderWidget::~ConfigSaveLoaderWidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
QString ConfigSaveLoaderWidget::selectedText() const {
|
||||
return ui->m_combo_box->currentText();
|
||||
}
|
||||
|
||||
QString ConfigSaveLoaderWidget::text() const {
|
||||
return ui->m_line_edit->text();
|
||||
}
|
||||
|
||||
void ConfigSaveLoaderWidget::on_m_load_pb_clicked() {
|
||||
emit loadClicked();
|
||||
}
|
||||
|
||||
void ConfigSaveLoaderWidget::on_m_save_pb_clicked() {
|
||||
emit saveClicked();
|
||||
}
|
||||
58
sources/ui/configsaveloaderwidget.h
Normal file
58
sources/ui/configsaveloaderwidget.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
Copyright 2006-2019 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef CONFIGSAVELOADERWIDGET_H
|
||||
#define CONFIGSAVELOADERWIDGET_H
|
||||
|
||||
#include <QGroupBox>
|
||||
|
||||
namespace Ui {
|
||||
class ConfigSaveLoaderWidget;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief The ConfigSaveLoaderWidget class
|
||||
* This group box provide 4 widget:
|
||||
* A combo box with the available config.
|
||||
* A push button to load the selected config of combo box
|
||||
* A line edit to edit the text of the config to save
|
||||
* A push button to save the config
|
||||
*/
|
||||
class ConfigSaveLoaderWidget : public QGroupBox
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ConfigSaveLoaderWidget(QWidget *parent = nullptr);
|
||||
~ConfigSaveLoaderWidget();
|
||||
|
||||
QString selectedText() const;
|
||||
QString text()const;
|
||||
|
||||
signals:
|
||||
void loadClicked();
|
||||
void saveClicked();
|
||||
|
||||
private slots:
|
||||
void on_m_load_pb_clicked();
|
||||
void on_m_save_pb_clicked();
|
||||
|
||||
private:
|
||||
Ui::ConfigSaveLoaderWidget *ui;
|
||||
};
|
||||
|
||||
#endif // CONFIGSAVELOADERWIDGET_H
|
||||
52
sources/ui/configsaveloaderwidget.ui
Normal file
52
sources/ui/configsaveloaderwidget.ui
Normal file
@@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ConfigSaveLoaderWidget</class>
|
||||
<widget class="QGroupBox" name="ConfigSaveLoaderWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>GroupBox</string>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Configuration</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLineEdit" name="m_line_edit"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QComboBox" name="m_combo_box"/>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="m_load_pb">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/ico/16x16/folder-open.png</normaloff>:/ico/16x16/folder-open.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="m_save_pb">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/ico/16x16/document-save.png</normaloff>:/ico/16x16/document-save.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
65
sources/ui/marginseditdialog.cpp
Normal file
65
sources/ui/marginseditdialog.cpp
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "marginseditdialog.h"
|
||||
#include "ui_marginseditdialog.h"
|
||||
|
||||
#include <QScopedPointer>
|
||||
|
||||
MarginsEditDialog::MarginsEditDialog(QMargins margins, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::MarginsEditDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->m_top_sb->setValue(margins.top());
|
||||
ui->m_left_sb->setValue(margins.left());
|
||||
ui->m_right_sb->setValue(margins.right());
|
||||
ui->m_bottom_sb->setValue(margins.bottom());
|
||||
}
|
||||
|
||||
MarginsEditDialog::~MarginsEditDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
QMargins MarginsEditDialog::margins() const {
|
||||
return QMargins(ui->m_left_sb->value(), ui->m_top_sb->value(), ui->m_right_sb->value(), ui->m_bottom_sb->value());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief MarginsEditDialog::getMargins
|
||||
* @param margins : margins to set by default
|
||||
* @param accepted : bool to know if dialog is accepted
|
||||
* @param parent : parent widget.
|
||||
* @return The a margins with the edited value if dialog is accepted or a default constructed QMargins() if dialog is rejected
|
||||
*/
|
||||
QMargins MarginsEditDialog::getMargins(QMargins margins, bool *accepted, QWidget *parent)
|
||||
{
|
||||
QScopedPointer<MarginsEditDialog> d(new MarginsEditDialog(margins, parent));
|
||||
if (d->exec())
|
||||
{
|
||||
if (accepted) {
|
||||
*accepted = true;
|
||||
}
|
||||
return d->margins();
|
||||
}
|
||||
|
||||
if (accepted) {
|
||||
*accepted = false;
|
||||
}
|
||||
return QMargins();
|
||||
}
|
||||
48
sources/ui/marginseditdialog.h
Normal file
48
sources/ui/marginseditdialog.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef MARGINSEDITDIALOG_H
|
||||
#define MARGINSEDITDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QMargins>
|
||||
|
||||
namespace Ui {
|
||||
class MarginsEditDialog;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief The MarginsEditDialog class
|
||||
* A simple dialog to edit QMargins
|
||||
*/
|
||||
class MarginsEditDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MarginsEditDialog(QMargins margins = QMargins(), QWidget *parent = nullptr);
|
||||
~MarginsEditDialog();
|
||||
|
||||
QMargins margins() const;
|
||||
|
||||
static QMargins getMargins(QMargins margins = QMargins(), bool *accepted = nullptr, QWidget *parent = nullptr);
|
||||
|
||||
private:
|
||||
Ui::MarginsEditDialog *ui;
|
||||
};
|
||||
|
||||
#endif // MARGINSEDITDIALOG_H
|
||||
133
sources/ui/marginseditdialog.ui
Normal file
133
sources/ui/marginseditdialog.ui
Normal file
@@ -0,0 +1,133 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MarginsEditDialog</class>
|
||||
<widget class="QDialog" name="MarginsEditDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>266</width>
|
||||
<height>172</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="3" column="1">
|
||||
<widget class="QSpinBox" name="m_bottom_sb">
|
||||
<property name="prefix">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="m_left_sb">
|
||||
<property name="prefix">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<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>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="m_top_sb">
|
||||
<property name="prefix">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="m_right_sb">
|
||||
<property name="prefix">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Haut :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Gauche :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Droit :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Bas :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>MarginsEditDialog</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>MarginsEditDialog</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>
|
||||
Reference in New Issue
Block a user