1.追加打印功能 2.追加鼠标滚轮缩放功能
This commit is contained in:
parent
5e801e13fa
commit
6d48697012
|
|
@ -442,14 +442,28 @@ QToolBar * MainWindowCurve::getPluginToolBar()
|
|||
//鼠标滚动,通知可视解释窗口
|
||||
void MainWindowCurve::s_mouseWheel(QWheelEvent *event)
|
||||
{
|
||||
if (event->angleDelta().y() > 0) {
|
||||
ui->verticalScrollBar->triggerAction(QAbstractSlider::SliderSingleStepSub); // 向下滚动
|
||||
} else {
|
||||
ui->verticalScrollBar->triggerAction(QAbstractSlider::SliderSingleStepAdd); // 向上滚动
|
||||
if (Qt::ControlModifier == QApplication::keyboardModifiers())
|
||||
{
|
||||
if (event->delta() > 0) // 鼠标滚轮向上滚动
|
||||
{
|
||||
ZoomIn(1.1); // 文本放大
|
||||
}
|
||||
else
|
||||
{
|
||||
ZoomIn(0.9); // 文本缩小
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (event->angleDelta().y() > 0) {
|
||||
ui->verticalScrollBar->triggerAction(QAbstractSlider::SliderSingleStepSub); // 向下滚动
|
||||
} else {
|
||||
ui->verticalScrollBar->triggerAction(QAbstractSlider::SliderSingleStepAdd); // 向上滚动
|
||||
}
|
||||
|
||||
//verticalScrollBar() horizontalScrollBar()
|
||||
//event->accept(); // 确保事件被处理
|
||||
//verticalScrollBar() horizontalScrollBar()
|
||||
//event->accept(); // 确保事件被处理
|
||||
}
|
||||
}
|
||||
|
||||
//自定义滚动条(头)
|
||||
|
|
@ -655,6 +669,7 @@ void MainWindowCurve::initMainToolBar()
|
|||
QIcon SaveAsPictureIcon(::GetImagePath()+"icon/SaveAsPicture.png");
|
||||
QIcon SaveAsPdfIcon(::GetImagePath()+"icon/ExportPDF.png");
|
||||
QIcon SaveAsSvgIcon(::GetImagePath()+"icon/ExportSVG.png");
|
||||
QIcon PrintIcon(::GetImagePath()+"icon/Print.png");
|
||||
QIcon doubleHeadIcon(::GetImagePath()+"icon/oneortwohead.png");
|
||||
QIcon crossIcon(::GetImagePath()+"icon/Cross.png");
|
||||
QIcon autorollIcon(::GetImagePath()+"icon/autoroll.png");
|
||||
|
|
@ -676,6 +691,7 @@ void MainWindowCurve::initMainToolBar()
|
|||
m_SaveAsPictureAc = new QAction(SaveAsPictureIcon, "导出长图", this);
|
||||
m_SaveAsPdfAc = new QAction(SaveAsPdfIcon, "导出PDF", this);
|
||||
m_SaveAsSvgAc = new QAction(SaveAsSvgIcon, "导出SVG", this);
|
||||
m_PrintAc = new QAction(PrintIcon, "打印", this);
|
||||
m_blackAc = new QAction(blackIcon, "黑白图", this);
|
||||
m_doubleHeadAc = new QAction(doubleHeadIcon, "单曲线头", this);
|
||||
m_executeDepthShiftAc = new QAction(executeDepthShiftIcon, "校深", this);
|
||||
|
|
@ -704,6 +720,7 @@ void MainWindowCurve::initMainToolBar()
|
|||
menuPrint->addAction(m_SaveAsPictureAc); //导出长图
|
||||
menuPrint->addAction(m_SaveAsPdfAc); //导出PDF
|
||||
menuPrint->addAction(m_SaveAsSvgAc); //导出SVG
|
||||
menuPrint->addAction(m_PrintAc); //打印
|
||||
printMenuAction->setMenu(menuPrint);
|
||||
|
||||
|
||||
|
|
@ -768,7 +785,8 @@ void MainWindowCurve::initMainToolBar()
|
|||
connect(m_zoomoutAc, &QAction::triggered, this, &MainWindowCurve::s_ZoomOut);
|
||||
connect(m_SaveAsPictureAc, &QAction::triggered, this, &MainWindowCurve::s_SaveAsPicture);
|
||||
connect(m_SaveAsPdfAc, &QAction::triggered, this, &MainWindowCurve::s_SaveAsPdf);
|
||||
connect(m_SaveAsSvgAc, &QAction::triggered, this, &MainWindowCurve::s_SaveAsSvg);
|
||||
connect(m_SaveAsSvgAc, &QAction::triggered, this, &MainWindowCurve::s_SaveAsSvg);
|
||||
connect(m_PrintAc, &QAction::triggered, this, &MainWindowCurve::s_Print);
|
||||
|
||||
connect(m_blackAc, &QAction::triggered, this, &MainWindowCurve::s_Black);
|
||||
connect(m_doubleHeadAc, &QAction::triggered, this, &MainWindowCurve::s_DoubleHead);
|
||||
|
|
@ -4059,6 +4077,38 @@ void MainWindowCurve::_slotExport(QPrinter &printer, int IsBmp, QString pngName,
|
|||
SetScrollBar_Geometry();
|
||||
}
|
||||
|
||||
//打印
|
||||
void MainWindowCurve::s_Print()
|
||||
{
|
||||
QPrinter printer(QPrinter::HighResolution);
|
||||
if (QPrintDialog(&printer).exec() == QDialog::Accepted)
|
||||
{
|
||||
QString ip;
|
||||
QString lpt3;
|
||||
int port=9100;
|
||||
char szFile[256];
|
||||
strcpy(szFile, "printer.ini");
|
||||
QStringList strs=GetSimilarCurves(printer.printerName()+"_IP", szFile);
|
||||
if(strs.size()>1) {
|
||||
ip=strs[0];
|
||||
port=strs[1].toInt();
|
||||
}
|
||||
else if(strs.size()==1) {
|
||||
ip=strs[0];
|
||||
}
|
||||
if(ip.isEmpty()) {
|
||||
strs=GetSimilarCurves(printer.printerName()+"LPT", szFile);
|
||||
if(strs.size()) lpt3=strs[0];
|
||||
}
|
||||
if(!ip.isEmpty()||!lpt3.isEmpty())
|
||||
{
|
||||
printer.setResolution(QPrinter::ScreenResolution);
|
||||
_slotExport(printer,1,"","");
|
||||
}
|
||||
else _slotExport(printer,0,"","");
|
||||
}
|
||||
}
|
||||
|
||||
//导出长图
|
||||
void MainWindowCurve::s_SaveAsSvg()
|
||||
{
|
||||
|
|
@ -6722,3 +6772,23 @@ void MainWindowCurve::s_AddMultiWell(QString strUuid, QString strSlfName, QStrin
|
|||
//
|
||||
OpenMultiWell(m_fileJson);
|
||||
}
|
||||
|
||||
|
||||
void MainWindowCurve::wheelEvent(QWheelEvent *e)
|
||||
{
|
||||
// 检查按键 Ctrl 是否按下
|
||||
if (Qt::ControlModifier == QApplication::keyboardModifiers())
|
||||
{
|
||||
if (e->delta() > 0) // 鼠标滚轮向上滚动
|
||||
{
|
||||
ZoomIn(1.1); // 文本放大
|
||||
}
|
||||
else
|
||||
{
|
||||
ZoomIn(0.9); // 文本缩小
|
||||
}
|
||||
}
|
||||
|
||||
// 调用父类事件函数,保证鼠标滚轮查看文本功能正常
|
||||
QMainWindow::wheelEvent(e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ private:
|
|||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
void wheelEvent(QWheelEvent *e) override; //滚轮事件
|
||||
|
||||
public:
|
||||
void resizeItem(QString strWellName, double tempWidth, double tempHight);
|
||||
|
|
@ -248,6 +249,7 @@ public:
|
|||
QAction* m_SaveAsPictureAc = nullptr; //导出长图
|
||||
QAction* m_SaveAsPdfAc = nullptr; //导出PDF
|
||||
QAction* m_SaveAsSvgAc = nullptr; //导出SVG
|
||||
QAction* m_PrintAc = nullptr; //打印
|
||||
QAction* m_blackAc = nullptr; //黑白图
|
||||
QAction* m_doubleHeadAc = nullptr; //单曲线头
|
||||
QAction* m_executeDepthShiftAc = nullptr; //校深
|
||||
|
|
@ -341,6 +343,7 @@ public slots:
|
|||
void s_SaveAsPicture(); //导出长图
|
||||
void s_SaveAsPdf(); //导出PDF
|
||||
void s_SaveAsSvg(); //导出SVG
|
||||
void s_Print(); //打印
|
||||
void s_ZoomIn(); //放大
|
||||
void s_ZoomOut(); //缩小
|
||||
void s_Black(); //黑白图
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user