2 updates for the standard plugin window: 1) it recovers its last size when it is undocked and 2) it closes itself when a filter is applied (only if it is floating)

This commit is contained in:
Paolo Cignoni cignoni 2006-12-13 21:54:35 +00:00
parent 0b4e4be84e
commit 6ffd93029e
2 changed files with 125 additions and 6 deletions

View File

@ -1,3 +1,38 @@
/****************************************************************************
* MeshLab o o *
* An extendible mesh processor o o *
* _ O _ *
* Copyright(C) 2005, 2006 \/)\/ *
* Visual Computing Lab /\/| *
* ISTI - Italian National Research Council | *
* \ *
* All rights reserved. *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
* for more details. *
* *
****************************************************************************/
/****************************************************************************
History
$Log$
Revision 1.2 2006/12/13 21:54:35 pirosu
2 updates for the standard plugin window: 1) it recovers its last size when it is undocked and 2) it closes itself when a filter is applied (only if it is floating)
Revision 1.0 2006/12/13 17:37:02 pirosu
Added standard plugin window support
****************************************************************************/
#include "stdpardialog.h"
@ -19,6 +54,10 @@ void MeshlabStdDialog::loadPluginAction(MeshFilterInterface *mfi,MeshModel *mm,Q
/* checks wether the plugin action wants to handle parameters input by the standard plugin window or by itself */
if(!mfi->getStdFields(q,*mm,parlist,&actiondesc,&extraw))
{
if(this->isFloating())
this->hide();
/* the plugin action wants to handle parameters input by itself: the executeFilter() function is directly called */
mwi->executeFilter(q,NULL);
}
@ -128,7 +167,7 @@ void MeshlabStdDialog::loadPluginAction(MeshFilterInterface *mfi,MeshModel *mm,Q
void MeshlabStdDialog::applyClick()
{
FilterParameter par;
qf->setEnabled(false);
QAction *q = curaction;
par.clear();
for(int i = 0; i < parlist.count(); i++)
@ -150,9 +189,44 @@ void MeshlabStdDialog::applyClick()
break;
}
}
this->repaint();
curmwi->executeFilter(curaction,&par);
resetMe();
if(this->isFloating())
this->hide();
else
this->repaint();
curmwi->executeFilter(q,&par);
}
void MeshlabStdDialog::topLevelChanged (bool topLevel)
{
if(topLevel)
restorelastsize = true; /* i want to restore the old size but i can't do it here
because, after the topLevelChanged event, QT wants to
resize the window, so i must postpone the resize in order
to prevent being overridden by the QT resize */
}
void MeshlabStdDialog::resizeEvent ( QResizeEvent * event )
{
if(!this->isFloating())
return;
if(restorelastsize)
{
this->resize(lastsize);
restorelastsize = false;
// this is the only way to convince QT to refresh the window clipcontrols...
this->hide();
this->showNormal();
}
else
{
QSize siz = this->size();
lastsize.setWidth(siz.width());
lastsize.setHeight(siz.height());
}
}

View File

@ -1,3 +1,38 @@
/****************************************************************************
* MeshLab o o *
* An extendible mesh processor o o *
* _ O _ *
* Copyright(C) 2005, 2006 \/)\/ *
* Visual Computing Lab /\/| *
* ISTI - Italian National Research Council | *
* \ *
* All rights reserved. *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
* for more details. *
* *
****************************************************************************/
/****************************************************************************
History
$Log$
Revision 1.2 2006/12/13 21:54:35 pirosu
2 updates for the standard plugin window: 1) it recovers its last size when it is undocked and 2) it closes itself when a filter is applied (only if it is floating)
Revision 1.0 2006/12/13 17:37:02 pirosu
Added standard plugin window support
****************************************************************************/
#ifndef MESHLAB_STDPARDIALOG_H
#define MESHLAB_STDPARDIALOG_H
@ -31,11 +66,17 @@ public:
{
qf = NULL;
initValues();
//resetMe();
QSize siz = this->size();
lastsize.setWidth(siz.width());
lastsize.setHeight(siz.height());
restorelastsize = false;
connect(this,SIGNAL(topLevelChanged(bool)),this,SLOT(topLevelChanged(bool)));
}
void initValues();
void resetMe();
void resizeEvent(QResizeEvent *e);
void loadPluginAction(MeshFilterInterface *mfi,MeshModel *mm,QAction *q,MainWindowInterface *mwi);
@ -43,6 +84,7 @@ public:
private slots:
void applyClick();
void topLevelChanged(bool);
protected:
QFrame *qf;
@ -51,6 +93,9 @@ protected:
QVector<QWidget *> stdfieldwidgets;
QWidget *curextra;
StdParList parlist;
bool restorelastsize;
QSize lastsize;
};