void Na2DViewer::mouseDoubleClickEvent(QMouseEvent * event) { mouseClickManager.mouseDoubleClickEvent(event); if (event->button() != Qt::LeftButton) return; double dx = event->pos().x() - width()/2.0; double dy = event->pos().y() - height()/2.0; translateImage(-dx, -dy); }
void SkSVGImage::translate(SkSVGParser& parser, bool defState) { parser._startElement("image"); INHERITED::translate(parser, defState); SVG_ADD_ATTRIBUTE(x); SVG_ADD_ATTRIBUTE(y); // SVG_ADD_ATTRIBUTE(width); // SVG_ADD_ATTRIBUTE(height); translateImage(parser); parser._endElement(); }
void Font::toSource(QString c_name) { QFile f(c_name + ".c"); f.open(QFile::Truncate | QFile::WriteOnly); QTextStream ts(&f); ts << "#include \"" << c_name << ".h\"" << endl; ts << endl; ts << "static CharInfo _" << c_name << "_char_info[] = {" << endl; for (char c = _minChar; c < _maxChar; ++c) { ts << "\t"; Char *C = 0; if (_chars.contains(c)) { QMap<char, Char*>::Iterator iter = _chars.find(c); C = iter.value(); ts << *C; } else { ts << Char::empty(); } ts << ","; if (C) { ts << " // '" << C->code << "'" << endl; } else { ts << " // NULL" << endl; } } ts << "};" << endl; ts << endl; ts << "static uint8_t _" << c_name << "_char_data[] = {" << endl; translateImage(ts, _image); ts.setIntegerBase(10); ts << "};" << endl; ts << endl; ts << "FontInfo font_" << c_name << " = {" << endl; ts << "\t'" << _minChar << "'," << endl; ts << "\t'" << _maxChar << "'," << endl; ts << "\t_" << c_name << "_char_info," << endl; ts << "\t_" << c_name << "_char_data," << endl; ts << "\t" << _image.width() << "," << endl; ts << "\t" << size << "," << endl; ts << "\t" << height << endl; ts << "};" << endl; ts.flush(); f.close(); }