QElectroTech  0.70
namelistdialog.cpp
Go to the documentation of this file.
1 /*
2  Copyright 2006-2019 The QElectroTech Team
3  This file is part of QElectroTech.
4 
5  QElectroTech is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 2 of the License, or
8  (at your option) any later version.
9 
10  QElectroTech is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #include "namelistdialog.h"
19 #include "ui_namelistdialog.h"
20 #include "namelistwidget.h"
21 
22 #include <QPushButton>
23 #include <QMessageBox>
24 
26  QDialog(parent),
27  ui(new Ui::NameListDialog)
28 {
29  ui->setupUi(this);
30 
32  ui->m_main_layout->insertWidget(1, m_namelist_widget);
33 #ifdef Q_OS_MAC
34  this->setWindowFlags(Qt::Sheet);
35 #endif
36 }
37 
39  delete ui;
40 }
41 
42 void NameListDialog::setInformationText(const QString &text) {
43  ui->m_top_label->setText(text);
44 }
45 
52  return m_namelist_widget;
53 }
54 
55 void NameListDialog::setHelpText(const QString &text)
56 {
57  m_help_text = text;
58  if (!m_help_text.isEmpty())
59  {
60  QPushButton *button = ui->m_button_box->addButton(QDialogButtonBox::Help);
61  connect(button, &QPushButton::clicked, this, &NameListDialog::showHelpDialog);
62  }
63 }
64 
66  QMessageBox::information(this, tr("Variables de cartouche"), m_help_text);
67 }
void setInformationText(const QString &text)
NameListWidget * namelistWidget() const
NameListDialog::namelistWidget.
The NameListDialog class Provide a dialog for let user define localized string;.
Ui::NameListDialog * ui
QIcon tr
Definition: qeticons.cpp:204
QMessageBox::StandardButton information(QWidget *, const QString &, const QString &, QMessageBox::StandardButtons=QMessageBox::Ok, QMessageBox::StandardButton=QMessageBox::NoButton)
NameListWidget * m_namelist_widget
NameListDialog(QWidget *parent=nullptr)
void setHelpText(const QString &text)
QString m_help_text
The NameListWidget class Provide a widget for let user define localized string;.