Skip to content
Snippets Groups Projects
Commit 6f22f088 authored by Silas Dohm's avatar Silas Dohm
Browse files

init

parents
No related branches found
No related tags found
1 merge request!1Master
cmake_minimum_required(VERSION 3.5)
project(sodoku_solver VERSION 0.1 LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets REQUIRED)
set(PROJECT_SOURCES
main.cpp
window.h
window.cpp
)
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qt_add_executable(sodoku_solver
MANUAL_FINALIZATION
${PROJECT_SOURCES}
)
# Define target properties for Android with Qt 6 as:
# set_property(TARGET sodoku_solver APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
# ${CMAKE_CURRENT_SOURCE_DIR}/android)
# For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation
else()
if(ANDROID)
add_library(sodoku_solver SHARED
${PROJECT_SOURCES}
)
# Define properties for Android with Qt 5 after find_package() calls as:
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
else()
add_executable(sodoku_solver
${PROJECT_SOURCES}
)
endif()
endif()
target_link_libraries(sodoku_solver PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
set_target_properties(sodoku_solver PROPERTIES
MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
)
if(QT_VERSION_MAJOR EQUAL 6)
qt_finalize_executable(sodoku_solver)
endif()
Makefile 0 → 100644
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.22
# Default target executed when no arguments are given to make.
default_target: all
.PHONY : default_target
# Allow only one "make -f Makefile2" at a time, but pass parallelism.
.NOTPARALLEL:
#=============================================================================
# Special targets provided by cmake.
# Disable implicit rules so canonical targets will work.
.SUFFIXES:
# Disable VCS-based implicit rules.
% : %,v
# Disable VCS-based implicit rules.
% : RCS/%
# Disable VCS-based implicit rules.
% : RCS/%,v
# Disable VCS-based implicit rules.
% : SCCS/s.%
# Disable VCS-based implicit rules.
% : s.%
.SUFFIXES: .hpux_make_needs_suffix_list
# Command-line flag to silence nested $(MAKE).
$(VERBOSE)MAKESILENT = -s
#Suppress display of executed commands.
$(VERBOSE).SILENT:
# A target that is always out of date.
cmake_force:
.PHONY : cmake_force
#=============================================================================
# Set environment variables for the build.
# The shell in which to execute make rules.
SHELL = /bin/sh
# The CMake executable.
CMAKE_COMMAND = /usr/bin/cmake
# The command to remove a file.
RM = /usr/bin/cmake -E rm -f
# Escaping for special characters.
EQUALS = =
# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /home/sls/Documents/dev/tqt_new_beginning
# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /home/sls/Documents/dev/tqt_new_beginning
#=============================================================================
# Targets provided globally by CMake.
# Special rule for the target edit_cache
edit_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "No interactive CMake dialog available..."
/usr/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available.
.PHONY : edit_cache
# Special rule for the target edit_cache
edit_cache/fast: edit_cache
.PHONY : edit_cache/fast
# Special rule for the target rebuild_cache
rebuild_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
/usr/bin/cmake --regenerate-during-build -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : rebuild_cache
# Special rule for the target rebuild_cache
rebuild_cache/fast: rebuild_cache
.PHONY : rebuild_cache/fast
# The main all target
all: cmake_check_build_system
$(CMAKE_COMMAND) -E cmake_progress_start /home/sls/Documents/dev/tqt_new_beginning/CMakeFiles /home/sls/Documents/dev/tqt_new_beginning//CMakeFiles/progress.marks
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 all
$(CMAKE_COMMAND) -E cmake_progress_start /home/sls/Documents/dev/tqt_new_beginning/CMakeFiles 0
.PHONY : all
# The main clean target
clean:
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 clean
.PHONY : clean
# The main clean target
clean/fast: clean
.PHONY : clean/fast
# Prepare targets for installation.
preinstall: all
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall
# Prepare targets for installation.
preinstall/fast:
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall/fast
# clear depends
depend:
$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
.PHONY : depend
#=============================================================================
# Target rules for targets named sodoku_solver
# Build rule for target.
sodoku_solver: cmake_check_build_system
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 sodoku_solver
.PHONY : sodoku_solver
# fast build rule for target.
sodoku_solver/fast:
$(MAKE) $(MAKESILENT) -f CMakeFiles/sodoku_solver.dir/build.make CMakeFiles/sodoku_solver.dir/build
.PHONY : sodoku_solver/fast
#=============================================================================
# Target rules for targets named sodoku_solver_autogen
# Build rule for target.
sodoku_solver_autogen: cmake_check_build_system
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 sodoku_solver_autogen
.PHONY : sodoku_solver_autogen
# fast build rule for target.
sodoku_solver_autogen/fast:
$(MAKE) $(MAKESILENT) -f CMakeFiles/sodoku_solver_autogen.dir/build.make CMakeFiles/sodoku_solver_autogen.dir/build
.PHONY : sodoku_solver_autogen/fast
main.o: main.cpp.o
.PHONY : main.o
# target to build an object file
main.cpp.o:
$(MAKE) $(MAKESILENT) -f CMakeFiles/sodoku_solver.dir/build.make CMakeFiles/sodoku_solver.dir/main.cpp.o
.PHONY : main.cpp.o
main.i: main.cpp.i
.PHONY : main.i
# target to preprocess a source file
main.cpp.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/sodoku_solver.dir/build.make CMakeFiles/sodoku_solver.dir/main.cpp.i
.PHONY : main.cpp.i
main.s: main.cpp.s
.PHONY : main.s
# target to generate assembly for a file
main.cpp.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/sodoku_solver.dir/build.make CMakeFiles/sodoku_solver.dir/main.cpp.s
.PHONY : main.cpp.s
sodoku_solver_autogen/mocs_compilation.o: sodoku_solver_autogen/mocs_compilation.cpp.o
.PHONY : sodoku_solver_autogen/mocs_compilation.o
# target to build an object file
sodoku_solver_autogen/mocs_compilation.cpp.o:
$(MAKE) $(MAKESILENT) -f CMakeFiles/sodoku_solver.dir/build.make CMakeFiles/sodoku_solver.dir/sodoku_solver_autogen/mocs_compilation.cpp.o
.PHONY : sodoku_solver_autogen/mocs_compilation.cpp.o
sodoku_solver_autogen/mocs_compilation.i: sodoku_solver_autogen/mocs_compilation.cpp.i
.PHONY : sodoku_solver_autogen/mocs_compilation.i
# target to preprocess a source file
sodoku_solver_autogen/mocs_compilation.cpp.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/sodoku_solver.dir/build.make CMakeFiles/sodoku_solver.dir/sodoku_solver_autogen/mocs_compilation.cpp.i
.PHONY : sodoku_solver_autogen/mocs_compilation.cpp.i
sodoku_solver_autogen/mocs_compilation.s: sodoku_solver_autogen/mocs_compilation.cpp.s
.PHONY : sodoku_solver_autogen/mocs_compilation.s
# target to generate assembly for a file
sodoku_solver_autogen/mocs_compilation.cpp.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/sodoku_solver.dir/build.make CMakeFiles/sodoku_solver.dir/sodoku_solver_autogen/mocs_compilation.cpp.s
.PHONY : sodoku_solver_autogen/mocs_compilation.cpp.s
window.o: window.cpp.o
.PHONY : window.o
# target to build an object file
window.cpp.o:
$(MAKE) $(MAKESILENT) -f CMakeFiles/sodoku_solver.dir/build.make CMakeFiles/sodoku_solver.dir/window.cpp.o
.PHONY : window.cpp.o
window.i: window.cpp.i
.PHONY : window.i
# target to preprocess a source file
window.cpp.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/sodoku_solver.dir/build.make CMakeFiles/sodoku_solver.dir/window.cpp.i
.PHONY : window.cpp.i
window.s: window.cpp.s
.PHONY : window.s
# target to generate assembly for a file
window.cpp.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/sodoku_solver.dir/build.make CMakeFiles/sodoku_solver.dir/window.cpp.s
.PHONY : window.cpp.s
# Help Target
help:
@echo "The following are some of the valid targets for this Makefile:"
@echo "... all (the default if no target is provided)"
@echo "... clean"
@echo "... depend"
@echo "... edit_cache"
@echo "... rebuild_cache"
@echo "... sodoku_solver_autogen"
@echo "... sodoku_solver"
@echo "... main.o"
@echo "... main.i"
@echo "... main.s"
@echo "... sodoku_solver_autogen/mocs_compilation.o"
@echo "... sodoku_solver_autogen/mocs_compilation.i"
@echo "... sodoku_solver_autogen/mocs_compilation.s"
@echo "... window.o"
@echo "... window.i"
@echo "... window.s"
.PHONY : help
#=============================================================================
# Special targets to cleanup operation of make.
# Special rule to run CMake to check the build system integrity.
# No rule that depends on this can have commands that come from listfiles
# because they might be regenerated.
cmake_check_build_system:
$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
.PHONY : cmake_check_build_system
main.cpp 0 → 100644
#include "window.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Window w;
w.show();
return a.exec();
}
#include "window.h"
#include<QApplication>
#include<QStandardPaths>
Window::Window(QWidget *parent)
: QWidget{parent}
{
setFixedSize(1600,900);
m_counter = 0;
//quitbutton
m_buttonQuit = new QPushButton("quit",this);
m_buttonQuit->setGeometry(0,height() -30,width(),30);
//slider
m_slider = new QSlider(this);
m_slider->setOrientation(Qt::Horizontal);
m_slider->setRange(0,100);
m_slider->setValue(0);
m_slider->setGeometry(10,20,width() -10,20);
//progressbar
m_progressBar = new QProgressBar(this);
m_progressBar->setRange(0,100);
m_progressBar->setValue(0);
m_progressBar->setGeometry(10,40,width() -10,20);
//button
m_button = new QPushButton("Hello QT!",this);
m_button->setGeometry(0,80,width(),30);
m_button->setCheckable(true);
//signals and slots :)
connect(m_button,SIGNAL(clicked(bool)),this,SLOT(slotButtonClicked(bool)));
connect(m_buttonQuit,SIGNAL(clicked()),QApplication::instance(),SLOT(quit()));
connect(m_slider,SIGNAL(valueChanged(int)),m_progressBar,SLOT(setValue(int)));
connect(this,SIGNAL(counterReached()),QApplication::instance(),SLOT(quit()));
}
void Window::slotButtonClicked(bool checked)
{
checked ? m_button->setText("Checked") : m_button->setText("Hello QT!");
m_counter ++;
if(m_counter == 10){
emit counterReached();
}
}
window.h 0 → 100644
#ifndef WINDOW_H
#define WINDOW_H
#include <QWidget>
#include <QPushButton>
#include <QProgressBar>
#include <QSlider>
class Window : public QWidget
{
Q_OBJECT
public:
explicit Window(QWidget *parent = nullptr);
private:
QPushButton *m_buttonQuit;
QPushButton *m_button;
QProgressBar *m_progressBar;
QSlider *m_slider;
int m_counter;
signals:
void counterReached();
private slots:
void slotButtonClicked(bool checked);
};
#endif // WINDOW_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment