class Test
{
Q_DECLARE_TR_FUNCTIONS(Test)
}
QPainterPath
QLinearGradient myGradient;
QPen myPen(QColor(20,20,20));
QRectF boundingRectangle(20,20,20,20);
QPainterPath myPath;
myPath.addEllipse(boundingRectangle);
myPath.addRect(boundingRectangle);
myPath.moveTo(50,50);
myPath.lineTo(200,200);
myPath.lineTo(200,100);
myPath.lineTo(50,50);
QPainter painter(this);
painter.setBrush(myGradient);
painter.setPen(myPen);
painter.drawPath(myPath);
QBrush br(QColor(30,160,0));
painter.fillPath(myPath,br);
Qt,翻译,多语言:
Example, QObject::tr("中文");
Example, Appp->translate("QObject_class_name","中文",0,"utf8");
Linguist问题:
//qt/qt-everywhere-opensource-src-4.8.7/tools/linguist/shared/translator.cpp
Translator::Translator() :
//m_codec(QTextCodec::codecForName("ISO-8859-1")),
m_codec(QTextCodec::codecForName("UTF-8")),
m_locationsType(AbsoluteLocations),
m_indexOk(true)
{
}
Qt4简化编译:
./configure -release -rpath -qt-libpng -qt-libtiff -qt-zlib -qt-libjpeg -qt-libmng -opensource -fast -no-largefile -no-accessibility -no-qt3support -no-multimedia -no-xmlpatterns -no-audio-backend -no-phonon -no-phonon-backend -no-declarative
./configure -debug -rpath -opensource -fast -no-largefile -no-accessibility -no-declarative -no-qt3support -no-multimedia -no-xmlpatterns -no-audio-backend -no-phonon -no-phonon-backend -dbus -v
/configure -debug -rpath -opensource -fast -no-largefile -no-accessibility -no-qt3support -no-multimedia -no-xmlpatterns -no-audio-backend -no-phonon -no-phonon-backend
./configure -no-declarative -no-iwmmxt -no-webkit -no-native-gestures -no-directwrite -no-audio-backend -no-phonon -no-script
F:\TOOLS\QT-dev\qt-everywhere-opensource-src-4.8.7>configure -no-declarative -no
-iwmmxt -no-webkit -no-native-gestures -no-directwrite -no-audio-backend -no-pho
non -no-script -no-example -platform win32-msvc2010 -no-dbus
$ ./configure.exe -help
Usage: configure [-buildkey <key>]
[-release] [-debug] [-debug-and-release] [-shared] [-static]
[-no-fast] [-fast] [-no-exceptions] [-exceptions]
..... 可以使用此处选项
Qt5编译:
./configure -rpath -opensource -qt-xcb -no-accessibility
Qt-QMake 设置根据头文件是否更改,来决定哪些文件是否需要重新编译,配置附加参数
QMAKE_CXXFLAGS+=-MD
Qt 渲染:
QWidgetBackingStore::sync()
wd->drawWidget(windowSurface->paintDevice(), toBePainted, offset, flags, 0, this);
void QWidgetPrivate::paintBackground(QPainter *painter, const QRegion &rgn, int flags) const
QT的bin目录加入到系统环境变量
打开CMD,切换到源代码文件夹下,输入 qmake -project 生成.pro的QT工程文件
再次输入 qmake -r -spec win32-msvc2013 -tp vc 即可生成2013的vcxproj工程文件
窗口:
1、Qt切换到窗口:
hide();
show();
if (isMaximized()){
showMaximized();
} else if (isMinimized()){
showNormal();
} else if (isFullScreen()) {
showNormal();
showFullScreen();
}
show();