January 21, 2011

colinRao colinRao
Lab Rat
2 posts

[Solved]QImageWriter~initial bug

 

  1. void SQLite::addImage(QImage image, QStringList tags)
  2. {
  3.     QBuffer buffer;
  4.     QImageWriter writer(&buffer,"PNG");
  5.  
  6.     writer.write(image);
  7.     QSqlQuery qry;
  8.     int id;
  9.     qry.prepare( "SELECT COUNT(*) FROM images" );
  10.     qry.exec();
  11.     qry.next();
  12.     id = qry.value(0).toInt() + 1;
  13.     qry.prepare( "INSERT INTO images (id, data) VALUES (:id, :data)" );
  14.     qry.bindValue( ":id", id );
  15.     qry.bindValue( ":data", buffer.data() );
  16.     qry.exec();
  17.     foreach( QString tag, tags )
  18.         addTag( id, tag );
  19. }

enviroment:
Qt Creator 2.0.1
based on Qt 4.7.0(32bit)
My os is micorsoft xp
Is there some body can help me to shooting this bug. Thank you very much!

..\SqlDialog\sqlite.cpp: In member function ‘void SQLite::addImage(QImage, QStringList)’:

..\SqlDialog\sqlite.cpp:118: error: variable ‘QImageWriter writer’ has initializer but incomplete type

..\SqlDialog\sqlite.cpp: In member function ‘QImage SQLite::getImage(int)’:

..\SqlDialog\sqlite.cpp:151: error: variable ‘QImageReader reader’ has initializer but incomplete type

2 replies

January 21, 2011

Dieter Dieter
Lab Rat
93 posts

I’m just guessing but based on my experience with this gcc error messaged you might be missing some includes.

January 21, 2011

colinRao colinRao
Lab Rat
2 posts

Yeah! I got it. Thanks!

 
  ‹‹ Problem Activating SQL Drivers      Calculate scene coordinates from QGraphicsLinearLayout ››

You must log in to post a reply. Not a member yet? Register here!