Chinaunix首页 | 论坛 | 博客
  • 博客访问: 273139
  • 博文数量: 55
  • 博客积分: 2030
  • 博客等级: 大尉
  • 技术积分: 737
  • 用 户 组: 普通用户
  • 注册时间: 2006-04-13 18:06
文章分类

全部博文(55)

文章存档

2011年(2)

2010年(7)

2009年(17)

2008年(29)

我的朋友

分类: C/C++

2008-07-12 22:54:46

读文件:

QFile dictionaryFile(":/dictionary/words.txt");
     dictionaryFile.open(QIODevice::ReadOnly);
     QTextStream inputStream(&dictionaryFile);

     int x = 5;
     int y = 5;

     while (!inputStream.atEnd()) {
         QString word;
         inputStream >> word;
         if (!word.isEmpty()) {
             DragLabel *wordLabel = new DragLabel(word, this);
             wordLabel->move(x, y);
             wordLabel->show();
             x += wordLabel->width() + 2;
             if (x >= 195) {
                 x = 5;
                 y += wordLabel->height() + 2;
             }
         }
     }

绝对值:qAbs 最大值qMax
QTime time = QTime::currentTime();

painter.translate(width() / 2, height() / 2);

painter.save();
painter.rotate(30.0 * ((time.hour() + time.minute() / 60.0))); //clockwise
painter.drawConvexPolygon(hourHand, 3);
painter.restore();

定义图形

static const QPoint hourHand[3] = {
         QPoint(7, 8),
         QPoint(-7, 8),
         QPoint(0, -40)
     };

 

QString("Column %1").arg(section);

阅读(1294) | 评论(0) | 转发(0) |
0

上一篇:[Effective C++] Item 18

下一篇:Qt的绘图系统

给主人留下些什么吧!~~