Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qt 6 compatibility with CI build #47

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

l3enQ
Copy link

@l3enQ l3enQ commented Aug 23, 2023

No description provided.

CI actions added
cmakelist updated for actions as -ansi option causes issues
@agreenenNV
Copy link

Could this please be merged ?
Current Qt6 does not work with the as-is repo ?

@baziorek
Copy link

This Pull request is quite usefull. I suggest to merge. I was able to run with QT6.

@Duolabs
Copy link

Duolabs commented Apr 17, 2024

This Pull request is quite usefull. I suggest to merge. I was able to run with QT6.

How did you make it? I am struggling to compile but from QT5 to QT6 it won't work. It looks like a nice project but there ain't any way to take a step forward

@baziorek
Copy link

This Pull request is quite usefull. I suggest to merge. I was able to run with QT6.

How did you make it? I am struggling to compile but from QT5 to QT6 it won't work. It looks like a nice project but there ain't any way to take a step forward

TBH I changed the project from QT5 -> QT6 by my own. I did this by changes like adding .toString() and changing CMakeLists.txt. Then I noticed the PR which is changing much more than I did.

I was able to run this code:

  1. Version: commit dc644d4 (HEAD -> master, origin/master, origin/HEAD)
    Author: Frank [email protected]
    Date: Wed Feb 5 22:45:58 2020 +0100

    Enhance Qt backward compability. (Enhance Qt backward compability. #34)

  2. Qt 6.6.2 GCC 64 BIT

  3. I'm attaching diff of my changes (a little different than the PR Qt 6 compatibility with CI build #47):
    diff.txt

Hopefully this will help You.

@Duolabs
Copy link

Duolabs commented Apr 17, 2024

First of all, thank you for the response and congratulations on what seems to be a very interesting widget.

I managed to compile it by adapting the changes; the two CMakeLists.txt files were compiled successfully.

I'm confused because the example still gives me the problem of not finding the various #include and it doesn't start.

Unfortunately, I usually use qmake for my projects and I don't understand how to integrate the widget, besides the fact that the example project does not find the various includes as mentioned before.

Can anybody explain me what O am doing wrong??

@baziorek
Copy link

I'm confused because the example still gives me the problem of not finding the various #include and it doesn't start.

I was facing the problem with not finding includes. Remember to use CMakeLists.txt which is outside (this https://github.com/Megaxela/QCodeEditor/blob/master/CMakeLists.txt instead of this: https://github.com/Megaxela/QCodeEditor/blob/master/example/CMakeLists.txt). Also make sure that You have all required additional libraries in QT (use QMaintanance tool).

I forgot to tell You that I'm using Linux (Ubuntu based PopOS).

@Duolabs
Copy link

Duolabs commented Apr 17, 2024

Well it has been a bit tricky to puzzle things together but I finnaly made it on Windows starting from fork:

https://github.com/l3enQ/QCodeEditor

I loaded the loaded the QCodeEditor (not the example)

From QT Creator I did

  1. Build->Run Generator->MinGW
    generated mypath/build-QCodeEditor-master-Desktop_Qt_6_4_2_MinGW_64_bit-MinSizeRel/qtc_MinGW_Makefiles

  2. $> cd mypath/build-QCodeEditor-master-Desktop_Qt_6_4_2_MinGW_64_bit-MinSizeRel/qtc_MinGW_Makefiles
    $> C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe

This generated a file mypath/build-QCodeEditor-master-Desktop_Qt_6_4_2_MinGW_64_bit-MinSizeRel/qtc_MinGW_Makefiles/libQCodeEditor.a

I setup a new blank application with qMake and just a simple form.

I added it to my qMake .pro by adding a folder to my project called: QCodeEditor and the edited to .pro file like this:

# Specify the path to the directory containing the library
LIBS += -L$$PWD/QCodeEditor/       # my current .pro folder and the newly created QCodeEditor folder

# Link against the library
LIBS += -lQCodeEditor                     # points to file **libQCodeEditor.a** inside QCodeEditor (folder)

In my MainWindow.cpp file I had to include the headers in this way:

#include <include/internal/QCodeEditor.hpp>
#include <include/internal/QGLSLCompleter.hpp>
#include <include/internal/QLuaCompleter.hpp>
#include <include/internal/QPythonCompleter.hpp>
#include <include/internal/QSyntaxStyle.hpp>
#include <include/internal/QCXXHighlighter.hpp>
#include <include/internal/QGLSLHighlighter.hpp>
#include <include/internal/QXMLHighlighter.hpp>
#include <include/internal/QJSONHighlighter.hpp>
#include <include/internal/QLuaHighlighter.hpp>
#include <include/internal/QPythonHighlighter.hpp>

And also needed to change a bunch of other .hhp files all in the same way by adding include/internal/xxxx.hpp

Finally in my MainWindow i added:

QCodeEditor* m_codeEditor;

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    
    m_codeEditor = new QCodeEditor(ui->CodeEditorWidget);  // Here the parent is a QWidget in the main ui to be able to treat the QCodeEditor as a normal QWidget later in my code
    
    QCompleter * PythonCompleter = new QPythonCompleter(this);
    m_codeEditor->setCompleter (PythonCompleter);

    QPythonHighlighter * Highlighter = new QPythonHighlighter ();
    m_codeEditor->setHighlighter(Highlighter);
    
    // more code
} 

I am now playing around with all the features....

here is a picture of my final result:

QCodeEditor

@rafal-tarnow
Copy link

Since there have been no new commits in this project for 5 years, I decided to breathe some life into it. It's forked in my repositories, I rebranded the name to K-Editor to avoid confusion, updated it to Qt to 6.6.3, cleaned up the CMakeLists (separated the library from the example), and added pull requests that appeared in the original QCodeEditor repository. If anyone is interested, feel free to collaborate

@baziorek
Copy link

baziorek commented May 4, 2024

Since there have been no new commits in this project for 5 years, I decided to breathe some life into it. It's forked in my repositories, I rebranded the name to K-Editor to avoid confusion, updated it to Qt to 6.6.3, cleaned up the CMakeLists (separated the library from the example), and added pull requests that appeared in the original QCodeEditor repository. If anyone is interested, feel free to collaborate

Here is link:
https://github.com/rafal-tarnow/K-Editor

@rafal-tarnow Great job Rafal!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants