qt skeleton
This commit is contained in:
parent
296a493159
commit
6e1bc03f3f
|
@ -9,6 +9,13 @@ set(PROJECT_NAME "Frostbite")
|
|||
set(PROJECT_Version 0.1)
|
||||
set(PROJECT_LIBS)
|
||||
|
||||
# CMAKE_PREFIX_PATH evn var or cach var should be set to find Qt
|
||||
set(CMAKE_PREFIX_PATH "C:\\Qt\\6.0.2\\msvc2019_64")
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
find_package(Qt6 COMPONENTS Widgets REQUIRED)
|
||||
|
||||
set(COVERAGE OFF CACHE BOOL "Coverage")
|
||||
|
||||
set(Boost_USE_STATIC_LIBS ON)
|
||||
|
@ -78,6 +85,8 @@ set(TESTAPP_SRC_FILES
|
|||
|
||||
set(CUTTOWN_SRC_FILES
|
||||
CuttownTest/Main.cpp
|
||||
CuttownTest/mainWindow.cpp
|
||||
CuttownTest/mainWindow.h
|
||||
)
|
||||
|
||||
add_library(snowlib STATIC ${SNOWLIB_SRC_FILES})
|
||||
|
@ -86,7 +95,5 @@ add_executable(testApp ${TESTAPP_SRC_FILES})
|
|||
target_link_libraries(testApp snowlib ${Boost_LIBRARIES} ${GLEW_LIBRARIES} SDL2::SDL2 SDL2::SDL2main opengl32.lib)
|
||||
|
||||
add_executable(cuttownTest ${CUTTOWN_SRC_FILES})
|
||||
target_link_libraries(cuttownTest snowlib ${Boost_LIBRARIES} ${GLEW_LIBRARIES} SDL2::SDL2 SDL2::SDL2main opengl32.lib)
|
||||
|
||||
#include(BoostTestHelpers.cmake)
|
||||
target_link_libraries(cuttownTest snowlib ${Boost_LIBRARIES} ${GLEW_LIBRARIES} SDL2::SDL2 SDL2::SDL2main opengl32.lib Qt6::Widgets)
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
// See https://go.microsoft.com//fwlink//?linkid=834763 for more information about this file.
|
||||
"configurations": [
|
||||
{
|
||||
"name": "x64-Debug",
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
#include "SDL.h"
|
||||
#include <QApplication>
|
||||
|
||||
#include "windows.h"
|
||||
#include "LmpRepository.h"
|
||||
|
@ -13,9 +14,18 @@
|
|||
#include "WorldReader.h"
|
||||
#include "World.h"
|
||||
|
||||
#include "mainWindow.h"
|
||||
|
||||
LmpRepository* lmpRepository;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
//Q_INIT_RESOURCE(dockwidgets);
|
||||
MainWindow mainWin;
|
||||
mainWin.show();
|
||||
return app.exec();
|
||||
/*
|
||||
string dataPath = "D:\\emu\\bgda\\BG\\DATA\\";
|
||||
if (argc == 2){
|
||||
dataPath = argv[1];
|
||||
|
@ -27,6 +37,7 @@ int main(int argc, char **argv) {
|
|||
|
||||
|
||||
return 0;
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
|
66
CuttownTest/mainWindow.cpp
Normal file
66
CuttownTest/mainWindow.cpp
Normal file
|
@ -0,0 +1,66 @@
|
|||
|
||||
#include <QtWidgets>
|
||||
#include "mainWindow.h"
|
||||
|
||||
MainWindow::MainWindow()
|
||||
: textEdit(new QTextEdit)
|
||||
{
|
||||
setCentralWidget(textEdit);
|
||||
|
||||
createActions();
|
||||
createStatusBar();
|
||||
createDockWindows();
|
||||
|
||||
setWindowTitle(tr("World Viewer"));
|
||||
|
||||
setUnifiedTitleAndToolBarOnMac(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MainWindow::about()
|
||||
{
|
||||
QMessageBox::about(this, tr("About World Viewer"),
|
||||
tr("blah blah blah"));
|
||||
}
|
||||
|
||||
void MainWindow::createActions()
|
||||
{
|
||||
QMenu* fileMenu = menuBar()->addMenu(tr("&File"));
|
||||
QToolBar* fileToolBar = addToolBar(tr("File"));
|
||||
|
||||
fileMenu->addSeparator();
|
||||
|
||||
QAction* quitAct = fileMenu->addAction(tr("&Quit"), this, &QWidget::close);
|
||||
quitAct->setShortcuts(QKeySequence::Quit);
|
||||
quitAct->setStatusTip(tr("Quit the application"));
|
||||
|
||||
viewMenu = menuBar()->addMenu(tr("&View"));
|
||||
|
||||
menuBar()->addSeparator();
|
||||
|
||||
QMenu* helpMenu = menuBar()->addMenu(tr("&Help"));
|
||||
|
||||
QAction* aboutAct = helpMenu->addAction(tr("&About"), this, &MainWindow::about);
|
||||
aboutAct->setStatusTip(tr("Show the application's About box"));
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::createStatusBar()
|
||||
{
|
||||
statusBar()->showMessage(tr("Ready"));
|
||||
}
|
||||
|
||||
void MainWindow::createDockWindows()
|
||||
{
|
||||
QDockWidget* dock = new QDockWidget(tr("Structure"), this);
|
||||
dock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
||||
listWidget = new QListWidget(dock);
|
||||
listWidget->addItems(QStringList()
|
||||
<< "xxx"
|
||||
);
|
||||
dock->setWidget(listWidget);
|
||||
addDockWidget(Qt::LeftDockWidgetArea, dock);
|
||||
viewMenu->addAction(dock->toggleViewAction());
|
||||
}
|
||||
|
35
CuttownTest/mainWindow.h
Normal file
35
CuttownTest/mainWindow.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QAction;
|
||||
class QListWidget;
|
||||
class QMenu;
|
||||
class QTextEdit;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MainWindow();
|
||||
|
||||
private slots:
|
||||
void about();
|
||||
|
||||
private:
|
||||
void createActions();
|
||||
void createStatusBar();
|
||||
void createDockWindows();
|
||||
|
||||
QTextEdit* textEdit;
|
||||
QListWidget* listWidget;
|
||||
|
||||
QMenu* viewMenu;
|
||||
};
|
||||
|
Reference in a new issue