1,进程条--向用户显示程序的当前状态,向用户提示该任务需要多长时间才能够完成.
Qt-ProgressBar创建进程条,QProgressBar,为了使进程条担当起进程指示功能,需要执行定义进程条的刷新时间
paint->drawText(20,20-左上角相对于父部件的位置,260,60--字体图形的长度及宽度,AlignCenter--对齐方式,"Font:Arial,Size:16,Style:Bold")
QPainter绘图函数,paintEvent()函数begine()
end();
ellipse(),circle,drawEllipse()函数,paint->setPen(blue,4,QPen::SolidLine);
paint->drawEllipse(20,20,210,160);园,椭圆 距离窗口左上角像素数,宽度-高度
QPainter绘图函数---圆角矩形QPainter::drawRoundRect()
paint->setPen(Qpen(red,4,Qpen::SolidLine));
paint->drawRoundRect(20,20,210,160,50,50);最后两个参数决定角的圆度,0-99,99之最园.
2,pie饼图扇形QPainter::drawPie()
paint->setPen(QPPen(green,4,QPen::SolidLine));
paint->drawPie(20,20,210,160,0,500);后两个参数定义园的样式,0起始角度,500扇形弧线长度,最后两个参数不表示度,而是表示1度的16份之一,一个园就表示5760(16 * 360)
3,绘制,
paint->setPen(QPen(green,4,QPen::SolidLine));
paint->drawChord(20,20,210,160,500,10000);
paint->setPen(QPen(green,4,QPen::SolidLine));
paint->drawArc(20,20,210,160,500,10000);
paint->setPen(QPen(green,4,QPen::SolidLine));
paint->drawQuadBezier(QPointArray(QRect(20,20,210,160)));
drakYellow,drakMagenta,drakCyan,drakBlue,gray,magentablack drak,dark;
管理颜色,指定颜色
Qt指定颜色,RGB(red,green,blue),HSV(色度/饱和度、纯度)
QPrinter::getPrinter();
QPrinter print;
int proceed = print_setup();
if (proceed == true)
{
//start printing
//(start drawing to the QPrinter object)
}
else
{
//Abort
}
理解Qt对话框
QColorDialog类唯一的一个函数QColorDialog::getColot()显示颜色选择对话框,该函数返回所选中的桉树
2,文本对话框
用于选则文件的对话框
ile.cpp: In constructor ‘MyMainWindow::MyMainWindow()’:
file.cpp:19:44: error: no matching function for call to ‘QFileDialog::getOpenFileName(const char [5], const char [2])’
file = fdialog->getOpenFileName("/opt","*");
^
file.cpp:19:44: note: candidate is:
In file included from /opt/Qt5.4.1/5.4/gcc_64/include/QtWidgets/QFileDialog:1:0,
from file.cpp:3:
/opt/Qt5.4.1/5.4/gcc_64/include/QtWidgets/qfiledialog.h:200:20: note: static QString QFileDialog::getOpenFileName(QWidget*, const QString&, const QString&, const QString&, QString*, QFileDialog::Options)
static QString getOpenFileName(QWidget *parent = 0,
^
/opt/Qt5.4.1/5.4/gcc_64/include/QtWidgets/qfiledialog.h:200:20: note: no known conversion for argument 1 from ‘const char [5]’ to ‘QWidget*
Qt 打开文件的默认路径 QFileDialog::getOpenFileName()
g++ -Wl,-O1 -Wl,-rpath,/opt/Qt5.4.1/5.4/gcc_64 -Wl,-rpath,/opt/Qt5.4.1/5.4/gcc_64/lib -o font front.o -L/opt/Qt5.4.1/5.4/gcc_64/lib -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread