diff options
Diffstat (limited to 'clients/tde/src/app/views')
-rw-r--r-- | clients/tde/src/app/views/instrumentview.cpp | 27 | ||||
-rw-r--r-- | clients/tde/src/app/views/instrumentview.h | 3 |
2 files changed, 28 insertions, 2 deletions
diff --git a/clients/tde/src/app/views/instrumentview.cpp b/clients/tde/src/app/views/instrumentview.cpp index b2fd5db..4cad117 100644 --- a/clients/tde/src/app/views/instrumentview.cpp +++ b/clients/tde/src/app/views/instrumentview.cpp @@ -15,6 +15,7 @@ InstrumentView::InstrumentView(const TQString &library, TQWidget *parentWidget, : KMdiChildView(parentWidget, name, f) , m_libraryName(library) , m_instrumentPart( 0 ) + , m_fixedSize( false ) , m_canary( NULL ) { init(); @@ -24,6 +25,7 @@ InstrumentView::InstrumentView(const TQString &library, const TQString &caption, : KMdiChildView(caption, parentWidget, name, f) , m_libraryName(library) , m_instrumentPart( 0 ) + , m_fixedSize( false ) , m_canary( NULL ) { init(); @@ -45,18 +47,39 @@ void InstrumentView::init() { else { m_instrumentPart = (InstrumentPart *)factory->create(TQT_TQOBJECT(this), "part", "KParts::RemoteInstrumentPart"); connect(m_instrumentPart, SIGNAL(statusMessageSet(const TQString&)), this, SLOT(setStatusMessage(const TQString&))); + connect(m_instrumentPart, SIGNAL(usingFixedSizeChanged(bool)), this, SLOT(setUsingFixedSize(bool))); } } -void InstrumentView::resizeEvent(TQResizeEvent *) { +void InstrumentView::setChildSizeToHint() { if (m_instrumentPart) { TQWidget *childPartWidget = m_instrumentPart->widget(); if (childPartWidget) { - setFixedSize(childPartWidget->sizeHint()); + if (m_fixedSize) { + setFixedSize(childPartWidget->sizeHint()); + } + else { + TQSize childSizeHint = childPartWidget->sizeHint(); + setMinimumSize(childSizeHint.width(), childSizeHint.height()); + childPartWidget->resize(size()); + } } } } +void InstrumentView::setUsingFixedSize(bool fixed) { + m_fixedSize = fixed; + if (!fixed) { + setMinimumSize(0, 0); + setMaximumSize(TQWIDGETSIZE_MAX, TQWIDGETSIZE_MAX); + } + setChildSizeToHint(); +} + +void InstrumentView::resizeEvent(TQResizeEvent *) { + setChildSizeToHint(); +} + TQPtrList<KAction> InstrumentView::menuActionList() { if (m_instrumentPart) { return m_instrumentPart->menuActionList(); diff --git a/clients/tde/src/app/views/instrumentview.h b/clients/tde/src/app/views/instrumentview.h index e62b0de..f51fab8 100644 --- a/clients/tde/src/app/views/instrumentview.h +++ b/clients/tde/src/app/views/instrumentview.h @@ -37,6 +37,8 @@ class InstrumentView : public KMdiChildView private slots: void setStatusMessage(const TQString& message); + void setUsingFixedSize(bool fixed); + void setChildSizeToHint(); signals: void statusMessageSet(const TQString&); @@ -45,6 +47,7 @@ class InstrumentView : public KMdiChildView void init(); TQString m_libraryName; RemoteLab::InstrumentPart *m_instrumentPart; + bool m_fixedSize; bool* m_canary; }; |