QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
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 
21  const 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, SIGNAL( accepted() ), this, SLOT( accept() ) );
28  connect( mButtonBox, SIGNAL( rejected() ), this, SLOT( 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 
43 {
44 }
45 
virtual void reject()
virtual void addItem(QLayoutItem *item)=0
void rejected()
void accepted()
void setLayout(QLayout *layout)
QgsDialog(QWidget *parent=nullptr, const Qt::WindowFlags &fl=QgisGui::ModalDialogFlags, const QDialogButtonBox::StandardButtons &buttons=QDialogButtonBox::Close, Qt::Orientation orientation=Qt::Horizontal)
Definition: qgsdialog.cpp:20
QDialogButtonBox * mButtonBox
Definition: qgsdialog.h:46
void addWidget(QWidget *w)
virtual void accept()
QVBoxLayout * mLayout
Definition: qgsdialog.h:45
typedef StandardButtons
QVBoxLayout * layout()
Returns the central layout. Widgets added to it must have this dialog as parent.
Definition: qgsdialog.h:40
typedef WindowFlags
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)