Commit 49ca1398 authored by Sylvain Thery's avatar Sylvain Thery

remove bug compilation qtpopup

add buttons parameter in popup
parent 1dad1ea8
......@@ -91,10 +91,12 @@ IF(WITH_QT)
${CGoGN_ROOT_DIR}/include/Utils/Qt/*.hpp
${CGoGN_ROOT_DIR}/include/Utils/Qt/*.h )
file(
GLOB_RECURSE
GLOB
utils_qt_headers
${CGoGN_ROOT_DIR}/include/Utils/Qt/qtgl.h
${CGoGN_ROOT_DIR}/include/Utils/Qt/qtSimple.h )
${CGoGN_ROOT_DIR}/include/Utils/Qt/qtSimple.h
${CGoGN_ROOT_DIR}/include/Utils/Qt/qtpopup.h
${CGoGN_ROOT_DIR}/include/Utils/Qt/qtcolorschooser.h )
QT4_WRAP_CPP(UTILS_QT_HEADERS_MOC ${utils_qt_headers})
SET (files_utils_withQt ${files_utils} ${files_utils_qt} ${UTILS_QT_HEADERS_MOC})
......
......@@ -79,18 +79,20 @@ file(
)
IF(WITH_QT)
file(
GLOB
files_utils_qt
${CGoGN_ROOT_DIR}/src/Utils/Qt/*.cpp
${CGoGN_ROOT_DIR}/include/Utils/Qt/*.hpp
${CGoGN_ROOT_DIR}/include/Utils/Qt/*.h )
file(
GLOB_RECURSE
GLOB
utils_qt_headers
${CGoGN_ROOT_DIR}/include/Utils/Qt/qtgl.h
${CGoGN_ROOT_DIR}/include/Utils/Qt/qtSimple.h )
${CGoGN_ROOT_DIR}/include/Utils/Qt/qtSimple.h
${CGoGN_ROOT_DIR}/include/Utils/Qt/qtpopup.h
${CGoGN_ROOT_DIR}/include/Utils/Qt/qtcolorschooser.h )
QT4_WRAP_CPP(UTILS_QT_HEADERS_MOC ${utils_qt_headers})
SET (files_utils_withQt ${files_utils} ${files_utils_qt} ${UTILS_QT_HEADERS_MOC})
......
......@@ -46,18 +46,21 @@ namespace QT
class QtPopUp : public QDialog
{
Q_OBJECT
QGridLayout* m_layout;
public:
/**
* create an empty popup
* @param withButtons add OK/CANCEL to the popup (exec launch blocking popup & return 1/0)
*/
QtPopUp();
QtPopUp(bool withButtons=false);
/**
* create a popup with one widget
*/
QtPopUp(QWidget* wid);
*
*/
virtual ~QtPopUp();
/**
* add a widget in the grid layout
......
......@@ -36,7 +36,7 @@ namespace QT
ColorsChooser::ColorsChooser(SimpleQT *interf):
m_interf(interf)
QtPopUp(false),m_interf(interf),m_current(0)
{
m_list = new QListWidget();
m_diag = new QColorDialog();
......
......@@ -22,6 +22,9 @@
* *
*******************************************************************************/
#include "Utils/Qt/qtpopup.h"
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QPushButton>
namespace CGoGN
{
......@@ -31,23 +34,42 @@ namespace QT
{
QtPopUp::QtPopUp()
QtPopUp::QtPopUp(bool withButtons)
{
m_layout = new QGridLayout(this);
setLayout(m_layout);
}
if (withButtons)
{
QVBoxLayout *vlayout = new QVBoxLayout(this);
m_layout = new QGridLayout(NULL);
vlayout->addLayout(m_layout);
QtPopUp::QtPopUp(QWidget* wid)
{
m_layout = new QGridLayout(this);
QHBoxLayout *layButtons = new QHBoxLayout();
QPushButton* okbutton = new QPushButton( "OK", this );
QObject::connect( okbutton, SIGNAL( clicked() ), this, SLOT( accept() ) );
QPushButton* cancelbutton = new QPushButton( "Cancel", this );
QObject::connect( cancelbutton, SIGNAL( clicked() ), this, SLOT( reject() ) );
// TO LAYOUT
layButtons->addWidget(okbutton);
layButtons->addWidget(cancelbutton);
vlayout->addLayout(layButtons);
m_layout->addWidget(wid);
setLayout(vlayout);
setLayout(m_layout);
}
else
{
m_layout = new QGridLayout(this);
setLayout(m_layout);
}
}
QtPopUp::~QtPopUp()
{
}
void QtPopUp::addWidget(QWidget* wid, int col, int row)
{
m_layout->addWidget(wid,col,row);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment