Help us understand the problem. What is going on with this article?

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

More than 5 years have passed since last update.

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

を同梱すること

以上です。

yasumodev
「長い旅行に必要なのは大きなカバンじゃなく、口ずさめる一つの歌さ」スナフキン
https://twitter.com/yasumodev
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
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  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
ユーザーは見つかりませんでした