diff --git a/Include/nmNum/nmSubWxs/nmWxPropertyInterpolationPreviewDlg.h b/Include/nmNum/nmSubWxs/nmWxPropertyInterpolationPreviewDlg.h index cf1afa1..e665190 100644 --- a/Include/nmNum/nmSubWxs/nmWxPropertyInterpolationPreviewDlg.h +++ b/Include/nmNum/nmSubWxs/nmWxPropertyInterpolationPreviewDlg.h @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -47,6 +48,8 @@ public: bool showMeasurementLabels); void showMessage(const QString& dataSetName, const QString& message); + virtual QSize sizeHint() const; + private: void initializeRenderer(const QString& scalarTitle, const QRectF& bounds, diff --git a/Src/nmNum/nmSubWxs/nmWxPropertyInterpolationDlg.cpp b/Src/nmNum/nmSubWxs/nmWxPropertyInterpolationDlg.cpp index 74e2415..7c8ccf2 100644 --- a/Src/nmNum/nmSubWxs/nmWxPropertyInterpolationDlg.cpp +++ b/Src/nmNum/nmSubWxs/nmWxPropertyInterpolationDlg.cpp @@ -344,8 +344,6 @@ nmWxPropertyInterpolationDlg::nmWxPropertyInterpolationDlg( setWindowTitle(interpolationText("Property Interpolation")); setWindowModality(Qt::NonModal); setModal(false); - setMinimumSize(500, 620); - resize(520, 820); // 合并连续编辑触发的刷新,避免每次数值变化都立即重新插值. m_pPreviewRefreshTimer = new QTimer(this); diff --git a/Src/nmNum/nmSubWxs/nmWxPropertyInterpolationPreviewDlg.cpp b/Src/nmNum/nmSubWxs/nmWxPropertyInterpolationPreviewDlg.cpp index cfc871a..67b0dd7 100644 --- a/Src/nmNum/nmSubWxs/nmWxPropertyInterpolationPreviewDlg.cpp +++ b/Src/nmNum/nmSubWxs/nmWxPropertyInterpolationPreviewDlg.cpp @@ -1,8 +1,11 @@ -#include "nmWxPropertyInterpolationPreviewDlg.h" +#include "nmWxPropertyInterpolationPreviewDlg.h" +#include #include +#include #include #include +#include #include #include @@ -96,15 +99,14 @@ nmWxPropertyInterpolationPreviewDlg::nmWxPropertyInterpolationPreviewDlg( { setWindowModality(Qt::NonModal); setModal(false); - setMinimumSize(900, 700); - resize(1200, 850); QVBoxLayout* mainLayout = new QVBoxLayout(this); mainLayout->setContentsMargins(8, 8, 8, 8); mainLayout->setSpacing(8); m_pVtkWidget = new QVTKWidget(this); - m_pVtkWidget->setMinimumSize(860, 640); + m_pVtkWidget->setSizePolicy(QSizePolicy::Expanding, + QSizePolicy::Expanding); mainLayout->addWidget(m_pVtkWidget, 1); QHBoxLayout* buttonLayout = new QHBoxLayout; @@ -120,6 +122,19 @@ nmWxPropertyInterpolationPreviewDlg::nmWxPropertyInterpolationPreviewDlg( showMeasurementPoints, showMeasurementLabels); } +QSize nmWxPropertyInterpolationPreviewDlg::sizeHint() const +{ + QDesktopWidget* desktop = QApplication::desktop(); + if(desktop == NULL) { + return iDlgBase::sizeHint(); + } + + // 预览窗口随当前屏幕可用区域调整,避免固定像素尺寸在不同分辨率下失衡. + const QRect availableRect = desktop->availableGeometry(this); + return QSize(availableRect.width() * 1 / 2, + availableRect.height() * 4 / 5); +} + void nmWxPropertyInterpolationPreviewDlg::updatePreview( const QString& dataSetName, const QString& scalarTitle,