Fixed a crash when closing the DatabaseViewer dialog on Mac OS X. Added "Close" button when it is in modal window mode for Mac OS X too

This commit is contained in:
matlabbe
2015-04-28 13:04:35 -04:00
parent f7328c0362
commit 08a3a001f5
6 changed files with 33 additions and 4 deletions

View File

@@ -83,7 +83,10 @@ CloudViewer::CloudViewer(QWidget *parent) :
this->SetRenderWindow(_visualizer->getRenderWindow());
_visualizer->setupInteractor(this->GetInteractor(), this->GetRenderWindow());
// Replaced by the second line, to avoid a crash in Mac OS X on close, as well as
// the "Invalid drawable" warning when the view is not visible.
//_visualizer->setupInteractor(this->GetInteractor(), this->GetRenderWindow());
this->GetInteractor()->SetInteractorStyle (_visualizer->getInteractorStyle());
_visualizer->registerMouseCallback (&CloudViewer::mouseEventOccurred, *this, (void*)_visualizer);
_visualizer->setCameraPosition(

View File

@@ -79,6 +79,8 @@ DatabaseViewer::DatabaseViewer(QWidget * parent) :
ui_ = new Ui_DatabaseViewer();
ui_->setupUi(this);
ui_->buttonBox->setVisible(false);
connect(ui_->buttonBox->button(QDialogButtonBox::Close), SIGNAL(clicked()), this, SLOT(close()));
QString title("RTAB-Map Database Viewer[*]");
this->setWindowTitle(title);
@@ -275,6 +277,11 @@ DatabaseViewer::~DatabaseViewer()
}
}
void DatabaseViewer::showCloseButton(bool visible)
{
ui_->buttonBox->setVisible(visible);
}
void DatabaseViewer::configModified()
{
this->setWindowModified(true);

View File

@@ -2538,6 +2538,7 @@ void MainWindow::editDatabase()
DatabaseViewer * viewer = new DatabaseViewer(this);
viewer->setWindowModality(Qt::WindowModal);
viewer->setAttribute(Qt::WA_DeleteOnClose, true);
viewer->showCloseButton();
if(viewer->openDatabase(path))
{
if(viewer->isSavedMaximized())

View File

@@ -2114,6 +2114,7 @@ void PreferencesDialog::openDatabaseViewer()
DatabaseViewer * viewer = new DatabaseViewer(this);
viewer->setWindowModality(Qt::WindowModal);
viewer->setAttribute(Qt::WA_DeleteOnClose, true);
viewer->showCloseButton();
if(viewer->openDatabase(_ui->source_database_lineEdit_path->text()))
{
viewer->show();

View File

@@ -13,8 +13,17 @@
<property name="windowTitle">
<string>Database viewer</string>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout_7" stretch="2">
<layout class="QVBoxLayout" name="verticalLayout_7" stretch="2,0">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="1,1">
<property name="rightMargin">
@@ -41,7 +50,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>154</width>
<width>159</width>
<height>136</height>
</rect>
</property>
@@ -196,7 +205,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>152</width>
<width>159</width>
<height>136</height>
</rect>
</property>
@@ -332,6 +341,13 @@
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">