Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
29
Help us understand the problem. What are the problem?

More than 5 years have passed since last update.

@yasumodev

Qt4 → Qt5 プログラム移行注意点

Qt4とQt5のちがいをざっくりまとめてます。以下の点に注意すれば、ビルドは通るはず。

yotsuba_s.jpgxxxx.pro

Qt4:

QT += core gui network webkit

Qt5:

QT += core gui network webkitwidgets
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

yotsuba_s.jpgQApplication宣言

Qt4:#include <QtGui/QApplication>
Qt5:#include <QApplication>

yotsuba_s.jpgローカルディレクトリ

Qt4:QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);
Qt5:QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);

yotsuba_s.jpgQTableWidgetの行の高さを固定する方法が異なる

Qt4:

ui->tblwgt->verticalHeader()->setResizeMode(QHeaderView::Fixed);

Qt5:

ui->tblwgt->verticalHeader()->setDefaultSectionSize(100);
ui->tblwgt->verticalHeader()->setSectionResizeMode(QHeaderView::Fixed);

yotsuba_s.jpgその他注意点

QHttp → QNetworkAccessManager
QString.toAscii() → QString.toUtf8()
SendMessageというワードが予約語(?)になったせいか、ビルドエラーになる場合がある

yotsuba_s.jpgアプリ配布

Qt5でWindowsアプリを配布するときはexeと同じ場所に

platformsフォルダ
 ├ qminimal.dll
 └ qwindows.dll

を同梱すること

以上です。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
29
Help us understand the problem. What are the problem?