// SALOME GUI includes
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
+#include <QtxMenu.h>
// Qt includes
#include <QComboBox>
* \param [in] txt - item text
* \param [in] type - HypType
* \param [in] index - index of item in a list of items
+ * \param [in] isGroup - is the item a group title
*/
//================================================================================
-void SMESHGUI_MeshTab::addItem( const QString& txt, const int type, const int index )
+void SMESHGUI_MeshTab::addItem( const QString& txt,
+ const int type,
+ const int index,
+ const bool isGroup )
{
+ const char* prefix = " ";
if ( type <= AddHyp )
{
- myHypCombo[ type ]->addItem( txt, QVariant( index ));
- myHypCombo[ type ]->setMaxVisibleItems( qMax( 10, myHypCombo[ type ]->count() ) );
+ if ( isGroup )
+ {
+ int idx = myHypCombo[ type ]->count();
+ myHypCombo[ type ]->addItem( txt.mid( 6 ), QVariant( index ));
+ myHypCombo[ type ]->setItemData( idx, "separator", Qt::AccessibleDescriptionRole );
+ }
+ else
+ {
+ myHypCombo[ type ]->addItem( prefix + txt, QVariant( index ));
+ }
+ //myHypCombo[ type ]->setMaxVisibleItems( qMax( 10, myHypCombo[ type ]->count() ) );
}
else
{
- QListWidgetItem* item = new QListWidgetItem( txt, myAddHypList );
+ QListWidgetItem* item = new QListWidgetItem( prefix + txt, myAddHypList );
item->setData( Qt::UserRole, QVariant( index ));
}
}
{
addItem( tr( "NONE"), Algo, 0 );
for ( int i = 0, nbHyp = theHyps.count(); i < nbHyp; ++i )
- addItem( theHyps[i], Algo, i+1 );
+ addItem( theHyps[i], Algo, i+1, theHyps[i].startsWith( "GROUP:" ));
myHypCombo[ Algo ]->setCurrentIndex( 0 );
}
}
{
bool isMainHyp = ( sender() == myCreateHypBtn[ MainHyp ]);
- QMenu aPopup( this );
+ QtxMenu aPopup( this );
QStringList aHypNames = isMainHyp ?
myAvailableHypTypes[ MainHyp ] : myAvailableHypTypes[ AddHyp ];
QList<QAction*> actions;
for ( int i = 0, n = aHypNames.count(); i < n; i++ )
- actions.append( aPopup.addAction( aHypNames[ i ] ) );
-
+ {
+ QAction* a = 0;
+ if ( aHypNames[ i ].startsWith( "GROUP:" ))
+ {
+ aPopup.appendGroupTitle( aHypNames[ i ].mid( 6 ));
+ }
+ else
+ {
+ a = aPopup.addAction( aHypNames[ i ] );
+ }
+ actions.append( a );
+ }
QAction* a = aPopup.exec( QCursor::pos() );
if ( a )
emit createHyp( isMainHyp ? MainHyp : AddHyp, actions.indexOf( a ) );
//================================================================================
void SMESHGUI_MeshTab::onHyp( int theIndex )
{
- const QObject* aSender = sender();
+ QObject* aSender = sender();
+
+ if ( QComboBox* cb = qobject_cast< QComboBox* >( aSender ))
+ {
+ // don't allow selecting a group title
+ if ( cb->itemData( theIndex, Qt::AccessibleDescriptionRole ) == "separator" )
+ {
+ cb->setCurrentIndex( theIndex+1 );
+ return;
+ }
+ }
+
if ( aSender == myHypCombo[ Algo ] )
{
emit selectAlgo( theIndex - 1 ); // - 1 because there is NONE on the top
objectWg( Mesh, Btn )->hide();
objectWg( Geom, Btn )->hide();
}
+ setTitile( theToCreate, theIsMesh );
}
SMESHGUI_MeshDlg::~SMESHGUI_MeshDlg()
{
}
+//================================================================================
+/*!
+ * \brief Set dialog title
+ */
+//================================================================================
+
+void SMESHGUI_MeshDlg::setTitile( const bool theToCreate, const bool theIsMesh )
+{
+ if ( theToCreate )
+ {
+ setWindowTitle( tr( theIsMesh ? "CREATE_MESH" : "CREATE_SUBMESH" ));
+ }
+ else
+ {
+ setWindowTitle( tr( theIsMesh ? "EDIT_MESH" : "EDIT_SUBMESH") );
+ }
+
+}
+
//================================================================================
/*!
* \brief Gets tab with given id