Tulip  6.0.0
Large graphs analysis and drawing
NeedConfigurationMsgBox.h
1 /**
2  *
3  * This file is part of Tulip (https://tulip.labri.fr)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux
7  *
8  * Tulip is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation, either version 3
11  * of the License, or (at your option) any later version.
12  *
13  * Tulip is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  */
19 
20 #ifndef NEED_CONFIG_MSG_BOX_H
21 #define NEED_CONFIG_MSG_BOX_H
22 
23 #include <QAbstractButton>
24 #include <QApplication>
25 #include <QDialogButtonBox>
26 #include <QFormLayout>
27 #include <QFrame>
28 #include <QHBoxLayout>
29 #include <QLabel>
30 #include <QSpacerItem>
31 #include <QVBoxLayout>
32 #include <tulip/Perspective.h>
33 
34 QFrame *new_NeedConfigurationMsgBox(QString text, QPushButton **okButton) {
35  QFrame *frame = new QFrame();
36  frame->setFrameShape(QFrame::Box);
37  frame->setFrameShadow(QFrame::Plain);
38  QVBoxLayout *frameLayout = new QVBoxLayout(frame);
39  QFormLayout *formLayout = new QFormLayout();
40  QLabel *warningLabel = new QLabel(frame);
41  warningLabel->setText(
42  "<html><head/><body><p><span style=\" font-size:18pt; font-weight:600; color:#a51d2d;\">Warning !</span></p></body></html>");
43  formLayout->setWidget(0, QFormLayout::LabelRole, warningLabel);
44 
45  QVBoxLayout *verticalLayout = new QVBoxLayout();
46  QLabel *warningText = new QLabel(text, frame);
47  verticalLayout->addWidget(warningText);
48 
49  QSpacerItem *verticalSpacer =
50  new QSpacerItem(20, 40, QSizePolicy::Policy::Minimum, QSizePolicy::Policy::Expanding);
51  verticalLayout->addItem(verticalSpacer);
52 
53  QHBoxLayout *horizontalLayout = new QHBoxLayout();
54  QDialogButtonBox *buttonBox = new QDialogButtonBox(frame);
55  buttonBox->setStandardButtons(QDialogButtonBox::Ok);
56  *okButton = buttonBox->button(QDialogButtonBox::Ok);
57 
58  horizontalLayout->addWidget(buttonBox);
59  verticalLayout->addLayout(horizontalLayout);
60  formLayout->setLayout(0, QFormLayout::FieldRole, verticalLayout);
61  frameLayout->addLayout(formLayout);
62 
63  // set a specific name before applying style sheet
64  frame->setObjectName("needConfigurationMessageBox");
66  frame->resize(/*416, 158*/ 365, 151);
67 
68  return frame;
69 }
70 
71 #endif // NEED_CONFIG_MSG_BOX_H
static void setStyleSheet(QWidget *w)
a static function to set the same style sheet as the instance main window style sheet