Start adding hello world app.
This commit is contained in:
parent
ca2fd3145e
commit
dddb296a3a
7 changed files with 59 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
.DS_Store
|
11
CMakeLists.txt
Normal file
11
CMakeLists.txt
Normal file
|
@ -0,0 +1,11 @@
|
|||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(scribbles VERSION 1.0.0 LANGUAGES CXX)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
find_package(Qt6 REQUIRED COMPONENTS Widgets)
|
||||
qt_standard_project_setup()
|
||||
|
||||
add_subdirectory(src/app)
|
13
src/app/CMakeLists.txt
Normal file
13
src/app/CMakeLists.txt
Normal file
|
@ -0,0 +1,13 @@
|
|||
|
||||
qt_add_executable(scribbles
|
||||
main.cpp
|
||||
MainWindow.cpp
|
||||
MainWindow.ui
|
||||
)
|
||||
|
||||
target_link_libraries(scribbles PRIVATE Qt6::Widgets)
|
||||
|
||||
set_target_properties(scribbles PROPERTIES
|
||||
WIN32_EXECUTABLE ON
|
||||
MACOSX_BUNDLE ON
|
||||
)
|
0
src/app/MainWindow.cpp
Normal file
0
src/app/MainWindow.cpp
Normal file
0
src/app/MainWindow.h
Normal file
0
src/app/MainWindow.h
Normal file
0
src/app/MainWindow.ui
Normal file
0
src/app/MainWindow.ui
Normal file
34
src/app/main.cpp
Normal file
34
src/app/main.cpp
Normal file
|
@ -0,0 +1,34 @@
|
|||
#include <QApplication>
|
||||
#include <QCommandLineParser>
|
||||
|
||||
#include "MainWindow.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
QCoreApplication::setOrganizationName("Scribbles"_L1);
|
||||
QCoreApplication::setApplicationName("Scribbles"_L1);
|
||||
QCoreApplication::setApplicationVersion("0.1"_L1);
|
||||
|
||||
QCommandLineParser parser;
|
||||
parser.setApplicationDescription(QApplication::translate("main",
|
||||
"A note taking and sketching app"));
|
||||
parser.addHelpOption();
|
||||
parser.addVersionOption();
|
||||
parser.addPositionalArgument("File"_L1, QApplication::translate("main",
|
||||
"A Scribbles file to open"));
|
||||
parser.process(app);
|
||||
|
||||
const QStringList &positionalArguments = parser.positionalArguments();
|
||||
const QString &fileName = (positionalArguments.count() > 0) ? positionalArguments.at(0)
|
||||
: QString();
|
||||
|
||||
MainWindow w;
|
||||
w.show();
|
||||
if (!fileName.isEmpty())
|
||||
{
|
||||
w.openFile(fileName);
|
||||
}
|
||||
|
||||
return app.exec();
|
||||
}
|
Loading…
Reference in a new issue