3
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Qt C++ ウィンドウの生成

Posted at

フルスクラッチでウィンドウを表示させるには単純に次の様に記述

#include <QApplication>
#include <QWidget>

int main(int argc, char *argv[])
{
   	QApplication a(argc, argv);
	QWidget *window = new QWidget;
	window->show();

    return a.exec();
}

基本的にQWidgetクラスをインスタンスしshow()メソッドを呼び出す事で、そのQWidgetがディスプレイに表示される

##画面遷移
ユーザーに表示する画面を切り替える際は、
QWidget->QFrameを継承したQStackedWidgetを使う事で各種画面の切り替えが可能

myview.h
class MyView : public QStackedWidget
{
public:
	MyView()
}

#include <QApplication>
#include <QWidget>
#include "myview.h"

int main(int argc, char *argv[])
{
   	QApplication a(argc, argv);
	MyView *p = MyView();
	p->show()

    return a.exec();
}
3
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?