⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainprogram.cpp

📁 一个关于snake算法的VISUAL C++的实现
💻 CPP
字号:
// Qt includes
#include <Qt/qapplication.h>

// local includes
#include "MainProgram.h"
#include "MainWindow.h"
#include "QtCvWrapper.h"

////////////////////////////////////////////////////////////////////////////
MainProgram::MainProgram(int argc, char* argv[])
{
	// create a new instance of QApplication with params argc and argv
	QApplication app( argc, argv );
	// create a new instance of MainWindow with no parent widget
	m_mainWindow = new MainWindow(0, Qt::Window);
	// The main widget is like any other, in most respects except that if it is deleted,
	// the application exits.
	app.setActiveWindow(m_mainWindow);
	// set the application style
	app.setStyle("plastique");
	// resize window to 800x600 (including the 512x512 image space)
	m_mainWindow->resize(800,530);
	// Shows the widget and its child widgets.
	m_mainWindow->show();

	m_wrapper = new QtCvWrapper(this, m_mainWindow);

	// connections between gui and not-gui
	QObject::connect(m_mainWindow, SIGNAL(signalSnakeButtonPressed()), m_wrapper, SLOT(slotSnakeButtonPressed()));
	QObject::connect(m_mainWindow, SIGNAL(signalDemoButtonPressed()), m_wrapper, SLOT(slotTest()));
	QObject::connect(m_mainWindow, SIGNAL(signalImageOpened()), m_wrapper, SLOT(slotImageOpened()));
	QObject::connect(m_mainWindow, SIGNAL(signalInitCurve()), m_wrapper, SLOT(slotInitCurve()));
	// iteration on/off
	QObject::connect(m_mainWindow, SIGNAL(signalIterationOn()), m_wrapper, SLOT(slotIterationOn()));
	QObject::connect(m_mainWindow, SIGNAL(signalIterationOff()), m_wrapper, SLOT(slotIterationOff()));
	QObject::connect(m_mainWindow, SIGNAL(signalIterationStep()), m_wrapper, SLOT(slotIterationStep()));



	

	// Enters the main event loop and waits until exit() is called
	// or the main widget is destroyed, and returns the value that
	// was set via to exit() (which is 0 if exit() is called via quit()).
	app.exec();
}

////////////////////////////////////////////////////////////////////////////
MainProgram::~MainProgram(void)
{
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -