From 71fb8333a9824ae7ddb1af3b22d2dbc3ca183b28 Mon Sep 17 00:00:00 2001 From: ana Date: Wed, 7 Sep 2016 12:20:14 +0300 Subject: [PATCH] Fix for "0053111: 'Restore view' dialog does not process the change of selected item by keyboard" issue --- .../OCCViewer_CreateRestoreViewDlg.cxx | 17 +++++++++-------- src/OCCViewer/OCCViewer_CreateRestoreViewDlg.h | 4 ++-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.cxx b/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.cxx index 97b9b2363..f5650ce56 100755 --- a/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.cxx +++ b/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.cxx @@ -40,7 +40,7 @@ OCCViewer_CreateRestoreViewDlg::OCCViewer_CreateRestoreViewDlg( QWidget* aWin, O myParametersMap = theViewWindow->getViewAspects(); - myKeyFlag = 0; +// myKeyFlag = 0; int aQuantityOfItems = myParametersMap.count(); @@ -70,7 +70,7 @@ OCCViewer_CreateRestoreViewDlg::OCCViewer_CreateRestoreViewDlg( QWidget* aWin, O myListBox->insertItem( i, myParametersMap[ i ].name ); myListBox->item( i )->setFlags( myListBox->item( i )->flags() | Qt::ItemIsEditable ); } - + myListBox->item( 0 )->setSelected( true ); changeImage( myListBox->item( 0 ) ); } else @@ -78,8 +78,9 @@ OCCViewer_CreateRestoreViewDlg::OCCViewer_CreateRestoreViewDlg( QWidget* aWin, O myListBox->clear(); myListBox->insertItem( 0, "No Items" ); } - - connect( myListBox, SIGNAL( itemClicked( QListWidgetItem* ) ), this, SLOT( changeImage( QListWidgetItem* ) ) ); + myListBox->setSelectionMode( QAbstractItemView::SingleSelection ); +// connect( myListBox, SIGNAL( itemClicked( QListWidgetItem* ) ), this, SLOT( changeImage( QListWidgetItem* ) ) ); + connect( myListBox, SIGNAL( currentItemChanged(QListWidgetItem*, QListWidgetItem *)), this, SLOT( changeImage( QListWidgetItem* ) ) ); connect( myListBox, SIGNAL( itemChanged( QListWidgetItem* ) ), this, SLOT( editItemText( QListWidgetItem* ) ) ); aLayout->addWidget( myListBox ); @@ -126,7 +127,7 @@ void OCCViewer_CreateRestoreViewDlg::changeImage( QListWidgetItem* curItem ) int lowLevel = -1; int highLevel = -1; int index = curItem->listWidget()->row( curItem ); - if( myKeyFlag == 2 ) + /* if( myKeyFlag == 2 ) { for( int i = 0; i < (int)myListBox->count(); i++ ) { @@ -151,7 +152,7 @@ void OCCViewer_CreateRestoreViewDlg::changeImage( QListWidgetItem* curItem ) myListBox->item( i )->setSelected( true ); } } - + */ Handle(V3d_View) aView3d = myCurViewPort->getView(); myCurrentItem = myParametersMap[ index ]; @@ -260,7 +261,7 @@ void OCCViewer_CreateRestoreViewDlg::editItemText( QListWidgetItem* anItem ) /*! Custom event filter */ -bool OCCViewer_CreateRestoreViewDlg::eventFilter( QObject* anObj, QEvent* anEv ) +/*bool OCCViewer_CreateRestoreViewDlg::eventFilter( QObject* anObj, QEvent* anEv ) { if( anEv->type() == QEvent::KeyPress ) { @@ -287,7 +288,7 @@ bool OCCViewer_CreateRestoreViewDlg::eventFilter( QObject* anObj, QEvent* anEv ) myListBox->setSelectionMode( QAbstractItemView::SingleSelection ); } return QWidget::eventFilter( anObj, anEv ); -} +}*/ /*! SLOT: called on OK click, emits dlgOk() and closes dialog diff --git a/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.h b/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.h index 2edcb60e1..d7a32b103 100755 --- a/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.h +++ b/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.h @@ -51,7 +51,7 @@ public: const viewAspectList& parameters() const; viewAspect currentItem() const; - virtual bool eventFilter( QObject*, QEvent* ); +// virtual bool eventFilter( QObject*, QEvent* ); public slots: void OKpressed(); @@ -64,7 +64,7 @@ signals: void dlgOk(); private: - int myKeyFlag; +// int myKeyFlag; QListWidget* myListBox; OCCViewer_ViewPort3d* myCurViewPort; viewAspect myCurrentItem; -- 2.39.2