Qt,笔记

9 篇文章 0 订阅

 Qt 不继承QObject也可以使用tr函数

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();

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值