@@ -32,7 +32,7 @@ TTFDecodeThread::TTFDecodeThread(QWidget *parent,QString ttffilename,QString TTF
32
32
33
33
void TTFDecodeThread::run ()
34
34
{
35
- QList<QPixmap> frame_RGB_list;
35
+ QList<QPixmap * > frame_RGB_list;
36
36
if (this ->decoder == nullptr )
37
37
{
38
38
// 未能成功获取则返回无法解码
@@ -57,7 +57,7 @@ ImgViewer::ImgViewer(QWidget *parent,QWidget *parentWindow) :
57
57
ui(new Ui::ImgViewerWindow)
58
58
{
59
59
ui->setupUi (this );
60
- qRegisterMetaType<QList<QPixmap>>(" QList<QPixmap>" );
60
+ qRegisterMetaType<QList<QPixmap * >>(" QList<QPixmap * >" );
61
61
this ->parentWindow = parentWindow;
62
62
setWindowTitle (" loading file, please wait ...." );
63
63
ui->left_PushButton ->setFlat (true );
@@ -88,7 +88,7 @@ bool ImgViewer::setFileList(QStringList filenamelist,QString TTFFormat, int W, i
88
88
// 遍历文件列表
89
89
foreach ( QString filename, filenamelist)
90
90
{
91
- QList<QPixmap> frame_RGB_list;
91
+ QList<QPixmap * > frame_RGB_list;
92
92
93
93
// 使用获取的解码函数进行解码得到RGB的原始帧列表
94
94
frame_RGB_list = decoder (filename, W, H, codepoint);
@@ -107,13 +107,13 @@ bool ImgViewer::setFileList(QStringList filenamelist,QString TTFFormat, int W, i
107
107
this ->currentImg_RGB_list = this ->img_list .at (0 );
108
108
this ->currentImg = this ->currentImg_RGB_list .at (0 );
109
109
this ->setWindowTitle (this ->filelist .at (0 )+" -0" );
110
- this ->scaled_img = this ->currentImg . scaled (this ->size ());
110
+ this ->scaled_img = this ->currentImg -> scaled (this ->size ());
111
111
this ->point = QPoint (0 , 0 );
112
112
return true ;
113
113
}
114
114
}
115
115
116
- void ImgViewer::reciveimgdata (QList<QPixmap> img_RGB_list,QString filename)
116
+ void ImgViewer::reciveimgdata (QList<QPixmap * > img_RGB_list,QString filename)
117
117
{
118
118
if (!img_RGB_list.empty ())
119
119
{
@@ -128,7 +128,7 @@ void ImgViewer::reciveimgdata(QList<QPixmap> img_RGB_list,QString filename)
128
128
this ->currentImg_RGB_list = this ->img_list .at (0 );
129
129
this ->currentImg = this ->currentImg_RGB_list .at (0 );
130
130
this ->setWindowTitle (this ->filelist .at (0 )+" -0" );
131
- this ->scaled_img = this ->currentImg . scaled (this ->size ());
131
+ this ->scaled_img = this ->currentImg -> scaled (this ->size ());
132
132
this ->point = QPoint (0 , 0 );
133
133
this ->repaint ();
134
134
}
@@ -162,7 +162,7 @@ bool ImgViewer::setFileList_multithreading(QStringList filenamelist,QString TTFF
162
162
foreach ( QString filename, filenamelist)
163
163
{
164
164
TTFDecodeThread *decodeThread = new TTFDecodeThread (this , filename, TTFFormat, W, H, codepoint);
165
- QObject::connect (decodeThread, SIGNAL (finsh_signal (QList<QPixmap>, QString)), this , SLOT (reciveimgdata (QList<QPixmap>, QString)));
165
+ QObject::connect (decodeThread, SIGNAL (finsh_signal (QList<QPixmap * >, QString)), this , SLOT (reciveimgdata (QList<QPixmap * >, QString)));
166
166
this ->decode_thread .insert (this ->decode_thread .end (),decodeThread);
167
167
}
168
168
this ->decode_thread [0 ]->start ();
@@ -175,13 +175,13 @@ void ImgViewer::closeEvent(QCloseEvent *event)
175
175
event->accept ();
176
176
if (!this ->img_list .empty ())
177
177
{
178
- foreach (QList<QPixmap> list,this ->img_list )
178
+ foreach (QList<QPixmap * > list,this ->img_list )
179
179
{
180
180
if (!list.empty ())
181
181
{
182
- foreach (QPixmap img,list)
182
+ foreach (QPixmap * img,list)
183
183
{
184
- // delete img;
184
+ delete img;
185
185
}
186
186
}
187
187
}
@@ -243,12 +243,12 @@ void ImgViewer::mouseReleaseEvent(QMouseEvent *event)
243
243
else if (event->button () == Qt::RightButton)
244
244
{
245
245
this ->point = QPoint (0 , 0 );
246
- this ->scaled_img = this ->currentImg . scaled (this ->size ());
246
+ this ->scaled_img = this ->currentImg -> scaled (this ->size ());
247
247
this ->repaint ();
248
248
}
249
249
else if (event->button () == Qt::MiddleButton)
250
250
{
251
- this ->scaled_img = this ->currentImg . scaled (this ->currentImg . size ().width (),this ->currentImg . size ().height ());
251
+ this ->scaled_img = this ->currentImg -> scaled (this ->currentImg -> size ().width (),this ->currentImg -> size ().height ());
252
252
this ->point = QPoint (0 , 0 );
253
253
this ->repaint ();
254
254
}
@@ -262,19 +262,19 @@ void ImgViewer::mouseDoubleClickEvent(QMouseEvent *event)
262
262
if ( event->button () == Qt::LeftButton)
263
263
{
264
264
int list_index = this ->img_list .indexOf (this ->currentImg_RGB_list );
265
- QList<QPixmap> img_RGB_list = this ->img_list [list_index];
265
+ QList<QPixmap * > img_RGB_list = this ->img_list [list_index];
266
266
int img_index = img_RGB_list.indexOf (this ->currentImg );
267
267
QString savefile_name = QFileDialog::getSaveFileName (this , " 保存文件" , this ->filelist [list_index].replace (" .ttf" ," -" ) + QString::number (img_index) + " .png" , " Image files(*.png)" );
268
268
if (savefile_name != nullptr )
269
269
{
270
- this ->currentImg . save (savefile_name);
270
+ this ->currentImg -> save (savefile_name);
271
271
}
272
272
}
273
273
else if (event->button () == Qt::RightButton)
274
274
{
275
275
this ->flipRGB = this ->flipRGB ? false : true ;
276
276
this ->point = QPoint (0 , 0 );
277
- this ->scaled_img = this ->currentImg . scaled (this ->size ());
277
+ this ->scaled_img = this ->currentImg -> scaled (this ->size ());
278
278
this ->repaint ();
279
279
}
280
280
}
@@ -292,7 +292,7 @@ void ImgViewer::wheelEvent(QWheelEvent *event)
292
292
float setpsize_x = ((float )this ->scaled_img .width ())/16 .0f ;
293
293
float setpsize_y = ((float )this ->scaled_img .height ())/16 .0f ; // 缩放可能导致比例不精确
294
294
295
- this ->scaled_img = this ->currentImg . scaled (this ->scaled_img .width () + setpsize_x,this ->scaled_img .height () + setpsize_y);
295
+ this ->scaled_img = this ->currentImg -> scaled (this ->scaled_img .width () + setpsize_x,this ->scaled_img .height () + setpsize_y);
296
296
float new_w = event->x () - (this ->scaled_img .width () * (event->x () - this ->point .x ())) / (this ->scaled_img .width () - setpsize_x);
297
297
float new_h = event->y () - (this ->scaled_img .height () * (event->y () - this ->point .y ())) / (this ->scaled_img .height () - setpsize_y);
298
298
this ->point = QPoint (new_w, new_h);
@@ -307,7 +307,7 @@ void ImgViewer::wheelEvent(QWheelEvent *event)
307
307
float setpsize_x = ((float )this ->scaled_img .width ())/16 .0f ;
308
308
float setpsize_y = ((float )this ->scaled_img .height ())/16 .0f ; // 缩放可能导致比例不精确
309
309
310
- this ->scaled_img = this ->currentImg . scaled (this ->scaled_img .width () - setpsize_x,this ->scaled_img .height () - setpsize_y);
310
+ this ->scaled_img = this ->currentImg -> scaled (this ->scaled_img .width () - setpsize_x,this ->scaled_img .height () - setpsize_y);
311
311
float new_w = event->x () - (this ->scaled_img .width () * (event->x () - this ->point .x ())) / (this ->scaled_img .width () + setpsize_x);
312
312
float new_h = event->y () - (this ->scaled_img .height () * (event->y () - this ->point .y ())) / (this ->scaled_img .height () + setpsize_y);
313
313
this ->point = QPoint (new_w, new_h);
@@ -321,7 +321,7 @@ void ImgViewer::resizeEvent(QResizeEvent *event)
321
321
{
322
322
if (!this ->img_list .empty ())
323
323
{
324
- this ->scaled_img = this ->currentImg . scaled (this ->size ());
324
+ this ->scaled_img = this ->currentImg -> scaled (this ->size ());
325
325
this ->point = QPoint (0 , 0 );
326
326
this ->update ();
327
327
}
@@ -334,7 +334,7 @@ void ImgViewer::previousImg()
334
334
{
335
335
// 得到当前显示的文件序号
336
336
int list_index = this ->img_list .indexOf (this ->currentImg_RGB_list );
337
- QList<QPixmap> img_RGB_list = this ->img_list [list_index];
337
+ QList<QPixmap * > img_RGB_list = this ->img_list [list_index];
338
338
// 得到当前显示的图像是文件的帧序号
339
339
int img_index = img_RGB_list.indexOf (this ->currentImg );
340
340
@@ -366,7 +366,7 @@ void ImgViewer::previousImg()
366
366
this ->currentImg_RGB_list = this ->img_list [list_index];
367
367
this ->currentImg = this ->currentImg_RGB_list [img_index];
368
368
this ->point = QPoint (0 , 0 );
369
- this ->scaled_img = this ->currentImg . scaled (this ->size ());
369
+ this ->scaled_img = this ->currentImg -> scaled (this ->size ());
370
370
this ->repaint ();
371
371
}
372
372
}
@@ -377,7 +377,7 @@ void ImgViewer::nextImg()
377
377
{
378
378
// 得到当前显示的文件序号
379
379
int list_index = this ->img_list .indexOf (this ->currentImg_RGB_list );
380
- QList<QPixmap> img_RGB_list = this ->img_list [list_index];
380
+ QList<QPixmap * > img_RGB_list = this ->img_list [list_index];
381
381
// 得到当前显示的图像是文件的帧序号
382
382
int img_index = img_RGB_list.indexOf (this ->currentImg );
383
383
@@ -409,7 +409,7 @@ void ImgViewer::nextImg()
409
409
this ->currentImg_RGB_list = this ->img_list [list_index];
410
410
this ->currentImg = this ->currentImg_RGB_list [img_index];
411
411
this ->point = QPoint (0 , 0 );
412
- this ->scaled_img = this ->currentImg . scaled (this ->size ());
412
+ this ->scaled_img = this ->currentImg -> scaled (this ->size ());
413
413
this ->repaint ();
414
414
}
415
415
}
0 commit comments