Skip to content

Commit 2dfd558

Browse files
committed
Fixed issue that after showing label outline with Ctrl+L, the 2D view lost focus
1 parent 821fb74 commit 2dfd558

File tree

5 files changed

+60
-13
lines changed

5 files changed

+60
-13
lines changed

freeview/MainWindow.cpp

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ MainWindow::MainWindow( QWidget *parent, MyCmdLineParser* cmdParser ) :
197197
addAction(ui->actionDeleteLayer);
198198

199199
addAction(ui->actionNextLabelPoint);
200+
addAction(ui->actionShowLabelOutline);
200201

201202
#ifdef DISABLE_LINEPROF
202203
ui->actionLineProfile->setVisible(false);
@@ -808,7 +809,7 @@ void MainWindow::closeEvent( QCloseEvent * event )
808809
msg += "\nDo you still want to quit?";
809810
QMessageBox msgbox(this);
810811
msgbox.setIcon(QMessageBox::Question);
811-
QAbstractButton* yesBtn = msgbox.addButton("Quit", QMessageBox::YesRole);
812+
QAbstractButton* yesBtn = msgbox.addButton("Quit without Saving", QMessageBox::YesRole);
812813
msgbox.addButton("Cancel", QMessageBox::NoRole);
813814
msgbox.setText(msg);
814815
msgbox.setWindowTitle("Warning");
@@ -5739,9 +5740,12 @@ bool MainWindow::OnCloseVolume(const QList<Layer*>& layers_in)
57395740
{
57405741
if ( qobject_cast<LayerMRI*>(layer)->IsModified() )
57415742
{
5742-
if ( QMessageBox::question( this, "Volume Not Saved",
5743-
"Volume has been modifed and not been saved. Do you still want to continue?",
5744-
QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No )
5743+
QMessageBox box(QMessageBox::Question, tr("Close Volume"),
5744+
"Volume has been modifed and not been saved. Do you still want to continue?",
5745+
QMessageBox::Yes | QMessageBox::Cancel);
5746+
box.setButtonText(QMessageBox::Yes, tr("Continue Without Saving"));
5747+
box.setDefaultButton(QMessageBox::Cancel);
5748+
if (box.exec() != QMessageBox::Yes)
57455749
{
57465750
return false;
57475751
}
@@ -6169,9 +6173,12 @@ void MainWindow::OnCloseROI(const QList<Layer*>& layers_in)
61696173
{
61706174
if ( qobject_cast<LayerROI*>(layer)->IsModified() )
61716175
{
6172-
if ( QMessageBox::question( this, "ROI Not Saved",
6173-
"ROI has been modifed and not been saved. Do you still want to continue?",
6174-
QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No )
6176+
QMessageBox box(QMessageBox::Question, tr("Close ROI"),
6177+
"ROI has been modifed and not been saved. Do you still want to continue?",
6178+
QMessageBox::Yes | QMessageBox::Cancel);
6179+
box.setButtonText(QMessageBox::Yes, tr("Continue Without Saving"));
6180+
box.setDefaultButton(QMessageBox::Cancel);
6181+
if (box.exec() != QMessageBox::Yes)
61756182
{
61766183
return;
61776184
}
@@ -6388,9 +6395,12 @@ void MainWindow::OnClosePointSet(const QList<Layer*>& layers_in)
63886395
{
63896396
if ( qobject_cast<LayerPointSet*>(layer)->IsModified() )
63906397
{
6391-
if ( QMessageBox::question( this, "Point Set Not Saved",
6392-
"Point set has been modifed and not been saved. Do you still want to continue?",
6393-
QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No )
6398+
QMessageBox box(QMessageBox::Question, tr("Close Point Set"),
6399+
"Point Set has been modifed and not been saved. Do you still want to continue?",
6400+
QMessageBox::Yes | QMessageBox::Cancel);
6401+
box.setButtonText(QMessageBox::Yes, tr("Continue Without Saving"));
6402+
box.setDefaultButton(QMessageBox::Cancel);
6403+
if (box.exec() != QMessageBox::Yes)
63946404
{
63956405
return;
63966406
}
@@ -9868,3 +9878,12 @@ void MainWindow::SetNeurologicalView(bool b)
98689878
((RenderView2D*)m_views[i])->SetNeurologicalView(b);
98699879
}
98709880
}
9881+
9882+
void MainWindow::OnShowLabelOutline(bool bShow)
9883+
{
9884+
LayerMRI* mri = (LayerMRI*)GetLayerCollection( "MRI" )->GetActiveLayer();
9885+
if ( mri )
9886+
{
9887+
mri->GetProperty()->SetShowLabelOutline(bShow);
9888+
}
9889+
}

freeview/MainWindow.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,8 @@ protected slots:
632632

633633
void OnDeleteLayer();
634634

635+
void OnShowLabelOutline(bool bShow);
636+
635637
private:
636638
bool DoParseCommand(MyCmdLineParser* parser, bool bAutoQuit);
637639
void SaveSettings();

freeview/MainWindow.ui

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1862,6 +1862,17 @@
18621862
<string>Alt+O</string>
18631863
</property>
18641864
</action>
1865+
<action name="actionShowLabelOutline">
1866+
<property name="checkable">
1867+
<bool>true</bool>
1868+
</property>
1869+
<property name="text">
1870+
<string>Show Label Outline</string>
1871+
</property>
1872+
<property name="shortcut">
1873+
<string>Ctrl+L</string>
1874+
</property>
1875+
</action>
18651876
</widget>
18661877
<layoutdefault spacing="6" margin="11"/>
18671878
<customwidgets>
@@ -3861,6 +3872,22 @@
38613872
</hint>
38623873
</hints>
38633874
</connection>
3875+
<connection>
3876+
<sender>actionShowLabelOutline</sender>
3877+
<signal>toggled(bool)</signal>
3878+
<receiver>MainWindow</receiver>
3879+
<slot>OnShowLabelOutline(bool)</slot>
3880+
<hints>
3881+
<hint type="sourcelabel">
3882+
<x>-1</x>
3883+
<y>-1</y>
3884+
</hint>
3885+
<hint type="destinationlabel">
3886+
<x>606</x>
3887+
<y>435</y>
3888+
</hint>
3889+
</hints>
3890+
</connection>
38643891
</connections>
38653892
<slots>
38663893
<signal>CycleOverlayRequested()</signal>
@@ -3978,5 +4005,6 @@
39784005
<slot>OnCopyView()</slot>
39794006
<slot>OnDeleteLayer()</slot>
39804007
<slot>SetNeurologicalView(bool)</slot>
4008+
<slot>OnShowLabelOutline(bool)</slot>
39814009
</slots>
39824010
</ui>

freeview/PanelVolume.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ void PanelVolume::DoIdle()
354354
bool bDataAvail = (!strgs.isEmpty() && strgs[0] == FS_VOLUME_SETTING_ID);
355355
ui->actionPasteSetting->setEnabled(layer && bDataAvail);
356356
ui->actionPasteSettingToAll->setEnabled(layer && bDataAvail);
357+
ui->checkBoxShowOutline->setChecked(layer && layer->GetProperty()->GetShowLabelOutline());
357358
BlockAllSignals( false );
358359
}
359360

freeview/PanelVolume.ui

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,9 +1290,6 @@ of each frame</string>
12901290
<property name="text">
12911291
<string>Show label outline only (Ctrl+L)</string>
12921292
</property>
1293-
<property name="shortcut">
1294-
<string>Ctrl+L</string>
1295-
</property>
12961293
</widget>
12971294
</item>
12981295
<item>

0 commit comments

Comments
 (0)