Skip to content
Permalink
Browse files

changed attributes window style and recycling existing window

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5202 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rblazek
rblazek committed Apr 6, 2006
1 parent 8cd51e9 commit ed607df62eeff5e8879bdc810091717216c5f1a2
@@ -102,6 +102,8 @@ QgsGrassAttributes::QgsGrassAttributes ( QgsGrassEdit *edit, QgsGrassProvider *p
tabCats->removePage( tabCats->currentPage() );
}

connect ( this, SIGNAL(destroyed()), mEdit, SLOT(attributesClosed()) );

// TODO: does not work:
connect( tabCats, SIGNAL(void currentChanged(QWidget *)), this, SLOT(tabChanged(QWidget *)));

@@ -352,6 +354,21 @@ void QgsGrassAttributes::deleteCat ( )
resetButtons();
}

void QgsGrassAttributes::clear ( )
{
#ifdef QGISDEBUG
std::cerr << "QgsGrassAttributes::clear()" << std::endl;
#endif

while ( tabCats->count() > 0 )
{
Q3Table *tb = (Q3Table *) tabCats->currentPage();
tabCats->removePage( tb );
delete tb;
}
resetButtons();
}

void QgsGrassAttributes::tabChanged ( QWidget *widget )
{
#ifdef QGISDEBUG
@@ -57,7 +57,8 @@ class QgsGrassAttributes: public QDialog, private Ui::QgsGrassAttributesBase
//! Constructor
QgsGrassAttributes ( QgsGrassEdit *edit, QgsGrassProvider *provider, int line,
QWidget * parent = 0, const char * name = 0,
Qt::WFlags f = Qt::WStyle_Customize | Qt::WStyle_DialogBorder | Qt::WStyle_Title | Qt::WType_Dialog | Qt::WStyle_Tool);
Qt::WFlags f = Qt::Window );
//Qt::WFlags f = Qt::WStyle_Customize | Qt::WStyle_DialogBorder | Qt::WStyle_Title | Qt::WType_Dialog | Qt::WStyle_Tool);

//! Destructor
~QgsGrassAttributes();
@@ -102,6 +103,9 @@ public slots:
//! Column size changed
void columnSizeChanged ( int section, int oldSize, int newSize );

//! Remove all tabs
void clear();

private:
//! Pointer to vector provider
QgsGrassProvider *mProvider;
@@ -1693,3 +1693,8 @@ void QgsGrassEdit::setCanvasPropmt( QString left, QString mid, QString rigth)
if ( mid.length() > 0 ) mCanvasPrompt.append ( tr("Middle: ") + mid + " " );
if ( rigth.length() > 0 ) mCanvasPrompt.append ( tr("Rigth: ") + rigth );
}

void QgsGrassEdit::attributesClosed()
{
mAttributes = 0;
}
@@ -210,6 +210,9 @@ public slots:

static bool isEditable ( QgsMapLayer *layer );

//! Window with attributes closed
void attributesClosed();

signals:
void finished();

@@ -90,12 +90,19 @@ void QgsGrassEditNewPoint::mouseClick(QgsPoint & point, Qt::ButtonState button)
e->updateSymb();
e->displayUpdated();

if ( e->mAttributes ) delete e->mAttributes;
e->mAttributes = new QgsGrassAttributes ( e, e->mProvider, line, e->mQgisApp );
if ( e->mAttributes )
{
e->mAttributes->clear();
}
else
{
e->mAttributes = new QgsGrassAttributes ( e, e->mProvider, line, e->mQgisApp );
}
for ( int i = 0; i < e->mCats->n_cats; i++ ) {
e->addAttributes ( e->mCats->field[i], e->mCats->cat[i] );
}
e->mAttributes->show();
e->mAttributes->raise();
}


@@ -170,12 +177,19 @@ void QgsGrassEditNewLine::mouseClick(QgsPoint & point, Qt::ButtonState button)
e->updateSymb();
e->displayUpdated();

if ( e->mAttributes ) delete e->mAttributes;
e->mAttributes = new QgsGrassAttributes ( e, e->mProvider, line, e->mQgisApp );
if ( e->mAttributes )
{
e->mAttributes->clear();
}
else
{
e->mAttributes = new QgsGrassAttributes ( e, e->mProvider, line, e->mQgisApp );
}
for ( int i = 0; i < e->mCats->n_cats; i++ ) {
e->addAttributes ( e->mCats->field[i], e->mCats->cat[i] );
}
e->mAttributes->show();
e->mAttributes->raise();
}
Vect_reset_line ( e->mEditPoints );
break;
@@ -756,21 +770,26 @@ void QgsGrassEditAttributes::mouseClick(QgsPoint & point, Qt::ButtonState button
std::cerr << "mSelectedLine = " << e->mSelectedLine << std::endl;
#endif

if ( e->mAttributes ) {
delete e->mAttributes;
e->mAttributes = 0;
if ( e->mAttributes )
{
e->mAttributes->clear();
e->mAttributes->raise();
}

if ( e->mSelectedLine ) { // highlite
e->displayElement ( e->mSelectedLine, e->mSymb[QgsGrassEdit::SYMB_HIGHLIGHT], e->mSize );

e->mProvider->readLine ( NULL, e->mCats, e->mSelectedLine );

e->mAttributes = new QgsGrassAttributes ( e, e->mProvider, e->mSelectedLine, e->mQgisApp );
if ( !e->mAttributes )
{
e->mAttributes = new QgsGrassAttributes ( e, e->mProvider, e->mSelectedLine, e->mQgisApp );
}
for ( int i = 0; i < e->mCats->n_cats; i++ ) {
e->addAttributes ( e->mCats->field[i], e->mCats->cat[i] );
}
e->mAttributes->show();
e->mAttributes->raise();
}

}

0 comments on commit ed607df

Please sign in to comment.
You can’t perform that action at this time.