1.操作符(
++,+,+=,
小于号等)重载
新建QT项目,编写头文件
#ifndef
DIALOG_H
#define
DIALOG_H
#include
<QDialog>
#include
<QLabel>
namespace
Ui{class
Dialog
;}//编写自己的Label
class
myLabel
{public
://一定要是共有的,才可以被调用
QLabel
*ql;intcx;intcy;myLabel
(){ql=newQLabel
("12345"
);cx=cy=300;ql->move(
cx,cy);//移动位置
}~myLabel
(){delete
ql;}void
show()
{ql->show();
}};class
Dialog
:public
QDialog
{Q_OBJECT
public
:intx;//长,宽
inty;intcx;//移动到的位置x坐标
intcy;public
:explicit
Dialog
(QWidget
*parent
=);//通过友元函数进行重载
friend
void
operator
+= ...
附件列表