mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
Fix Qt 6 deprecated QVBoxLayout::setMargin
Use QVBoxLayout::setContentsMargins instead.
This commit is contained in:
@@ -1,17 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2006-2020 The QElectroTech Team
|
Copyright 2006-2020 The QElectroTech Team
|
||||||
This file is part of QElectroTech.
|
This file is part of QElectroTech.
|
||||||
|
|
||||||
QElectroTech is free software: you can redistribute it and/or modify
|
QElectroTech is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
the Free Software Foundation, either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
QElectroTech is distributed in the hope that it will be useful,
|
QElectroTech is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
@@ -200,7 +200,7 @@ StyleEditor::StyleEditor(QETElementEditor *editor, CustomElementGraphicPart *p,
|
|||||||
line_style -> addItem(tr("Pointillé", "element part line style"), CustomElementGraphicPart::DottedStyle);
|
line_style -> addItem(tr("Pointillé", "element part line style"), CustomElementGraphicPart::DottedStyle);
|
||||||
line_style -> addItem(tr("Traits et points", "element part line style"), CustomElementGraphicPart::DashdottedStyle);
|
line_style -> addItem(tr("Traits et points", "element part line style"), CustomElementGraphicPart::DashdottedStyle);
|
||||||
//normal_style -> setChecked(true);
|
//normal_style -> setChecked(true);
|
||||||
|
|
||||||
// epaisseur
|
// epaisseur
|
||||||
size_weight = new QComboBox(this);
|
size_weight = new QComboBox(this);
|
||||||
size_weight -> addItem(tr("Nulle", "element part weight"), CustomElementGraphicPart::NoneWeight);
|
size_weight -> addItem(tr("Nulle", "element part weight"), CustomElementGraphicPart::NoneWeight);
|
||||||
@@ -374,12 +374,12 @@ StyleEditor::StyleEditor(QETElementEditor *editor, CustomElementGraphicPart *p,
|
|||||||
|
|
||||||
// antialiasing
|
// antialiasing
|
||||||
antialiasing = new QCheckBox(tr("Antialiasing"));
|
antialiasing = new QCheckBox(tr("Antialiasing"));
|
||||||
|
|
||||||
updateForm();
|
updateForm();
|
||||||
|
|
||||||
auto main_layout = new QVBoxLayout();
|
auto main_layout = new QVBoxLayout();
|
||||||
main_layout -> setMargin(0);
|
main_layout -> setContentsMargins(0,0,0,0);
|
||||||
|
|
||||||
main_layout -> addWidget(new QLabel("<u>" + tr("Apparence :") + "</u> "));
|
main_layout -> addWidget(new QLabel("<u>" + tr("Apparence :") + "</u> "));
|
||||||
|
|
||||||
outline_color->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength);
|
outline_color->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength);
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2006-2020 The QElectroTech Team
|
Copyright 2006-2020 The QElectroTech Team
|
||||||
This file is part of QElectroTech.
|
This file is part of QElectroTech.
|
||||||
|
|
||||||
QElectroTech is free software: you can redistribute it and/or modify
|
QElectroTech is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
the Free Software Foundation, either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
QElectroTech is distributed in the hope that it will be useful,
|
QElectroTech is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
ElementsPanelWidget::ElementsPanelWidget(QWidget *parent) : QWidget(parent) {
|
ElementsPanelWidget::ElementsPanelWidget(QWidget *parent) : QWidget(parent) {
|
||||||
// initalise le panel d'elements
|
// initalise le panel d'elements
|
||||||
elements_panel = new ElementsPanel(this);
|
elements_panel = new ElementsPanel(this);
|
||||||
|
|
||||||
// initialise les actions
|
// initialise les actions
|
||||||
open_directory = new QAction(QET::Icons::FolderOpen, tr("Ouvrir le dossier correspondant"), this);
|
open_directory = new QAction(QET::Icons::FolderOpen, tr("Ouvrir le dossier correspondant"), this);
|
||||||
copy_path = new QAction(QET::Icons::IC_CopyFile, tr("Copier le chemin"), this);
|
copy_path = new QAction(QET::Icons::IC_CopyFile, tr("Copier le chemin"), this);
|
||||||
@@ -67,13 +67,13 @@ ElementsPanelWidget::ElementsPanelWidget(QWidget *parent) : QWidget(parent) {
|
|||||||
tbt_edit = new QAction(QET::Icons::TitleBlock, tr("Éditer ce modèle"), this);
|
tbt_edit = new QAction(QET::Icons::TitleBlock, tr("Éditer ce modèle"), this);
|
||||||
tbt_remove = new QAction(QET::Icons::TitleBlock, tr("Supprimer ce modèle"), this);
|
tbt_remove = new QAction(QET::Icons::TitleBlock, tr("Supprimer ce modèle"), this);
|
||||||
|
|
||||||
|
|
||||||
prj_del_diagram -> setShortcut(QKeySequence(Qt::Key_Delete));
|
prj_del_diagram -> setShortcut(QKeySequence(Qt::Key_Delete));
|
||||||
prj_move_diagram_up -> setShortcut(QKeySequence(Qt::Key_F3));
|
prj_move_diagram_up -> setShortcut(QKeySequence(Qt::Key_F3));
|
||||||
prj_move_diagram_down -> setShortcut(QKeySequence(Qt::Key_F4));
|
prj_move_diagram_down -> setShortcut(QKeySequence(Qt::Key_F4));
|
||||||
prj_move_diagram_top -> setShortcut(QKeySequence(Qt::Key_F5));
|
prj_move_diagram_top -> setShortcut(QKeySequence(Qt::Key_F5));
|
||||||
|
|
||||||
|
|
||||||
// initialise le champ de texte pour filtrer avec une disposition horizontale
|
// initialise le champ de texte pour filtrer avec une disposition horizontale
|
||||||
filter_textfield = new QLineEdit(this);
|
filter_textfield = new QLineEdit(this);
|
||||||
filter_textfield -> setClearButtonEnabled(true);
|
filter_textfield -> setClearButtonEnabled(true);
|
||||||
@@ -81,7 +81,7 @@ ElementsPanelWidget::ElementsPanelWidget(QWidget *parent) : QWidget(parent) {
|
|||||||
|
|
||||||
|
|
||||||
context_menu = new QMenu(this);
|
context_menu = new QMenu(this);
|
||||||
|
|
||||||
connect(open_directory, SIGNAL(triggered()), this, SLOT(openDirectoryForSelectedItem()));
|
connect(open_directory, SIGNAL(triggered()), this, SLOT(openDirectoryForSelectedItem()));
|
||||||
connect(copy_path, SIGNAL(triggered()), this, SLOT(copyPathForSelectedItem()));
|
connect(copy_path, SIGNAL(triggered()), this, SLOT(copyPathForSelectedItem()));
|
||||||
connect(prj_activate, SIGNAL(triggered()), this, SLOT(activateProject()));
|
connect(prj_activate, SIGNAL(triggered()), this, SLOT(activateProject()));
|
||||||
@@ -98,9 +98,9 @@ ElementsPanelWidget::ElementsPanelWidget(QWidget *parent) : QWidget(parent) {
|
|||||||
connect(tbt_add, SIGNAL(triggered()), this, SLOT(addTitleBlockTemplate()));
|
connect(tbt_add, SIGNAL(triggered()), this, SLOT(addTitleBlockTemplate()));
|
||||||
connect(tbt_edit, SIGNAL(triggered()), this, SLOT(editTitleBlockTemplate()));
|
connect(tbt_edit, SIGNAL(triggered()), this, SLOT(editTitleBlockTemplate()));
|
||||||
connect(tbt_remove, SIGNAL(triggered()), this, SLOT(removeTitleBlockTemplate()));
|
connect(tbt_remove, SIGNAL(triggered()), this, SLOT(removeTitleBlockTemplate()));
|
||||||
|
|
||||||
connect(filter_textfield, SIGNAL(textChanged(const QString &)), this, SLOT(filterEdited(const QString &)));
|
connect(filter_textfield, SIGNAL(textChanged(const QString &)), this, SLOT(filterEdited(const QString &)));
|
||||||
|
|
||||||
connect(elements_panel, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT(updateButtons()));
|
connect(elements_panel, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT(updateButtons()));
|
||||||
connect(elements_panel, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(handleContextMenu(const QPoint &)));
|
connect(elements_panel, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(handleContextMenu(const QPoint &)));
|
||||||
connect(elements_panel, SIGNAL(requestForDiagram(Diagram*)), this, SIGNAL(requestForDiagram(Diagram*)));
|
connect(elements_panel, SIGNAL(requestForDiagram(Diagram*)), this, SIGNAL(requestForDiagram(Diagram*)));
|
||||||
@@ -110,10 +110,10 @@ ElementsPanelWidget::ElementsPanelWidget(QWidget *parent) : QWidget(parent) {
|
|||||||
QETApp::instance(),
|
QETApp::instance(),
|
||||||
SLOT(openTitleBlockTemplate(const TitleBlockTemplateLocation &))
|
SLOT(openTitleBlockTemplate(const TitleBlockTemplateLocation &))
|
||||||
);
|
);
|
||||||
|
|
||||||
// disposition verticale
|
// disposition verticale
|
||||||
QVBoxLayout *vlayout = new QVBoxLayout(this);
|
QVBoxLayout *vlayout = new QVBoxLayout(this);
|
||||||
vlayout -> setMargin(0);
|
vlayout -> setContentsMargins(0,0,0,0);
|
||||||
vlayout -> setSpacing(0);
|
vlayout -> setSpacing(0);
|
||||||
vlayout -> addWidget(filter_textfield);
|
vlayout -> addWidget(filter_textfield);
|
||||||
vlayout -> addWidget(elements_panel);
|
vlayout -> addWidget(elements_panel);
|
||||||
@@ -290,7 +290,7 @@ void ElementsPanelWidget::addTitleBlockTemplate()
|
|||||||
{
|
{
|
||||||
QTreeWidgetItem *current_item = elements_panel -> currentItem();
|
QTreeWidgetItem *current_item = elements_panel -> currentItem();
|
||||||
if (!current_item) return;
|
if (!current_item) return;
|
||||||
|
|
||||||
if (current_item -> type() == QET::TitleBlockTemplatesCollection) {
|
if (current_item -> type() == QET::TitleBlockTemplatesCollection) {
|
||||||
QETApp::instance() -> openTitleBlockTemplate(
|
QETApp::instance() -> openTitleBlockTemplate(
|
||||||
elements_panel -> templateLocationForItem(current_item)
|
elements_panel -> templateLocationForItem(current_item)
|
||||||
@@ -332,18 +332,18 @@ void ElementsPanelWidget::updateButtons()
|
|||||||
{
|
{
|
||||||
QTreeWidgetItem *current_item = elements_panel -> currentItem();
|
QTreeWidgetItem *current_item = elements_panel -> currentItem();
|
||||||
int current_type = elements_panel -> currentItemType();
|
int current_type = elements_panel -> currentItemType();
|
||||||
|
|
||||||
if (current_type == QET::Project) {
|
if (current_type == QET::Project) {
|
||||||
bool is_writable = !(elements_panel -> selectedProject() -> isReadOnly());
|
bool is_writable = !(elements_panel -> selectedProject() -> isReadOnly());
|
||||||
prj_add_diagram -> setEnabled(is_writable);
|
prj_add_diagram -> setEnabled(is_writable);
|
||||||
} else if (current_type == QET::Diagram) {
|
} else if (current_type == QET::Diagram) {
|
||||||
Diagram *selected_diagram = elements_panel -> selectedDiagram();
|
Diagram *selected_diagram = elements_panel -> selectedDiagram();
|
||||||
QETProject *selected_diagram_project = selected_diagram -> project();
|
QETProject *selected_diagram_project = selected_diagram -> project();
|
||||||
|
|
||||||
bool is_writable = !(selected_diagram_project -> isReadOnly());
|
bool is_writable = !(selected_diagram_project -> isReadOnly());
|
||||||
int project_diagrams_count = selected_diagram_project -> diagrams().count();
|
int project_diagrams_count = selected_diagram_project -> diagrams().count();
|
||||||
int diagram_position = selected_diagram_project -> diagrams().indexOf(selected_diagram);
|
int diagram_position = selected_diagram_project -> diagrams().indexOf(selected_diagram);
|
||||||
|
|
||||||
prj_del_diagram -> setEnabled(is_writable);
|
prj_del_diagram -> setEnabled(is_writable);
|
||||||
prj_move_diagram_up -> setEnabled(is_writable && diagram_position > 0);
|
prj_move_diagram_up -> setEnabled(is_writable && diagram_position > 0);
|
||||||
prj_move_diagram_down -> setEnabled(is_writable && diagram_position < project_diagrams_count - 1);
|
prj_move_diagram_down -> setEnabled(is_writable && diagram_position < project_diagrams_count - 1);
|
||||||
@@ -373,17 +373,17 @@ void ElementsPanelWidget::handleContextMenu(const QPoint &pos) {
|
|||||||
// recupere l'item concerne par l'evenement ainsi que son chemin
|
// recupere l'item concerne par l'evenement ainsi que son chemin
|
||||||
QTreeWidgetItem *item = elements_panel -> itemAt(pos);
|
QTreeWidgetItem *item = elements_panel -> itemAt(pos);
|
||||||
if (!item) return;
|
if (!item) return;
|
||||||
|
|
||||||
updateButtons();
|
updateButtons();
|
||||||
context_menu -> clear();
|
context_menu -> clear();
|
||||||
|
|
||||||
QString dir_path = elements_panel -> dirPathForItem(item);
|
QString dir_path = elements_panel -> dirPathForItem(item);
|
||||||
if (!dir_path.isEmpty()) {
|
if (!dir_path.isEmpty()) {
|
||||||
context_menu -> addAction(open_directory);
|
context_menu -> addAction(open_directory);
|
||||||
context_menu -> addAction(copy_path);
|
context_menu -> addAction(copy_path);
|
||||||
context_menu -> addSeparator();
|
context_menu -> addSeparator();
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(item -> type()) {
|
switch(item -> type()) {
|
||||||
case QET::Project:
|
case QET::Project:
|
||||||
context_menu -> addAction(prj_activate);
|
context_menu -> addAction(prj_activate);
|
||||||
@@ -408,7 +408,7 @@ void ElementsPanelWidget::handleContextMenu(const QPoint &pos) {
|
|||||||
context_menu -> addAction(tbt_remove);
|
context_menu -> addAction(tbt_remove);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// affiche le menu
|
// affiche le menu
|
||||||
if (!context_menu -> isEmpty()) {
|
if (!context_menu -> isEmpty()) {
|
||||||
context_menu -> popup(mapToGlobal(elements_panel -> mapTo(this, pos + QPoint(2, 2))));
|
context_menu -> popup(mapToGlobal(elements_panel -> mapTo(this, pos + QPoint(2, 2))));
|
||||||
|
|||||||
Reference in New Issue
Block a user