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
35 changes: 35 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Linux CI

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: Install Qt
uses: jurplel/install-qt-action@v3.3.0
with:
version: '6.5.0'
host: 'linux'
target: 'desktop'
arch: 'gcc_64'
modules: 'qtnetworkauth'
archives: 'icu qtbase qtsvg'
aqtversion: '==3.1.*'
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_CXX_STANDARD=14 -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build
13 changes: 6 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
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 @@ -92,7 +92,6 @@ target_include_directories(QCodeEditor PUBLIC
if(CMAKE_COMPILER_IS_GNUCXX)
target_compile_options(QCodeEditor
PRIVATE
-ansi
-pedantic
-Wall
-Wextra
Expand All @@ -104,7 +103,7 @@ if(CMAKE_COMPILER_IS_GNUCXX)
endif(CMAKE_COMPILER_IS_GNUCXX)

target_link_libraries(QCodeEditor
Qt5::Core
Qt5::Widgets
Qt5::Gui
Qt::Core
Qt::Widgets
Qt::Gui
)
14 changes: 7 additions & 7 deletions example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ 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
Qt::Core
Qt::Widgets
Qt::Gui
QCodeEditor
)
)
9 changes: 5 additions & 4 deletions example/src/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@
#include <QPythonHighlighter>

// Qt
#include <QComboBox>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QCheckBox>
#include <QSpinBox>
#include <QComboBox>
#include <QFile>
#include <QGroupBox>
#include <QHBoxLayout>
#include <QLabel>
#include <QSpinBox>
#include <QVBoxLayout>

MainWindow::MainWindow(QWidget* parent) :
QMainWindow(parent),
Expand Down
15 changes: 8 additions & 7 deletions src/internal/QCodeEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,16 +537,17 @@ 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(indentationLevel, (int) m_tabReplace.size());

auto cursor = textCursor();
auto cursor = textCursor();

cursor.movePosition(QTextCursor::MoveOperation::StartOfLine);
cursor.movePosition(QTextCursor::MoveOperation::Right,
QTextCursor::MoveMode::KeepAnchor, indentationLevel);
cursor.movePosition(QTextCursor::MoveOperation::StartOfLine);
cursor.movePosition(QTextCursor::MoveOperation::Right,
QTextCursor::MoveMode::KeepAnchor,
indentationLevel);

cursor.removeSelectedText();
return;
cursor.removeSelectedText();
return;
}

QTextEdit::keyPressEvent(e);
Expand Down
7 changes: 2 additions & 5 deletions src/internal/QLanguage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,15 @@ bool QLanguage::load(QIODevice* device)

if (type == QXmlStreamReader::TokenType::StartElement)
{
if (reader.name() == "section")
{
if (reader.name().toString() == "section") {
if (!list.empty())
{
m_list[name] = list;
list.clear();
}

name = reader.attributes().value("name").toString();
}
else if (reader.name() == "name")
{
} else if (reader.name().toString() == "name") {
readText = true;
}
}
Expand Down
19 changes: 7 additions & 12 deletions src/internal/QSyntaxStyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,12 @@ bool QSyntaxStyle::load(QString fl)

if(token == QXmlStreamReader::StartElement)
{
if (reader.name() == "style-scheme")
{
if (reader.name().toString() == "style-scheme") {
if (reader.attributes().hasAttribute("name"))
{
m_name = reader.attributes().value("name").toString();
}
}
else if (reader.name() == "style")
{
} else if (reader.name().toString() == "style") {
auto attributes = reader.attributes();

auto name = attributes.value("name");
Expand All @@ -50,21 +47,19 @@ bool QSyntaxStyle::load(QString fl)
format.setForeground(QColor(attributes.value("foreground").toString()));
}

if (attributes.hasAttribute("bold") &&
attributes.value("bold") == "true")
{
if (attributes.hasAttribute("bold")
&& attributes.value("bold").toString() == "true") {
format.setFontWeight(QFont::Weight::Bold);
}

if (attributes.hasAttribute("italic") &&
attributes.value("italic") == "true")
{
if (attributes.hasAttribute("italic")
&& attributes.value("italic").toString() == "true") {
format.setFontItalic(true);
}

if (attributes.hasAttribute("underlineStyle"))
{
auto underline = attributes.value("underlineStyle");
auto underline = attributes.value("underlineStyle").toString();

auto s = QTextCharFormat::UnderlineStyle::NoUnderline;

Expand Down