Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
cmake_minimum_required(VERSION 3.6)
cmake_minimum_required(VERSION 3.11)
project(QCodeEditor)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)

option(BUILD_EXAMPLE "Example building required" Off)
option(BUILD_EXAMPLE "Example building required" On)

if (${BUILD_EXAMPLE})
message(STATUS "QCodeEditor example will be built.")
Expand Down Expand Up @@ -75,9 +75,9 @@ set(CMAKE_AUTOMOC On)
set(CMAKE_AUTORCC ON)

# Find includes in corresponding build directories
find_package(Qt5Core CONFIG REQUIRED)
find_package(Qt5Widgets CONFIG REQUIRED)
find_package(Qt5Gui CONFIG REQUIRED)
find_package(Qt6Core CONFIG REQUIRED)
find_package(Qt6Widgets CONFIG REQUIRED)
find_package(Qt6Gui CONFIG REQUIRED)

add_library(QCodeEditor STATIC
${RESOURCES_FILE}
Expand All @@ -104,7 +104,7 @@ if(CMAKE_COMPILER_IS_GNUCXX)
endif(CMAKE_COMPILER_IS_GNUCXX)

target_link_libraries(QCodeEditor
Qt5::Core
Qt5::Widgets
Qt5::Gui
Qt6::Core
Qt6::Widgets
Qt6::Gui
)
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ must not use a resource file with the same name.
(It's not a project from a Qt example.)

## Requirements
0. C++11 featured compiler.
0. Qt 5.
1. C++17 featured compiler.
2. Qt 6.
3. CMake 3.11.

## Abilities
1. Auto parentheses.
Expand Down
14 changes: 7 additions & 7 deletions example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
cmake_minimum_required(VERSION 3.6)
cmake_minimum_required(VERSION 3.11)
project(QCodeEditorExample)

set(CMAKE_CXX_STANDARD 17)

set(CMAKE_AUTOMOC On)
set(CMAKE_AUTORCC ON)

find_package(Qt5Core CONFIG REQUIRED)
find_package(Qt5Widgets CONFIG REQUIRED)
find_package(Qt5Gui CONFIG REQUIRED)
find_package(Qt6Core CONFIG REQUIRED)
find_package(Qt6Widgets CONFIG REQUIRED)
find_package(Qt6Gui CONFIG REQUIRED)

add_executable(QCodeEditorExample
resources/demo_resources.qrc
Expand All @@ -22,8 +22,8 @@ target_include_directories(QCodeEditorExample PUBLIC
)

target_link_libraries(QCodeEditorExample
Qt5::Core
Qt5::Widgets
Qt5::Gui
QCodeEditor
Qt6::Core
Qt6::Widgets
Qt6::Gui
)
1 change: 1 addition & 0 deletions example/src/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <QSpinBox>
#include <QGroupBox>
#include <QLabel>
#include <QFile>

MainWindow::MainWindow(QWidget* parent) :
QMainWindow(parent),
Expand Down
2 changes: 1 addition & 1 deletion src/internal/QCodeEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ void QCodeEditor::keyPressEvent(QKeyEvent* e) {

// Shortcut for moving line to left
if (m_replaceTab && e->key() == Qt::Key_Backtab) {
indentationLevel = std::min(indentationLevel, m_tabReplace.size());
indentationLevel = std::min<int>(indentationLevel, m_tabReplace.size());

auto cursor = textCursor();

Expand Down