qt實現介面顯示和列印部分分離

2021-07-05 18:47:52 字數 2088 閱讀 7598

要求實現pos端結算時彈出找零介面同時進行開啟錢箱列印,找零介面是阻塞對話方塊,1.採用多執行緒解決找零介面是ui 列印因為是通過html列印也是ui執行緒 qt規定所有ui只能在ui執行緒中 故無法導通

2.通過將html列印成 開列印執行緒將繪製到列印紙上 出現列印出來的東東較為模糊 故無法導通

3.將列印單獨拎出來 列印時直接呼叫列印程序來搞 可以導通呼叫部分**

void myprinter::on_testbtn_clicked()

" "h1

" "h2

" "h3

"); strhtml += qstring("th

" "td

" "table

style>

head>").arg(65);

//頭部

strhtml += qstring("");

strhtml += qstring("");

strhtml += qstringliteral("8637品牌工廠店部分");

strhtml += qstring("h2>");

strhtml += qstring("body>

html>");

qstringlist list;

list.push_back(strhtml);

list.push_back(qstring("80"));

list.push_back(qstring("1"));

list.push_back(qstring("gp-80160(cut) series"));

list.push_back(qstring("1"));

list.push_back(qstring("st-1234567898776"));

//qprocess process;

m_process.startdetached(strexepath, list);

//qmessagebox::information(this, "msg", "test");

}

列印程序 main.cpp
#include "catprinter.h"

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include "zint.h"

#ifdef _debug

#pragma comment(lib, "../win32/debug/zintd.dll.lib")

#else

#pragma comment(lib, "../win32/release/zint.dll.lib")

#endif

typedef

struct sthtml

s_html;

void printhtml(const qstring &strhtml, s_html &shtml);

bool drawbarcode(qpainter &painter, const qstring &strimagepath, const qrect &rtbarcode, int width);

int main(int argc, char *argv)

else

//return 0;

//這裡呼叫印表機進行列印

return

0; }void printhtml(const qstring &strhtml, s_html &shtml)

}else

}}bool drawbarcode(qpainter &painter, const qstring &strimagepath, const qrect &rtbarcode, int width)

1.完整測試部分**:

C 介面的顯示實現和隱示實現

介面的實現很多人都知道,但介面的實現方式分顯示實現和隱示實現不知道是不是很多人知道呢!但我覺的公司技術部裡很少提到這個,就想起來寫寫這篇blogs。目前常用的方式 public inte ce ireview public class shopreview ireview 這種方式是隱示實現 ire...

C 介面的顯示實現和隱示實現

介面的實現很多人都知道,但介面的實現方式分顯示實現和隱示實現不知道是不是很多人知道呢!但我覺的公司技術部裡很少提到這個,就想起來寫寫這篇blogs。目前常用的方式 public inte ce ireview public class shopreview ireview 這種方式是隱示實現 ire...

CSS實現不同的列印和螢幕顯示結果

通常的web頁面中,我們要求列印結果和顯示結果一樣,但在一些報表或業務系統中,我們可能只需要列印頁面中的一部分內容,例如我只要列印資料,但按鈕和背景不需要列印,這是由業務需求決定的,我們可以想象一下,如果一張列印出來的發票中出現乙個按鈕,你會怎麼想,估計要昏過去的,呵呵 好了,說完需求,我來說說如何...