-// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
-//
+// Copyright (C) 2007-2023 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library 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
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library 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
// Lesser General Public License for more details.
//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
// File: LightApp_Dialog.cxx
// Author: Alexander SOLOVYOV
-
-#include <LightApp_Dialog.h>
+//
+#include "LightApp_Dialog.h"
#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
-#include <qtoolbutton.h>
-#include <qlineedit.h>
-#include <qlabel.h>
+#include <QAbstractButton>
+#include <QToolButton>
+#include <QLineEdit>
+#include <QLabel>
/*!
Constructor
*/
LightApp_Dialog::LightApp_Dialog( QWidget* parent, const char* name, bool modal,
- bool allowResize, const int f, WFlags wf )
-: QtxDialog( parent, name, modal, allowResize, f, wf ),
+ bool allowResize, const int f, Qt::WindowFlags wf )
+: QtxDialog( parent, modal, allowResize, f, wf ),
myIsExclusive( true ),
myIsBusy( false )
{
+ setObjectName( name );
setObjectPixmap( "LightApp", tr( "ICON_SELECT" ) );
}
aLast = myObjects.end();
for( ; anIt!=aLast; anIt++ )
{
- QToolButton* but = (QToolButton*)anIt.data().myBtn;
- if( but && but->isOn() )
+ QToolButton* but = (QToolButton*)anIt.value().myBtn;
+ if( but && but->isChecked() )
{
if( id==-1 )
id = anIt.key();
if( anIt.key()!=id )
- but->setOn( false );
+ but->setChecked( false );
}
}
}
if( myObjects.contains( id ) && isObjectShown( id )!=shown )
{
Object& obj = myObjects[ id ];
- obj.myEdit->setShown( shown );
- obj.myBtn->setShown( shown );
- obj.myLabel->setShown( shown );
+ obj.myEdit->setVisible( shown );
+ obj.myBtn->setVisible( shown );
+ obj.myLabel->setVisible( shown );
if( !shown )
- ( ( QToolButton* )obj.myBtn )->setOn( false );
+ ( ( QToolButton* )obj.myBtn )->setChecked( false );
}
}
*/
bool LightApp_Dialog::isObjectShown( const int id ) const
{
- return myObjects.contains( id ) && myObjects[ id ].myEdit->isShown();
+ return myObjects.contains( id ) &&
+ ( myObjects[ id ].myEdit->isVisible() ||
+ myObjects[ id ].myEdit->isVisibleTo( myObjects[ id ].myEdit->parentWidget() ) );
}
/*!
obj.myBtn->setEnabled( en );
// obj.myLabel->setEnabled( en );
if( !en )
- ( ( QToolButton* )obj.myBtn )->setOn( false );
+ ( ( QToolButton* )obj.myBtn )->setChecked( false );
}
}
void LightApp_Dialog::selectObject( const QStringList& _names,
const TypesList& _types,
const QStringList& _ids,
- const bool update )
+ const bool update )
{
ObjectMap::iterator anIt = myObjects.begin(),
aLast = myObjects.end();
for( ; anIt!=aLast; anIt++ )
- if( anIt.data().myBtn->isOn() )
+ if( anIt.value().myBtn->isChecked() )
selectObject( anIt.key(), _names, _types, _ids, update );
}
myObjects[ id ].myTypes.clear();
myObjects[ id ].myNames.clear();
- myObjects[ id ].myEdit->setText( QString::null );
+ myObjects[ id ].myEdit->setText( QString() );
emit selectionChanged( id );
}
}
myObjects[ nid ].myLabel = lab;
QToolButton* but = new QToolButton( parent );
- but->setIconSet( QIconSet( myPixmap ) );
- but->setToggleButton( true );
+ but->setIcon( QIcon( myPixmap ) );
+ but->setCheckable( true );
but->setMaximumWidth( but->height() );
but->setMinimumWidth( but->height() );
connect( but, SIGNAL( toggled( bool ) ), this, SLOT( onToggled( bool ) ) );
*/
void LightApp_Dialog::onToggled( bool on )
{
- QButton* but = ( QButton* )sender();
+ QAbstractButton* but = ( QAbstractButton* )sender();
int id = -1;
if( !but )
ObjectMap::const_iterator anIt = myObjects.begin(),
aLast = myObjects.end();
for( ; anIt!=aLast && id==-1; anIt++ )
- if( anIt.data().myBtn==but )
+ if( anIt.value().myBtn==but )
id = anIt.key();
if( id!=-1 )
+ {
if( on )
{
updateButtons( id );
}
else
emit objectDeactivated( id );
+ }
}
/*!
ObjectMap::const_iterator anIt = myObjects.begin(),
aLast = myObjects.end();
for( ; anIt!=aLast; anIt++ )
- ( ( QToolButton* )anIt.data().myBtn )->setIconSet( p );
+ ( ( QToolButton* )anIt.value().myBtn )->setIcon( p );
}
/*!
aLast = myObjects.end();
for( ; anIt!=aLast; anIt++ )
{
- anIt.data().myNI = ni;
+ anIt.value().myNI = ni;
setReadOnly( anIt.key(), isReadOnly( anIt.key() ) );
aNext = anIt; aNext++;
updateObject( anIt.key(), aNext==aLast );
return "LightApp_Dialog::selectionDescription(): Error!!!";
if( names.isEmpty() )
- return QString::null;
+ return QString();
switch( ni )
{
return countOfTypes( types );
break;
};
- return QString::null;
+ return QString();
}
/*!
QMap<int,int>::const_iterator aMIt = typesCount.begin(),
aMLast = typesCount.end();
for( ; aMIt!=aMLast; aMIt++ )
- typeCount.append( QString( "%1 %2" ).arg( aMIt.data() ).arg( typeName( aMIt.key() ) ) );
+ typeCount.append( QString( "%1 %2" ).arg( aMIt.value() ).arg( typeName( aMIt.key() ) ) );
return typeCount.join( ", " );
}
\return const reference to type name
\param type - integer id of type
*/
-const QString& LightApp_Dialog::typeName( const int type ) const
+const QString LightApp_Dialog::typeName( const int type ) const
{
return myTypeNames[ type ];
}
*/
void LightApp_Dialog::activateObject( const int theId )
{
- if ( myObjects.contains( theId ) && !myObjects[ theId ].myBtn->isOn() )
+ if ( myObjects.contains( theId ) && !myObjects[ theId ].myBtn->isChecked() )
myObjects[ theId ].myBtn->toggle();
}
aLast = myObjects.end();
for( ; anIt!=aLast; anIt++ )
{
- QToolButton* btn = ( QToolButton* )anIt.data().myBtn;
- btn->setOn( false );
+ QToolButton* btn = ( QToolButton* )anIt.value().myBtn;
+ btn->setChecked( false );
}
}
ObjectMap::const_iterator anIt = myObjects.begin(),
aLast = myObjects.end();
for( ; anIt!=aLast; anIt++ )
- if( anIt.data().myEdit == edit )
+ if( anIt.value().myEdit == edit )
id = anIt.key();
if( id>=0 && !isReadOnly( id ) )
{
- QStringList list = QStringList::split( " ", text );
+ QStringList list = text.split( " ", QString::SkipEmptyParts );
emit objectChanged( id, list );
}
}