這一篇,是把上一篇的文章改成一個class
header file

阿勇 發表在 痞客邦 留言(0) 人氣()

使用QFontDatabase::addApplicationFont,可以直接讀取字型 檔(ttc, ttf)。

#include <QFontDatabase>
QString loadFontFromFile(QString path)
{
static QString font;
static bool loaded = false;
if(!loaded)
{
loaded = true;
int loadedFontID = QFontDatabase::addApplicationFont(path);
QStringList loadedFontFamilies = QFontDatabase::applicationFontFamilies(loadedFontID);
if(!loadedFontFamilies.empty())
font = loadedFontFamilies.at(0);
}
return font;
}
QString fontName = loadFontFromFile(":/font/font2.TTC");
QFont font(fontName);

阿勇 發表在 痞客邦 留言(0) 人氣()



利用QPainterPath算出polygon之後,就可以畫出邊框
QPainterPath path;
path.addText(QPointF(0, 0), QFont("Arial", 100), QString::fromUtf8("你要不要喝紅茶ˊ_>ˋ?"));
GLuint id = glGenLists(1);
glNewList(id, GL_COMPILE);
foreach(QPolygonF polygon, path.toSubpathPolygons()){
glBegin(GL_LINE_LOOP);
foreach(QPointF point, polygon){
glVertex3f(point.rx(), -point.ry(), 0);
}
glEnd();
}
glEndList();

阿勇 發表在 痞客邦 留言(2) 人氣()

首先建一個iso檔
hdiutil makehybrid /source/folder/name/ -o outputfile.iso
打開檔案
hdiutil attach -readwrite outputfile.iso
將需要的檔案丟入光碟裡

阿勇 發表在 痞客邦 留言(0) 人氣()


終於快搞定了

阿勇 發表在 痞客邦 留言(0) 人氣()


 
主要是Mac不像windows有邊框,所以不像windows只要
scene->addWidget(widget, Qt::Dialog);

阿勇 發表在 痞客邦 留言(0) 人氣()



在Mac上的應用程式,大多不是用安裝,而是解開dmg,將app拖到電腦裡。
正常情況下,Qt build出來的應該是bundle好了(例如,my.app)。
但是如果是用CONFIG -= app_bundle,想使用app架構,可以參考這裡
在windows上,動態連結庫放在跟執行檔同個目錄下即可。

阿勇 發表在 痞客邦 留言(0) 人氣()


利用 input type="file"選取本地端圖檔用FileReader的readAsDataURL讀取圖檔將圖畫到canvas用range來當sliderbar,注意firefox不支援range接下來就是拿canvas來做影像處理了最後,再利用canvas.toDataURL("image/jpeg")轉回圖檔 index.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Mosaic</title>
</head>
<body>
<input type="file" id="input" /><br/>
<canvas id="result" ></canvas>
<script src="jquery-1.9.0.min.js"></script>
<script src="mosaic.js"></script>
<script src="main.js"></script>
</body>
</html>

阿勇 發表在 痞客邦 留言(0) 人氣()


第一代(java)
第二代(Qt) 
 第三代
 第三代(修改版)

阿勇 發表在 痞客邦 留言(0) 人氣()


1.download Qt library 4.7.2 and MinGW
2.install Qt to C:\Qt\4.7.2
3.unzip mingw.zip to c:\Qt
4.download Qt creator

阿勇 發表在 痞客邦 留言(0) 人氣()



參考資料:UML类图

阿勇 發表在 痞客邦 留言(0) 人氣()

開啟C:\Program Files\NetBeans 6.5.1\etc\netbeans.conf
在netbeans_default_options後面加入"-J-Dfile.encoding=UTF-8"

阿勇 發表在 痞客邦 留言(0) 人氣()

Blog Stats
⚠️

成人內容提醒

本部落格內容僅限年滿十八歲者瀏覽。
若您未滿十八歲,請立即離開。

已滿十八歲者,亦請勿將內容提供給未成年人士。