mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-12-11 20:04:46 +00:00
When closing a dialog, remove it from the docked dialogs, and delete it.
This commit is contained in:
parent
c8c28a8d90
commit
8394ce3796
7 changed files with 24 additions and 17 deletions
|
@ -23,6 +23,7 @@ SET(OVQT_PLUG_GEORGES_EDITOR_HDR georges_editor_plugin.h
|
|||
filepath_property_manager.h
|
||||
typ_browser_ctrl.h
|
||||
georges_typ_dialog.h
|
||||
georges_dock_widget.h
|
||||
)
|
||||
|
||||
SET(OVQT_PLUG_GEORGES_EDITOR_UIS georges_editor_form.ui
|
||||
|
|
|
@ -29,6 +29,11 @@ GeorgesDockWidget::~GeorgesDockWidget()
|
|||
{
|
||||
}
|
||||
|
||||
void GeorgesDockWidget::closeEvent( QCloseEvent *e )
|
||||
{
|
||||
Q_EMIT closing( this );
|
||||
}
|
||||
|
||||
QString GeorgesDockWidget::buildLogMsg( const QString &msg )
|
||||
{
|
||||
QString user = getenv( "USER" );
|
||||
|
|
|
@ -25,6 +25,7 @@ class QUndoStack;
|
|||
|
||||
class GeorgesDockWidget : public QDockWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GeorgesDockWidget( QWidget *parent = NULL );
|
||||
~GeorgesDockWidget();
|
||||
|
@ -39,6 +40,12 @@ public:
|
|||
virtual bool load( const QString &fileName ) = 0;
|
||||
virtual void write() = 0;
|
||||
|
||||
protected:
|
||||
void closeEvent( QCloseEvent *e );
|
||||
|
||||
Q_SIGNALS:
|
||||
void closing( GeorgesDockWidget *d );
|
||||
|
||||
protected:
|
||||
QString buildLogMsg( const QString &msg );
|
||||
virtual void log( const QString &msg ) = 0;
|
||||
|
|
|
@ -252,7 +252,7 @@ namespace GeorgesQt
|
|||
m_lastActiveDock = w;
|
||||
m_dockedWidgets.append(w);
|
||||
|
||||
connect(m_dockedWidgets.last(), SIGNAL(closing()), this, SLOT(closingTreeView()));
|
||||
connect( w, SIGNAL( closing( GeorgesDockWidget* ) ), this, SLOT( dialogClosing( GeorgesDockWidget* ) ) );
|
||||
connect(m_dockedWidgets.last(), SIGNAL(visibilityChanged(bool)), m_dockedWidgets.last(), SLOT(checkVisibility(bool)));
|
||||
|
||||
// If there is more than one form open - tabify the new form. If this is the first form open add it to the dock.
|
||||
|
@ -337,12 +337,16 @@ namespace GeorgesQt
|
|||
addGeorgesWidget( w );
|
||||
}
|
||||
|
||||
void GeorgesEditorForm::closingTreeView()
|
||||
void GeorgesEditorForm::dialogClosing( GeorgesDockWidget *d )
|
||||
{
|
||||
//qDebug() << "closingTreeView";
|
||||
m_dockedWidgets.removeAll(qobject_cast<CGeorgesTreeViewDialog*>(sender()));
|
||||
if (qobject_cast<CGeorgesTreeViewDialog*>(sender()) == m_lastActiveDock)
|
||||
m_lastActiveDock = 0;
|
||||
m_dockedWidgets.removeAll( d );
|
||||
|
||||
if( m_dockedWidgets.size() == 0 )
|
||||
m_lastActiveDock = NULL;
|
||||
else
|
||||
m_lastActiveDock = m_dockedWidgets.last();
|
||||
|
||||
delete d;
|
||||
}
|
||||
|
||||
void GeorgesEditorForm::setModified ()
|
||||
|
|
|
@ -52,7 +52,7 @@ public Q_SLOTS:
|
|||
|
||||
void save();
|
||||
void settingsChanged();
|
||||
void closingTreeView();
|
||||
void dialogClosing( GeorgesDockWidget *d );
|
||||
void setModified();
|
||||
|
||||
void focusChanged(QWidget *old, QWidget *now);
|
||||
|
|
|
@ -599,12 +599,6 @@ namespace GeorgesQt
|
|||
modifiedFile();
|
||||
}
|
||||
|
||||
void CGeorgesTreeViewDialog::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
Q_EMIT closing();
|
||||
deleteLater();
|
||||
}
|
||||
|
||||
void CGeorgesTreeViewDialog::checkVisibility(bool visible) {
|
||||
// this prevents invisible docks from getting tab focus
|
||||
qDebug() << "checkVisibility" << visible;
|
||||
|
|
|
@ -77,13 +77,9 @@ namespace GeorgesQt
|
|||
|
||||
QString loadedForm;
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *event);
|
||||
|
||||
Q_SIGNALS:
|
||||
void changeFile(QString);
|
||||
void modified();
|
||||
void closing();
|
||||
|
||||
public Q_SLOTS:
|
||||
void setForm(const CForm*);
|
||||
|
|
Loading…
Reference in a new issue