读文件:
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) |