diff --git a/logPlus/SetPageMeg.ui b/logPlus/SetPageMeg.ui
new file mode 100644
index 0000000..95a1481
--- /dev/null
+++ b/logPlus/SetPageMeg.ui
@@ -0,0 +1,150 @@
+
+
+ PageMeg
+
+
+
+ 0
+ 0
+ 560
+ 356
+
+
+
+ SetPageMeg
+
+
+
+
+ 50
+ 130
+ 113
+ 25
+
+
+
+
+
+
+ 80
+ 100
+ 81
+ 18
+
+
+
+ 左边距
+
+
+
+
+
+ 230
+ 20
+ 81
+ 18
+
+
+
+ 顶边距
+
+
+
+
+
+ 200
+ 40
+ 113
+ 25
+
+
+
+
+
+
+ 360
+ 130
+ 113
+ 25
+
+
+
+
+
+
+ 380
+ 100
+ 81
+ 18
+
+
+
+ 右边距
+
+
+
+
+
+ 200
+ 200
+ 113
+ 25
+
+
+
+
+
+
+ 220
+ 240
+ 81
+ 18
+
+
+
+ 底边距
+
+
+
+
+
+ 180
+ 80
+ 161
+ 111
+
+
+
+
+
+
+
+
+
+ 150
+ 300
+ 112
+ 34
+
+
+
+ 确定
+
+
+
+
+
+ 300
+ 300
+ 112
+ 34
+
+
+
+ 放弃
+
+
+
+
+
+
diff --git a/logPlus/SetPageMegDlg.cpp b/logPlus/SetPageMegDlg.cpp
new file mode 100644
index 0000000..9732f54
--- /dev/null
+++ b/logPlus/SetPageMegDlg.cpp
@@ -0,0 +1,49 @@
+#pragma warning( push , 0 )
+#include
+#include
+#include "SetPageMegDlg.h"
+#include "geometryutils.h"
+#pragma warning( pop )
+
+
+double FIXED_LOGLeft_MARGIN_CM = 0;
+double FIXED_LOGRight_MARGIN_CM = 0;
+double FIXED_LOGHead_MARGIN_CM = 0;
+double FIXED_LOGBottom_MARGIN_CM = 0;
+
+CSetPageMegDlg::CSetPageMegDlg()
+ :m_pDialog( NULL )
+{
+ m_pDialog=new Ui_PageMeg;
+ m_pDialog->setupUi(this);
+ connect( m_pDialog->pushButton,SIGNAL(clicked()),this,SLOT(slotOnOkBtnClicked()) );
+ connect( m_pDialog->pushButton_2,SIGNAL(clicked()),this,SLOT(slotOnCancelBtnClicked()));
+}
+void CSetPageMegDlg::Init()
+{
+ m_pDialog->lineEdit->setText(toString(FIXED_LOGLeft_MARGIN_CM));
+ m_pDialog->lineEdit->setValidator(new QDoubleValidator(0,999999,6,this));
+ m_pDialog->lineEdit_2->setText(toString(FIXED_LOGHead_MARGIN_CM));
+ m_pDialog->lineEdit_2->setValidator(new QDoubleValidator(0,999999,6,this));
+ m_pDialog->lineEdit_3->setText(toString(FIXED_LOGRight_MARGIN_CM));
+ m_pDialog->lineEdit_3->setValidator(new QDoubleValidator(0,999999,6,this));
+ m_pDialog->lineEdit_4->setText(toString(FIXED_LOGBottom_MARGIN_CM));
+ m_pDialog->lineEdit_4->setValidator(new QDoubleValidator(0,999999,6,this));
+}
+CSetPageMegDlg::~CSetPageMegDlg()
+{
+
+}
+void CSetPageMegDlg::slotOnOkBtnClicked()
+{
+ FIXED_LOGLeft_MARGIN_CM=m_pDialog->lineEdit->text().toFloat();
+ FIXED_LOGHead_MARGIN_CM=m_pDialog->lineEdit_2->text().toFloat();
+ FIXED_LOGRight_MARGIN_CM=m_pDialog->lineEdit_3->text().toFloat();
+ FIXED_LOGBottom_MARGIN_CM=m_pDialog->lineEdit_4->text().toFloat();
+ this->accept();
+}
+
+void CSetPageMegDlg::slotOnCancelBtnClicked()
+{
+ this->reject();
+}
diff --git a/logPlus/SetPageMegDlg.h b/logPlus/SetPageMegDlg.h
new file mode 100644
index 0000000..19f970b
--- /dev/null
+++ b/logPlus/SetPageMegDlg.h
@@ -0,0 +1,27 @@
+/**
+* @file SetPageMegDlg.h
+* @brief 创建图头表格属性配置对话框
+* @date 2015-03
+* @author: lxl
+*/
+#pragma warning( push , 0 )
+#include "ui_SetPageMeg.h"
+#include
+#pragma warning( pop )
+
+
+class CSetPageMegDlg : public QDialog
+{
+ Q_OBJECT
+public:
+ CSetPageMegDlg();
+ ~CSetPageMegDlg();
+ void Init();
+public:
+private slots:
+ void slotOnOkBtnClicked();
+ void slotOnCancelBtnClicked();
+private:
+ Ui_PageMeg* m_pDialog;
+public:
+};
diff --git a/logPlus/logPlus.pro b/logPlus/logPlus.pro
index 157511e..5adece8 100644
--- a/logPlus/logPlus.pro
+++ b/logPlus/logPlus.pro
@@ -44,6 +44,7 @@ SOURCES += \
PropertyWidget.cpp \
QCPSizeHandle.cpp \
QCPSizeHandleManager.cpp \
+ SetPageMegDlg.cpp \
TransparentDraggableCorePhysics.cpp \
TransparentDraggableFac.cpp \
TransparentDraggableGeoLith.cpp \
@@ -117,6 +118,7 @@ HEADERS += \
PropertyWidget.h \
QCPSizeHandle.h \
QCPSizeHandleManager.h \
+ SetPageMegDlg.h \
TransparentDraggableCorePhysics.h \
TransparentDraggableFac.h \
TransparentDraggableGeoLith.h \
@@ -172,6 +174,7 @@ HEADERS += \
FORMS += \
InDefTable.ui \
+ SetPageMeg.ui \
formdraw.ui \
formhead.ui \
formimage.ui \
diff --git a/logPlus/mainwindowcurve.cpp b/logPlus/mainwindowcurve.cpp
index d8fc958..e551853 100644
--- a/logPlus/mainwindowcurve.cpp
+++ b/logPlus/mainwindowcurve.cpp
@@ -27,6 +27,7 @@
#include "DepthProgress.h"
#include "wellheader.h"
#include
+#include "SetPageMegDlg.h"
//主窗口,为了方便获取tab当前页
extern MainWindow *g_mainWindow;
@@ -64,6 +65,12 @@ int g_iLoadingJson = 0;
extern QString g_strSlfName;
extern QString g_strWellName;
+//设置打印页
+extern double FIXED_LOGLeft_MARGIN_CM;
+extern double FIXED_LOGRight_MARGIN_CM;
+extern double FIXED_LOGHead_MARGIN_CM;
+extern double FIXED_LOGBottom_MARGIN_CM;
+
MainWindowCurve::MainWindowCurve(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindowCurve)
@@ -260,6 +267,9 @@ MainWindowCurve::MainWindowCurve(QWidget *parent) :
isScale[3]=m_isPrint;
isScale[4]=m_isBMP;
+// double dMargin = 0.5 * g_dPixelPerCm;//每厘米像素数
+// ui->centralwidget->layout()->setContentsMargins(dMargin, dMargin, dMargin, dMargin);
+
QTimer::singleShot(200, this, [=]() {
QRect rect = this->geometry();
this->resize(rect.width(), rect.height()+1); // 设置初始大小
@@ -740,7 +750,7 @@ void MainWindowCurve::initMainToolBar()
m_SaveAsPdfAc = new QAction(SaveAsPdfIcon, "导出PDF", this);
m_SaveAsSvgAc = new QAction(SaveAsSvgIcon, "导出SVG", this);
m_PrintAc = new QAction(PrintIcon, "打印", this);
- m_PrintSetupAc = new QAction(PrintSetupIcon, "打印设置", this);
+ m_PrintSetupAc = new QAction(PrintSetupIcon, "设置打印页", this);
m_PrintPreviewAc = new QAction(PrintPreviewIcon, "打印预览", this);
m_blackAc = new QAction(blackIcon, "黑白图", this);
m_doubleHeadAc = new QAction(doubleHeadIcon, "单曲线头", this);
@@ -3716,7 +3726,7 @@ void MainWindowCurve::_slotExport(QPrinter &printer, int IsBmp, QString pngName,
{
iHight += ui->tableWidget_2->rowHeight(i);
}
- iHight += top + (ui->tableWidget_2->rowCount()+1);//上margin + 边框n+1
+ iHight += top + bottom + (ui->tableWidget_2->rowCount()+1);//上margin + 边框n+1
//宽度
for(int j=0; jtableWidget_2->columnCount(); j++)
{
@@ -4181,14 +4191,39 @@ void MainWindowCurve::s_PrintSetup()
// qDebug() << "Paper size:" << printer.paperSize();
// }
- int left, top, right, bottom;
+ int left=0, top=0, right=0, bottom=0;
if (ui->centralwidget->layout())
{
ui->centralwidget->layout()->getContentsMargins(&left, &top, &right, &bottom);
-
- ui->centralwidget->layout()->setContentsMargins(left+10, top+10, right+10, bottom+10);
}
+ // 创建对话框
+ CSetPageMegDlg *dlg = new CSetPageMegDlg();
+ FIXED_LOGLeft_MARGIN_CM = (double)left/g_dPixelPerCm;//每厘米像素数;
+ FIXED_LOGRight_MARGIN_CM = (double)right/g_dPixelPerCm;//每厘米像素数;
+ FIXED_LOGHead_MARGIN_CM = (double)top/g_dPixelPerCm;//每厘米像素数;
+ FIXED_LOGBottom_MARGIN_CM = (double)bottom/g_dPixelPerCm;//每厘米像素数;
+ dlg->Init();
+ //
+ dlg->setAttribute(Qt::WA_DeleteOnClose);//关闭时,自动删除窗口对象
+ int result = dlg->exec();//模态对话框
+ if (result == QDialog::Accepted) {
+ // 处理用户点击了确定按钮的逻辑
+ qDebug() << "Accepted=";
+ left = FIXED_LOGLeft_MARGIN_CM * g_dPixelPerCm;//每厘米像素数;
+ right = FIXED_LOGRight_MARGIN_CM * g_dPixelPerCm;//每厘米像素数;
+ top = FIXED_LOGHead_MARGIN_CM * g_dPixelPerCm;//每厘米像素数;
+ bottom = FIXED_LOGBottom_MARGIN_CM * g_dPixelPerCm;//每厘米像素数;
+ ui->centralwidget->layout()->setContentsMargins(left, top, right, bottom);
+ }
+ else if (result == QDialog::Rejected) {
+ // 处理用户点击了取消按钮的逻辑
+ qDebug() << "Rejected=";
+ }
+ else {
+ // 处理其他情况的逻辑
+ qDebug() << "other=";
+ }
QMessageBox::information(NULL,"提示","打印设置完成!",QMessageBox::Ok);
//居中