zoukankan      html  css  js  c++  java
  • Qt常用类——Qpoint

    QPoint 类代表一个坐标点,实现在 QtCore 共享库中。它可以认为是一个整型的横坐标和一个整型的纵坐标的组合。

    构造

    QPoint 类支持以下两种构造方式:

    QPoint();     // 构造横纵坐标均为 0 的 QPoint 对象  
    QPoint(int x, int y);    // 构造横纵坐标分别为 x 和 y 的 QPont 对象  
    

    属性

    通过以下成员函数可得到 QPoint 对象中的横纵坐标的引用

    int &rx();    // 得到横坐标的引用  
    int &ry();    // 到到纵坐标的引用  
    

    通过以下的成员函数可以设置 QPoint 对象中的横纵坐标:

    void setX(int x);    // 设置横坐标为 x  
    void setY(int y);    // 设置纵坐标为 y  
    

    下面两个成员函数则是只读的,可以获得 QPoint 对象中的横纵坐标:

    int x() const;    // 获得横坐标  
    int y() const;    // 获得纵坐标 
    

    操作符

    QPoint 类支持加法和减法的复合赋值操作:

    QPoint &operator+=(const QPoint &point);    // 加赋值  
    QPoint &operator-=(const QPoint &point);    // 减赋值 
    

    这两个操作符是它的成员。而以下的操作符则不是它的成员:

    const QPoint operator+(const QPoint &p1, const QPoint &p2);    // 加法  
    const QPoint operator-(const QPoint &p1, const QPoint &p2);     // 减法  
    const QPoint operator-(const QPoint &point);                    // 取负数  
    bool operator==(const QPoint &p1, const QPoint &p2);            // 判断是否相等  
    bool operator!=(const QPoint &p1, const QPoint);                // 判断是否不等  
    
  • 相关阅读:
    滴水穿石Pydoop 架构和模块包介绍
    滴水穿石SSH Secure Shell Client安装和使用
    安装memcache到CentOS(另附yum法)
    php文件锁(转)
    MySQL中distinct和group by性能比较
    php中的自动加载
    php注释标准
    新浪API40310错误解决方法
    CentOS 5.5使用yum来安装LAMP(php运行环境)(转)
    MySQL优化之COUNT()效率
  • 原文地址:https://www.cnblogs.com/wuyepeng/p/9722094.html
Copyright © 2011-2022 走看看