QGIS API Documentation  3.4.15-Madeira (e83d02e274)
qgsdialog.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsdialog.cpp
3  -------------------
4  begin : July 2012
5  copyright : (C) 2012 by Etienne Tourigny
6  email : etourigny dot dev at gmail dot com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #include "qgsdialog.h"
19 
20 QgsDialog::QgsDialog( QWidget *parent, Qt::WindowFlags fl,
21  QDialogButtonBox::StandardButtons buttons,
22  Qt::Orientation orientation )
23  : QDialog( parent, fl )
24 {
25  // create buttonbox
26  mButtonBox = new QDialogButtonBox( buttons, orientation, this );
27  connect( mButtonBox, &QDialogButtonBox::accepted, this, &QDialog::accept );
28  connect( mButtonBox, &QDialogButtonBox::rejected, this, &QDialog::reject );
29 
30  // layout
31  QLayout *layout = nullptr;
32  if ( orientation == Qt::Horizontal )
33  layout = new QVBoxLayout();
34  else
35  layout = new QHBoxLayout();
36  mLayout = new QVBoxLayout();
37  layout->addItem( mLayout );
38  layout->addWidget( mButtonBox );
39  setLayout( layout );
40 }
41 
QDialogButtonBox * mButtonBox
Definition: qgsdialog.h:52
QgsDialog(QWidget *parent=nullptr, Qt::WindowFlags fl=QgsGuiUtils::ModalDialogFlags, QDialogButtonBox::StandardButtons buttons=QDialogButtonBox::Close, Qt::Orientation orientation=Qt::Horizontal)
Constructor for QgsDialog.
Definition: qgsdialog.cpp:20
QVBoxLayout * mLayout
Definition: qgsdialog.h:51
QVBoxLayout * layout()
Returns the central layout. Widgets added to it must have this dialog as parent.
Definition: qgsdialog.h:46